Skip to content

Commit 66d1f45

Browse files
feat: add authentication feature (#27)
* feat: add authentication feature * migration: remove table that unrelated with authentication feature * lint: fix lint error * Fix: Update Prisma schema path in npm scripts 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. * Update .env.example * Refines Prisma configuration and updates linting scripts 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. * Prepares schema for initial authentication feature 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. * Implements social media authentication options. 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. * remove unnecessary columns * fix lint error * Merge branch 'pemrogrammer:main' into auth * implement client login form error handling * registration and email verification using otp (without smtp) * update login: remove email param to email-verification * add smtp support for OTP using Resend * add router dependency to fix lint * Improves login form layout and workflow for improved user experience. 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.
1 parent 0155a66 commit 66d1f45

File tree

32 files changed

+3157
-166
lines changed

32 files changed

+3157
-166
lines changed

.env.example

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
1-
DATABASE_URL=
1+
DATABASE_URL=
2+
BETTER_AUTH_SECRET=
3+
BETTER_AUTH_URL=
4+
5+
GOOGLE_CLIENT_ID=
6+
GOOGLE_CLIENT_SECRET=
7+
8+
GITHUB_CLIENT_ID=
9+
GITHUB_CLIENT_SECRET=
10+
11+
RESEND_API_KEY=

eslint.config.mjs

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { dirname } from 'path'
22
import { fileURLToPath } from 'url'
33
import { FlatCompat } from '@eslint/eslintrc'
44
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
5+
import unicorn from 'eslint-plugin-unicorn'
56

67
const __filename = fileURLToPath(import.meta.url)
78
const __dirname = dirname(__filename)
@@ -11,11 +12,40 @@ const compat = new FlatCompat({
1112
})
1213

1314
const eslintConfig = [
14-
...compat.extends('next/core-web-vitals', 'next/typescript', 'plugin:naming/recommended'),
15+
...compat.extends('next/core-web-vitals', 'next/typescript'),
1516
{
1617
ignores: ['node_modules/**', '.next/**', 'out/**', 'build/**', 'next-env.d.ts'],
1718
},
19+
{
20+
plugins: {
21+
unicorn,
22+
},
23+
rules: {
24+
'unicorn/filename-case': [
25+
'error',
26+
{
27+
case: 'kebabCase',
28+
ignore: [
29+
// This rule applies to filenames, not directory names.
30+
// The original regexes `/^\[.*\]$/` and `/^\(.*\)$/` didn't work because
31+
// they don't account for file extensions (e.g., `.tsx`).
32+
33+
// This updated regex correctly matches dynamic segment files
34+
// like `[id].tsx` or `[...slug].tsx`.
35+
/^\[.*\]\..+$/,
1836

37+
// This is for the uncommon case where a file is named like a route group,
38+
// e.g., `(marketing).tsx`.
39+
/^\(.*\)\..+$/,
40+
41+
// This correctly ignores files that start with an underscore,
42+
// such as `_app.tsx` or private utility files.
43+
/^_/,
44+
],
45+
},
46+
],
47+
},
48+
},
1949
eslintPluginPrettierRecommended,
2050
]
2151

0 commit comments

Comments
 (0)