Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Database Configuration
# For development (SQLite):
# DATABASE_URL="file:./dev.db"
DATABASE_URL="postgres://62f4097df5e872956ef3438a631f543fae4d5d42215bd0826950ab47ae13d1d8:sk_C9LGde4N8GzIwZvatfrYp@db.prisma.io:5432/postgres?sslmode=require"
DATABASE_URL="postgres://00a2b80f79491981d1bb3b2e9f16ff38e4f8ec8176d81850c1a0fc6b8d07aedb:sk_SAURAAr96utLcyihkDPJ7@db.prisma.io:5432/postgres?sslmode=require"
PRISMA_DATABASE_URL="postgres://62f4097df5e872956ef3438a631f543fae4d5d42215bd0826950ab47ae13d1d8:sk_C9LGde4N8GzIwZvatfrYp@db.prisma.io:5432/postgres?sslmode=require"
POSTGRES_URL="postgres://62f4097df5e872956ef3438a631f543fae4d5d42215bd0826950ab47ae13d1d8:sk_C9LGde4N8GzIwZvatfrYp@db.prisma.io:5432/postgres?sslmode=require"
PRISMA_DATABASE_URL="prisma+postgres://accelerate.prisma-data.net/?api_key=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqd3RfaWQiOjEsInNlY3VyZV9rZXkiOiJza19DOUxHZGU0TjhHekl3WnZhdGZyWXAiLCJhcGlfa2V5IjoiMDFLQVBFN1lQMEdDQzMwQjdEMDFQUkVGWjkiLCJ0ZW5hbnRfaWQiOiI2MmY0MDk3ZGY1ZTg3Mjk1NmVmMzQzOGE2MzFmNTQzZmFlNGQ1ZDQyMjE1YmQwODI2OTUwYWI0N2FlMTNkMWQ4IiwiaW50ZXJuYWxfc2VjcmV0IjoiMTVmYjFkMTAtMDg3Ny00ZWIwLTg2NDktODI0NDFlMjFkMWM4In0.TwVbX50ckjTqPEamd8eD2gR2VE_s0T3dVn4FZ4nhnS8"
Expand All @@ -16,3 +16,9 @@ NEXTAUTH_URL="http://localhost:3000"
# Email Configuration
EMAIL_FROM="noreply@example.com"
RESEND_API_KEY="re_dummy_key_for_build" # Build fails without this

SSLCOMMERZ_STORE_ID="codes69469d5ee7198"
SSLCOMMERZ_STORE_PASSWORD="codes69469d5ee7198@ssl"
SSLCOMMERZ_IS_SANDBOX="true"
SSLCOMMERZ_SESSION_API="https://sandbox.sslcommerz.com/gwprocess/v3/api.php"
SSLCOMMERZ_VALIDATION_API="https://sandbox.sslcommerz.com/validator/api/validationserverAPI.php"
13 changes: 6 additions & 7 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
/.github
copilot-instructions.md # This file
/agents # Custom agent definitions
middleware.ts # NextAuth middleware (route protection)
middleware.ts # Subdomain routing + auth protection
next.config.ts # React Compiler enabled
tsconfig.json # TypeScript config (paths: @/*)
components.json # shadcn-ui config
Expand All @@ -91,9 +91,9 @@ components.json # shadcn-ui config
- **Session**: JWT strategy, `session.user.id` added in callback (NEVER remove)
- **Config**: `src/lib/auth.ts` exports `authOptions`
- **Handler**: `src/app/api/auth/[...nextauth]/route.ts` (5 lines)
- **Protection**: `middleware.ts` (re-export from `next-auth/middleware`)
- **Matcher**: `/dashboard/:path*`, `/settings/:path*`, `/team/:path*`, `/projects/:path*`
- **To Protect New Route**: Add to matcher array (e.g., `"/reports/:path*"`)
- **Protection**: `middleware.ts` (handles subdomain routing + auth protection)
- **Protected Routes**: `/dashboard/:path*`, `/settings/:path*`, `/team/:path*`, `/projects/:path*`, `/products/:path*`
- **To Protect New Route**: Add to `protectedPaths` array in middleware.ts
- **Server Session**: Use `getServerSession(authOptions)` in Server Components
- **Client Session**: Use `useSession()` hook in Client Components

Expand Down Expand Up @@ -145,7 +145,7 @@ npx dotenv -e .env.local -- prisma migrate dev --schema=prisma/schema.prisma

### Adding Protected Routes
1. Create route folder in `src/app/your-route`
2. Add to `middleware.ts` matcher: `"/your-route/:path*"`
2. Add to `protectedPaths` array in `middleware.ts`
3. Use `getServerSession(authOptions)` to check auth in Server Components

### Adding shadcn-ui Components
Expand All @@ -162,7 +162,7 @@ npx dotenv -e .env.local -- prisma migrate dev --schema=prisma/schema.prisma
- **eslint.config.mjs**: ESLint 9 flat config, Next.js rules
- **components.json**: shadcn-ui config (New York style, RSC, Tailwind v4)
- **postcss.config.mjs**: Tailwind CSS PostCSS plugin
- **middleware.ts**: NextAuth route protection (5 lines)
- **middleware.ts**: Subdomain routing + auth protection for multi-tenant stores

## Common Pitfalls & Workarounds

Expand Down Expand Up @@ -192,7 +192,6 @@ npx dotenv -e .env.local -- prisma migrate dev --schema=prisma/schema.prisma
- **Password Auth**: Add `passwordHash` to User model, implement CredentialsProvider (dev only)
- **OAuth**: Extend `authOptions.providers` (keep environment separation)
- **Cache Tags**: Use `revalidateTag()` for org-switch or membership updates
- **Middleware Migration**: Next.js 16 recommends `proxy.ts` over `middleware.ts` (not yet migrated)

## Validation & Testing

Expand Down
11 changes: 11 additions & 0 deletions .vscode/mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"servers": {
"shadcn": {
"command": "npx",
"args": [
"shadcn@latest",
"mcp"
]
}
}
}
Loading