Sandbox
@CodeGuide-dev/codeguide-starter-fullstack

Next.js fullstack starter for AI agent workflows

This is a boilerplate for starting a web app with authentication, a PostgreSQL database, dark mode, and shadcn/ui components. It is organized so coding agents can work from clear files, docs, and config instead of a blank project.

151 starsβ€’44 forksβ€’TypeScriptβ€’Updated 11mo ago
Who it's for

Builders who want a ready-made Next.js app that Claude Code, Cursor, or other agents can extend.

What it delivers

You can begin building a fullstack app with auth, database, and UI scaffolding already wired up.

What it does

Next.js 15 app router starter

Provides an App Router structure with pages, layouts, and global styles in `app/`.

Better Auth integration

Includes auth helpers and setup for email/password sign-in and sign-up flows.

Drizzle ORM with PostgreSQL

Ships database schema, migrations, and connection code for type-safe data access.

Docker-based local setup

Includes `docker-compose.yaml` and Postgres container files for local development and deployment.

shadcn/ui component library

Bundles prebuilt UI components and `components.json` for adding more.

Agent-oriented project docs

Adds `CLAUDE.md` and the `documentation/` folder with app flow, backend, frontend, security, and stack notes.

How to get it

  1. 1Clone the repository
    git clone <repository-url>
    cd codeguide-starter-fullstack
  2. 2Install dependencies
    npm install
    # or
    yarn install
    # or
    pnpm install
  3. 3Copy the .env.example file to .env
    cp .env.example .env
  4. 4Start the development server
    npm run dev
    # or
    yarn dev
    # or
    pnpm dev
  5. 5Start PostgreSQL with Docker
    npm run db:up
  6. 6Push database schema
    npm run db:push

README

Codeguide Starter Fullstack

A modern web application starter template built with Next.js 15, featuring authentication, database integration, and dark mode support.

Tech Stack

Prerequisites

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

Getting Started

  1. Clone the repository

    git clone <repository-url>
    cd codeguide-starter-fullstack
    
  2. Install dependencies

    npm install
    # or
    yarn install
    # or
    pnpm install
    
  3. Environment Variables Setup

    • Copy the .env.example file to .env:
      cp .env.example .env
      
    • The default values work with Docker setup, modify as needed
  4. Start the development server

    npm run dev
    # or
    yarn dev
    # or
    pnpm dev
    
  5. Open http://localhost:3000 with your browser to see the result.

Configuration

Option 1: Docker Setup (Recommended)

  1. Start PostgreSQL with Docker:

    npm run db:up
    

    This starts PostgreSQL in a Docker container with default credentials.

  2. Push database schema:

    npm run db:push
    

Option 2: Local Database Setup

  1. Create a PostgreSQL database locally
  2. 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
    
  3. Run database migrations:
    npm run db:push
    

Environment Variables

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

Features

  • πŸ” 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

Project Structure

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

Database Integration

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

Development Commands

Application

  • npm run dev - Start development server with Turbopack
  • npm run build - Build for production with Turbopack
  • npm start - Start production server
  • npm run lint - Run ESLint

Database

  • npm run db:up - Start PostgreSQL in Docker
  • npm run db:down - Stop PostgreSQL container
  • npm run db:dev - Start development PostgreSQL (port 5433)
  • npm run db:dev-down - Stop development PostgreSQL
  • npm run db:push - Push schema changes to database
  • npm run db:generate - Generate Drizzle migration files
  • npm run db:studio - Open Drizzle Studio (database GUI)
  • npm run db:reset - Reset database (drop all tables and recreate)

Styling with shadcn/ui

  • 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]

Docker

  • npm run docker:build - Build application Docker image
  • npm run docker:up - Start full application stack (app + database)
  • npm run docker:down - Stop all containers
  • npm run docker:logs - View container logs
  • npm run docker:clean - Stop containers and clean up volumes

Docker Development

Quick Start with Docker

# Start the entire stack (recommended for new users)
npm run docker:up

# View logs
npm run docker:logs

# Stop everything
npm run docker:down

Development Workflow

# 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

Docker Services

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)

Docker Profiles

# Start development database on port 5433
docker-compose --profile dev up postgres-dev -d

# Or use the npm script
npm run db:dev

Deployment

Production Deployment

Option 1: Docker Compose (VPS/Server)

  1. Clone and setup on your server:

    git clone <your-repo>
    cd codeguide-starter-fullstack
    cp .env.example .env
    
  2. 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
    
  3. Deploy:

    npm run docker:up
    

Option 2: Container Registry (AWS/GCP/Azure)

  1. 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
    
  2. Deploy using your cloud provider's container service

Option 3: Vercel + External Database

  1. Deploy to Vercel:

    npm i -g vercel
    vercel
    
  2. Add environment variables in Vercel dashboard:

    • DATABASE_URL: Your managed PostgreSQL connection string
    • BETTER_AUTH_SECRET: Generate a secure secret
    • BETTER_AUTH_URL: Your Vercel deployment URL
  3. Setup database:

    # Push schema to your managed database
    npm run db:push
    

Environment Variables for Production

# 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

Production Considerations

  • 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

Health Checks

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

AI Coding Agent Integration

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

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

codeguide-starter-fullstack

Files in the repo

Repository payloadβ€’26 top-level entries
  • app
  • components
  • db
  • docker
  • documentation
  • drizzle
  • hooks
  • lib
  • public
  • .dockerignore
  • .env.example
  • .gitignore
  • .prettierrc
  • CLAUDE.md
  • codeguide-backdrop.svg
  • components.json
  • docker-compose.yaml
  • Dockerfile
  • drizzle.config.ts
  • eslint.config.mjs
  • next.config.ts
  • package-lock.json
  • package.json
  • postcss.config.mjs
  • README.md
  • tsconfig.json

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More templates

CopilotKit/
OpenBot

Open-source AI coworkers that each get a computer of their own: a browser, files and tools, with every action decided before it happens and recorded after. Bring any AG-UI agent.

4.6k
Donchitos/
Claude-Code-Game-Studios

Turn Claude Code into a full game dev studio β€” 49 AI agents, 72 workflow skills, and a complete coordination system mirroring real studio hierarchy.

25k

A self-organizing Obsidian vault that gives AI coding agents persistent memory. Claude Code, Codex CLI, Gemini CLI.

4.6k
idavidov13/
agentic-playwright

Production-grade Playwright + TypeScript Scaffold for Agentic Testing. Harness for all major AI coding agents baked in.

163
gavishap/
omnia-vault

Omnia Vault - the all-in-one project brain: an Obsidian LLM wiki, Graphify code graphs, a living plan that triages new videos against itself, and a Claude Code ⇄ Codex relay. Everything your project knows, in one clonable vault.

60

🎬 TαΊ‘o video "so sΓ‘nh kiαΊΏn thα»©c" ngαΊ―n tα»± Δ‘α»™ng β€” HyperFrames + AI voice, 1 template nhiều chα»§ đề.

169