7.2 KiB
7.2 KiB
Implementation Checklist
Complete checklist for scaffolding a Next.js full-stack application.
Phase 1: Project Setup
Configuration Files
package.json- Dependencies and scriptstsconfig.json- TypeScript configurationnext.config.ts- Next.js configurationtailwind.config.ts- Tailwind CSS + shadcn/uipostcss.config.mjs- PostCSS configurationeslint.config.mjs- ESLint v9 flat configprettier.config.js- Prettier configuration.gitignore- Git ignore patterns.env.example- Environment variables templateREADME.md- Setup instructions
Testing Configuration
vitest.config.ts- Vitest configurationplaywright.config.ts- Playwright configuration- Set up test directories (
tests/unit,tests/integration,tests/e2e)
Git Hooks
- Initialize Husky (
npx husky init) - Add pre-commit hook for lint-staged
- Configure lint-staged in package.json
Phase 2: Folder Structure
App Router Structure
app/layout.tsx- Root layoutapp/page.tsx- Home pageapp/globals.css- Global styles with Tailwindapp/(auth)/login/page.tsx- Login pageapp/(auth)/layout.tsx- Auth layoutapp/(protected)/dashboard/page.tsx- Dashboardapp/(protected)/profile/page.tsx- User profileapp/(protected)/data/page.tsx- Data table pageapp/(protected)/layout.tsx- Protected layoutapp/api/data/route.ts- Example API routemiddleware.ts- Auth middleware
Components
components/providers.tsx- App providers (Toaster, etc.)components/layout/header.tsx- Header componentcomponents/layout/sidebar.tsx- Sidebar componentcomponents/layout/nav.tsx- Navigation componentcomponents/auth/login-form.tsx- Login form with RHF + Zodcomponents/auth/auth-button.tsx- Login/logout buttoncomponents/dashboard/stats-card.tsx- Stats card componentcomponents/dashboard/data-table.tsx- Data table component
shadcn/ui Components
components/ui/button.tsxcomponents/ui/card.tsxcomponents/ui/input.tsxcomponents/ui/label.tsxcomponents/ui/form.tsxcomponents/ui/table.tsxcomponents/ui/dropdown-menu.tsxcomponents/ui/avatar.tsx
Lib Files
lib/utils.ts- Utility functions (cn, etc.)lib/prisma.ts- Prisma client singletonlib/supabase/client.ts- Supabase client for client componentslib/supabase/server.ts- Supabase client for server componentslib/supabase/middleware.ts- Supabase middleware helperlib/actions/auth.ts- Auth server actionslib/actions/user.ts- User server actionslib/actions/data.ts- Data server actionslib/validations/auth.ts- Auth validation schemaslib/validations/user.ts- User validation schemaslib/validations/data.ts- Data validation schemas
Database
prisma/schema.prisma- Prisma schemaprisma/seed.ts- Database seed script
Phase 3: Core Features
Authentication
- Supabase auth setup (server + client)
- Login form with email/password
- Server action for sign in
- Server action for sign out
- Middleware for protected routes
- Auth state management
- Redirect logic after login/logout
Protected Routes
- Dashboard page with data fetching
- Profile page with user info
- Data table page with CRUD operations
- Server actions for mutations
- Form validation with Zod
- Toast notifications on success/error
UI Components
- Responsive layout with header/sidebar
- Dark mode toggle (optional)
- Loading states with Suspense
- Error boundaries
- Accessible forms with shadcn/ui
Database Integration
- Prisma schema with User model
- Prisma schema with example data model
- Database migrations
- Seed script with sample data
- Prisma client queries in server components
- Server actions with database mutations
Phase 4: Testing
Unit Tests
tests/unit/utils.test.ts- Test utility functions- Test Zod validation schemas
- Test helper functions
Integration Tests
tests/integration/auth.test.tsx- Test auth components- Test form submissions
- Test server actions
E2E Tests
tests/e2e/login.spec.ts- Test login flow- Test protected route access
- Test form submission flows
- Test navigation
Phase 5: CI/CD
GitHub Actions
.github/workflows/ci.yml- CI workflow- Run linting
- Run type checking
- Run tests
- Run build
- Set up Vercel deployment (optional)
Phase 6: Documentation
README Sections
- Project overview
- Tech stack list
- Prerequisites
- Installation steps
- Environment variable setup
- Database setup (Prisma)
- Supabase setup instructions
- Running locally
- Testing commands
- Deployment instructions
- Folder structure explanation
- Contributing guidelines (optional)
Verification Steps
After scaffolding, verify:
- Dependencies Install:
npm installcompletes without errors - Type Checking:
npx tsc --noEmitpasses - Linting:
npm run lintpasses - Formatting:
npm run format:checkpasses - Build:
npm run buildsucceeds - Tests:
npm testpasses - E2E Tests:
npm run test:e2epasses (with test environment) - Dev Server:
npm run devstarts successfully - Prisma:
npx prisma generateworks - Git Hooks: Commit triggers lint-staged
Common Issues & Solutions
Issue: Prisma client not generated
Solution: Run npx prisma generate after schema changes
Issue: Supabase auth not working
Solution: Check environment variables and cookie configuration
Issue: ESLint errors
Solution: Run npm run lint -- --fix to auto-fix
Issue: Type errors
Solution: Ensure all dependencies are installed and Prisma is generated
Issue: Build fails
Solution: Check for missing environment variables and type errors
Issue: Tests fail
Solution: Ensure test environment is properly configured in vitest.config.ts
Post-Scaffold Tasks
After completing the scaffold:
- Environment Setup: Copy
.env.exampleto.envand fill in values - Supabase Project: Create Supabase project and get credentials
- Database Schema: Run
npx prisma db pushto sync schema - Seed Data: Run
npm run db:seedto populate sample data - Install shadcn/ui: Run initialization commands for components
- Git Init: Initialize git repository and make first commit
- Deploy: Connect to Vercel and deploy
- Test: Verify all features work in production
Optional Enhancements
Consider adding these after the base scaffold:
- Email verification flow
- Password reset flow
- User roles and permissions
- Multi-factor authentication
- File upload with Supabase Storage
- Real-time subscriptions
- Advanced data table features (export, filters)
- User preferences/settings page
- Activity logs/audit trail
- API documentation
- Storybook for components
- Performance monitoring
- Error tracking (Sentry)
- Analytics integration