Skip to main content

Installation

This guide covers the complete setup process for ZeroStarter, including all prerequisites, environment configuration, database setup, and optional integrations like OAuth providers and analytics.

Prerequisites

Before installing ZeroStarter, ensure you have the following installed on your system:

Required

1

Bun Runtime

ZeroStarter requires Bun v1.3.7 or higher.Install Bun:
curl -fsSL https://bun.sh/install | bash
Verify installation:
bun --version
# Should output: 1.3.7 or higher
2

PostgreSQL Database

You need a PostgreSQL database (version 12 or higher).Option 1: Local PostgreSQL
# macOS
brew install postgresql@16
brew services start postgresql@16

# Ubuntu/Debian
sudo apt install postgresql postgresql-contrib
sudo systemctl start postgresql
Option 2: Managed Database
Use bunx pglaunch -k to quickly generate a free PostgreSQL URL from supported providers.
3

Git

Required for version control.
git --version

Optional

  • Node.js: While not required (Bun is used), some tools may expect it
  • Docker: For containerized deployment
  • pnpm/npm: Only if you prefer these over Bun (not recommended)

Installation Steps

1. Clone the Repository

Clone ZeroStarter using gitpick for a clean copy without git history:
bunx gitpick https://github.com/nrjdalal/zerostarter/tree/main
cd zerostarter
Alternatively, you can fork the repository on GitHub and clone your fork:
git clone https://github.com/YOUR_USERNAME/zerostarter.git
cd zerostarter

2. Install Dependencies

Install all workspace dependencies:
bun install
This installs dependencies for:
  • api/hono - Backend API server
  • web/next - Frontend application
  • packages/auth - Shared authentication
  • packages/db - Database and ORM
  • packages/env - Environment variables
  • packages/tsconfig - TypeScript configuration
The postinstall script automatically runs dependency management tasks. This is configured in package.json:31.

3. Environment Configuration

Copy the example environment file:
cp .env.example .env
Now configure your .env file:

Essential Variables

# Environment (local, development, staging, production)
NODE_ENV=local

# API Server Configuration
HONO_APP_URL=http://localhost:4000
HONO_TRUSTED_ORIGINS=http://localhost:3000

# Rate Limiting (requests per minute)
HONO_RATE_LIMIT=60
HONO_RATE_LIMIT_WINDOW_MS=60000
Never commit your .env file to version control! The .gitignore is configured to exclude it, but always double-check.

OAuth Providers (Optional)

Configure social authentication providers:
  1. Go to GitHub Developer Settings
  2. Click “New OAuth App”
  3. Fill in the details:
    • Application name: ZeroStarter Local
    • Homepage URL: http://localhost:3000
    • Authorization callback URL: http://localhost:3000/api/auth/callback/github
  4. Click “Register application”
  5. Generate a client secret
  6. Add to .env:
GITHUB_CLIENT_ID="your-github-client-id"
GITHUB_CLIENT_SECRET="your-github-client-secret"
  1. Go to Google Cloud Console
  2. Create a new project or select an existing one
  3. Navigate to “Credentials” > “Create Credentials” > “OAuth client ID”
  4. Configure the OAuth consent screen if prompted
  5. Select “Web application” as the application type
  6. Add authorized redirect URIs:
    • http://localhost:3000/api/auth/callback/google
  7. Click “Create”
  8. Add to .env:
GOOGLE_CLIENT_ID="your-google-client-id.apps.googleusercontent.com"
GOOGLE_CLIENT_SECRET="your-google-client-secret"

Analytics (Optional)

PostHog provides product analytics, feature flags, and session recordings.
  1. Sign up at PostHog
  2. Create a new project
  3. Get your project API key
  4. Add to .env:
NEXT_PUBLIC_POSTHOG_HOST=https://eu.i.posthog.com
NEXT_PUBLIC_POSTHOG_KEY="phc_your-project-key"
See the Analytics documentation for more details.

4. Database Setup

Generate and apply database migrations:
1

Generate Migrations

Generate Drizzle ORM migrations from your schema:
bun run db:generate
This reads your schema from packages/db/src/schema/ and creates migration files in packages/db/drizzle/.
2

Run Migrations

Apply migrations to your database:
bun run db:migrate
This creates all necessary tables for:
  • User accounts
  • Sessions
  • OAuth accounts
  • Email verification
3

Verify Database

Open Drizzle Studio to explore your database:
bun run db:studio
This opens a web interface at https://local.drizzle.studio where you can:
  • View all tables and data
  • Run queries
  • Modify records
The database schema is defined in packages/db/src/schema/auth.ts and uses Better Auth’s schema conventions.

5. Start Development

Start all development servers:
bun dev
This command:
  1. Builds shared packages (@packages/env, @packages/db, @packages/auth)
  2. Starts the Hono API server at http://localhost:4000
  3. Starts the Next.js frontend at http://localhost:3000
  4. Enables hot module reloading for all packages
You should see Turborepo’s TUI showing logs from all services:
• Packages in scope: @api/hono, @web/next, @packages/auth, @packages/db, @packages/env
• Running dev in 5 packages
• Remote caching disabled

@api/hono:dev: Server running at http://localhost:4000
@web/next:dev: ▲ Next.js 16.1.6
@web/next:dev: - Local:   http://localhost:3000

Verification

Verify your installation is working correctly:

API Health Check

Test the API server:
curl http://localhost:4000/api/health
Expected response:
{
  "data": {
    "message": "ok",
    "version": "0.0.14",
    "environment": "local"
  }
}

Frontend

Open http://localhost:3000 in your browser. You should see the ZeroStarter landing page.

API Documentation

Visit http://localhost:4000/api/docs to explore the interactive API documentation powered by Scalar.

Type-Safe API Client

Test the Hono RPC client by creating a test file:
web/next/test-api.ts
import { apiClient } from "@/lib/api/client"

const response = await apiClient.health.$get()
const { data } = await response.json()

console.log(data) // Fully typed!
Run it:
bun web/next/test-api.ts

Build for Production

Build all packages and applications:
bun run build
This creates optimized production builds:
  • api/hono/dist/ - Bundled API server
  • web/next/.next/ - Next.js production build
  • packages/*/dist/ - Built shared packages
See the Deployment documentation for production deployment guides.

Package Scripts

ZeroStarter includes many useful scripts defined in package.json:20-35:
ScriptDescription
bun devStart development servers with TUI
bun buildBuild all packages and applications
bun run db:generateGenerate Drizzle migrations
bun run db:migrateRun database migrations
bun run db:studioOpen Drizzle Studio
bun run lintLint all packages with Oxlint
bun run formatFormat code with Oxfmt
bun run format:checkCheck code formatting
bun run check-typesType-check all packages
bun run cleanRemove build artifacts and node_modules
bun startStart production servers
See the Scripts documentation for detailed information about all available commands.

Troubleshooting

If Bun fails to install:
# Try the manual installation
curl -fsSL https://bun.sh/install | bash -s "bun-v1.3.7"

# Add to PATH (if not automatic)
echo 'export PATH="$HOME/.bun/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
Common database issues:Connection refused:
  • Verify PostgreSQL is running: pg_isready
  • Check the connection string format
  • Ensure the database exists
Authentication failed:
  • Verify username and password
  • Check PostgreSQL user permissions
SSL/TLS errors:
  • For local databases, remove SSL requirements
  • For managed databases, ensure SSL is enabled in the connection string
If ports 3000 or 4000 are in use:Find the process:
lsof -i :3000
lsof -i :4000
Change the ports:
  • Frontend: Modify web/next/package.json dev script to use next dev -p 3001
  • Backend: Add HONO_PORT=4001 to .env
If you see “Cannot find module” errors:
# Clean everything
bun run clean

# Reinstall dependencies
bun install

# Build shared packages
bun run build --filter='@packages/*'
Clear Turborepo cache:
# Remove cache directories
rm -rf .turbo
rm -rf node_modules/.cache

# Rebuild
bun run build

Next Steps

Architecture

Understand the tech stack and design decisions.

Project Structure

Learn how the monorepo is organized.

Type-Safe API

Master Hono RPC for end-to-end type safety.

Deployment

Deploy to production on Vercel or other platforms.

Build docs developers (and LLMs) love