A modern web application starter template built with Next.js 15, featuring authentication, database integration, and dark mode support.
- Framework: Next.js 15 (App Router with Turbopack)
- Language: TypeScript
- Authentication: Better Auth
- Database: Drizzle ORM with PostgreSQL
- Styling: Tailwind CSS v4
- UI Components: shadcn/ui (New York style)
- Theme System: next-themes
- Icons: Lucide React
Before you begin, ensure you have the following:
- Node.js 18+ installed
- Docker and Docker Compose (for database setup)
- Generated project documents from CodeGuide for best development experience
-
Clone the repository
git clone <repository-url> cd codeguide-starter-fullstack
-
Install dependencies
npm install # or yarn install # or pnpm install
-
Environment Variables Setup
- Copy the
.env.example
file to.env
:cp .env.example .env
- The default values work with Docker setup, modify as needed
- Copy the
-
Start the development server
npm run dev # or yarn dev # or pnpm dev
-
Open http://localhost:3000 with your browser to see the result.
-
Start PostgreSQL with Docker:
npm run db:up
This starts PostgreSQL in a Docker container with default credentials.
-
Push database schema:
npm run db:push
- Create a PostgreSQL database locally
- Update your environment variables in
.env
:DATABASE_URL=postgresql://username:password@localhost:5432/database_name POSTGRES_DB=your_database_name POSTGRES_USER=your_username POSTGRES_PASSWORD=your_password
- Run database migrations:
npm run db:push
Create a .env
file in the root directory with the following variables:
# Database Configuration (defaults work with Docker)
DATABASE_URL=postgresql://postgres:postgres@localhost:5433/postgres
POSTGRES_DB=postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
# Authentication
BETTER_AUTH_SECRET=your_secret_key_here
BETTER_AUTH_URL=http://localhost:3000
NEXT_PUBLIC_BETTER_AUTH_URL=http://localhost:3000
- π Authentication with Better Auth (email/password)
- ποΈ PostgreSQL Database with Drizzle ORM
- π¨ 40+ shadcn/ui components (New York style)
- π Dark mode with system preference detection
- π App Router with Server Components and Turbopack
- π± Responsive design with TailwindCSS v4
- π― Type-safe database operations
- π Modern authentication patterns
- π³ Full Docker support with multi-stage builds
- π Production-ready deployment configuration
codeguide-starter-fullstack/
βββ app/ # Next.js app router pages
β βββ globals.css # Global styles with dark mode
β βββ layout.tsx # Root layout with providers
β βββ page.tsx # Main page
βββ components/ # React components
β βββ ui/ # shadcn/ui components (40+)
βββ db/ # Database configuration
β βββ index.ts # Database connection
β βββ schema/ # Database schemas
βββ docker/ # Docker configuration
β βββ postgres/ # PostgreSQL initialization
βββ hooks/ # Custom React hooks
βββ lib/ # Utility functions
β βββ auth.ts # Better Auth configuration
β βββ utils.ts # General utilities
βββ auth-schema.ts # Authentication schema
βββ docker-compose.yml # Docker services configuration
βββ Dockerfile # Application container definition
βββ drizzle.config.ts # Drizzle configuration
βββ components.json # shadcn/ui configuration
This starter includes modern database integration:
- Drizzle ORM for type-safe database operations
- PostgreSQL as the database provider
- Better Auth integration with Drizzle adapter
- Database migrations with Drizzle Kit
npm run dev
- Start development server with Turbopacknpm run build
- Build for production with Turbopacknpm start
- Start production servernpm run lint
- Run ESLint
npm run db:up
- Start PostgreSQL in Dockernpm run db:down
- Stop PostgreSQL containernpm run db:dev
- Start development PostgreSQL (port 5433)npm run db:dev-down
- Stop development PostgreSQLnpm run db:push
- Push schema changes to databasenpm run db:generate
- Generate Drizzle migration filesnpm run db:studio
- Open Drizzle Studio (database GUI)npm run db:reset
- Reset database (drop all tables and recreate)
- Pre-configured with 40+ shadcn/ui components in New York style
- Components are fully customizable and use CSS variables for theming
- Automatic dark mode support with next-themes integration
- Add new components:
npx shadcn@latest add [component-name]
npm run docker:build
- Build application Docker imagenpm run docker:up
- Start full application stack (app + database)npm run docker:down
- Stop all containersnpm run docker:logs
- View container logsnpm run docker:clean
- Stop containers and clean up volumes
# Start the entire stack (recommended for new users)
npm run docker:up
# View logs
npm run docker:logs
# Stop everything
npm run docker:down
# Option 1: Database only (develop app locally)
npm run db:up # Start PostgreSQL
npm run dev # Start Next.js development server
# Option 2: Full Docker stack
npm run docker:up # Start both app and database
The docker-compose.yml
includes:
- postgres: Main PostgreSQL database (port 5432)
- postgres-dev: Development database (port 5433) - use
--profile dev
- app: Next.js application container (port 3000)
# Start development database on port 5433
docker-compose --profile dev up postgres-dev -d
# Or use the npm script
npm run db:dev
-
Clone and setup on your server:
git clone <your-repo> cd codeguide-starter-fullstack cp .env.example .env
-
Configure environment variables:
# Edit .env with production values DATABASE_URL=postgresql://postgres:your_secure_password@postgres:5432/postgres POSTGRES_DB=postgres POSTGRES_USER=postgres POSTGRES_PASSWORD=your_secure_password BETTER_AUTH_SECRET=your-very-secure-secret-key BETTER_AUTH_URL=https://yourdomain.com NEXT_PUBLIC_BETTER_AUTH_URL=https://yourdomain.com
-
Deploy:
npm run docker:up
-
Build and push image:
# Build the image docker build -t your-registry/codeguide-starter-fullstack:latest . # Push to registry docker push your-registry/codeguide-starter-fullstack:latest
-
Deploy using your cloud provider's container service
-
Deploy to Vercel:
npm i -g vercel vercel
-
Add environment variables in Vercel dashboard:
DATABASE_URL
: Your managed PostgreSQL connection stringBETTER_AUTH_SECRET
: Generate a secure secretBETTER_AUTH_URL
: Your Vercel deployment URL
-
Setup database:
# Push schema to your managed database npm run db:push
# Required for production
DATABASE_URL=postgresql://user:password@host:port/database
BETTER_AUTH_SECRET=generate-a-very-secure-32-character-key
BETTER_AUTH_URL=https://yourdomain.com
# Optional optimizations
NODE_ENV=production
- Database: Use managed PostgreSQL (AWS RDS, Google Cloud SQL, etc.)
- Security: Generate strong secrets, use HTTPS
- Performance: Enable Next.js output: 'standalone' for smaller containers
- Monitoring: Add logging and health checks
- Backup: Regular database backups
- SSL: Terminate SSL at load balancer or reverse proxy
The application includes basic health checks. You can extend them:
# In Dockerfile, add health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD curl -f http://localhost:3000/api/health || exit 1
This starter is optimized for AI coding agents:
- Clear file structure and naming conventions
- TypeScript integration with proper type definitions
- Modern authentication patterns
- Database schema examples
Contributions are welcome! Please feel free to submit a Pull Request.