Skip to content

Conversation

@samthelightbender
Copy link
Collaborator

@samthelightbender samthelightbender commented Sep 24, 2025

feat: Add Login (Email and Password) and Logout Functionality

Description

This pull request introduces the initial phase of the authentication feature, focusing specifically on login and logout functionality. It lays the groundwork for the complete authentication system by setting up the necessary database models and a seeding script for test users.

Key Changes:

  • Added Session and Verification models to the Prisma schema to support authentication.
  • Created API endpoints for the login and logout processes.
  • Implemented a seeding script to create a test user for login.
  • Added npm scripts to streamline the database setup process.

Setup and Testing Instructions

To get this feature running locally, please follow these steps in order:

  1. Add Environment Variables
    Make sure you add the following to your .env.development.example file.

    DATABASE_URL="postgresql://USER:PASSWORD@HOST:PORT/DATABASE"
    BETTER_AUTH_URL="http://your-app-url.com:port"
    BETTER_AUTH_SECRET="your-super-secret-key-here"

    Note: The BETTER_AUTH_SECRET should be a securely generated secret.

  2. Generate Prisma Client
    Run this command to generate the Prisma Client according to the latest schema.

    npm run db:generate:dev
  3. Run Database Migrations
    This command will apply the new schema changes to your database.

    npm run db:migrate:dev
  4. Seed the Database
    Use this command to populate the database with initial user data for testing purposes.

    npm run db:seed:dev

After completing these steps, the application will be ready for testing the login and logout features.

@vercel
Copy link

vercel bot commented Sep 24, 2025

@samthelightbender is attempting to deploy a commit to the sensasidelight's projects Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link

vercel bot commented Sep 24, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
code-showcase-studio Error Error Sep 25, 2025 7:46am

Copy link
Contributor

@sensasi-delight sensasi-delight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please fix error lint

image

@samthelightbender
Copy link
Collaborator Author

fixed lint error, please check again 🚀

samthelightbender and others added 7 commits September 25, 2025 16:44
Changed the Prisma schema path in all related npm scripts from 'src/prisma/schema.prisma' to 'prisma/schema.prisma' to reflect the new schema location.
Centralizes the Prisma schema path within `prisma.config.ts`, enabling the removal of redundant `--schema` arguments from database-related npm scripts.

Integrates `prisma format` into the `lint` and `lint:fix` commands to ensure consistent code formatting.

Removes the unused `eslint-plugin-naming` dependency and cleans up an unused `lucide-react` import and unutilized `ctx` parameters in authentication callbacks.
Temporarily comments out models and fields unrelated to core authentication. This includes `Post`, `Like`, `Comment`, `Report`, `Follow`, and `LeaderboardSnapshot` models, along with their associated relations in the `User` model.

This change streamlines the database schema to focus solely on the initial authentication functionality, enabling a clearer development path. These features will be uncommented and implemented as they are developed.

Also renames the base migration file to accurately reflect its purpose in setting up the initial authentication tables.
This commit adds support for authenticating with Google and GitHub in addition to the existing authentication mechanism. This enhancement allows users to login using their social media accounts, providing a more convenient and secure experience. The changes include adding new environment variables and registering the authentication routes.
Copy link
Contributor

@sensasi-delight sensasi-delight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • add sign up form
  • show error auth to frontend

@samthelightbender
Copy link
Collaborator Author

see the otp code at the verification table manually (for temporary)

@samthelightbender
Copy link
Collaborator Author

Read Resend SMTP Docs and put the Resend API Key to your development env
RESEND_API_KEY=

Enhances the accessibility and readability of the login form by providing clear labels and links for users.
Updates the layout to direct users to the correct authentication routes.
Adds social login buttons for GitHub.
Updates the CTAs on the landing page and header to direct users to the login/auth/register pages.
Improves overall user navigation and reduces confusion.
@sensasi-delight sensasi-delight added the 🔑 USER & AUTH User accounts, authentication (email & OAuth), profiles, and account security. label Sep 30, 2025
@sensasi-delight sensasi-delight linked an issue Sep 30, 2025 that may be closed by this pull request
10 tasks
@sensasi-delight sensasi-delight merged commit 66d1f45 into pemrogrammer:main Sep 30, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🔑 USER & AUTH User accounts, authentication (email & OAuth), profiles, and account security.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🔑 Implement Authentication (Email/Password + OAuth Google & GitHub)

2 participants