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
PostgreSQL Database
You need a PostgreSQL database (version 12 or higher).Option 1: Local PostgreSQLOption 2: Managed Database
- Neon (recommended for development)
- Supabase
- Railway
- Vercel Postgres
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 usinggitpick for a clean copy without git history:
2. Install Dependencies
Install all workspace dependencies:api/hono- Backend API serverweb/next- Frontend applicationpackages/auth- Shared authenticationpackages/db- Database and ORMpackages/env- Environment variablespackages/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:.env file:
Essential Variables
OAuth Providers (Optional)
Configure social authentication providers:GitHub OAuth
GitHub OAuth
- Go to GitHub Developer Settings
- Click “New OAuth App”
- Fill in the details:
- Application name:
ZeroStarter Local - Homepage URL:
http://localhost:3000 - Authorization callback URL:
http://localhost:3000/api/auth/callback/github
- Application name:
- Click “Register application”
- Generate a client secret
- Add to
.env:
Google OAuth
Google OAuth
- Go to Google Cloud Console
- Create a new project or select an existing one
- Navigate to “Credentials” > “Create Credentials” > “OAuth client ID”
- Configure the OAuth consent screen if prompted
- Select “Web application” as the application type
- Add authorized redirect URIs:
http://localhost:3000/api/auth/callback/google
- Click “Create”
- Add to
.env:
Analytics (Optional)
PostHog Analytics
PostHog Analytics
PostHog provides product analytics, feature flags, and session recordings.See the Analytics documentation for more details.
- Sign up at PostHog
- Create a new project
- Get your project API key
- Add to
.env:
4. Database Setup
Generate and apply database migrations:Generate Migrations
Generate Drizzle ORM migrations from your schema:This reads your schema from
packages/db/src/schema/ and creates migration files in packages/db/drizzle/.Run Migrations
Apply migrations to your database:This creates all necessary tables for:
- User accounts
- Sessions
- OAuth accounts
- Email verification
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:- Builds shared packages (
@packages/env,@packages/db,@packages/auth) - Starts the Hono API server at
http://localhost:4000 - Starts the Next.js frontend at
http://localhost:3000 - Enables hot module reloading for all packages
Verification
Verify your installation is working correctly:API Health Check
Test the API server: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
Build for Production
Build all packages and applications:api/hono/dist/- Bundled API serverweb/next/.next/- Next.js production buildpackages/*/dist/- Built shared packages
Package Scripts
ZeroStarter includes many useful scripts defined inpackage.json:20-35:
| Script | Description |
|---|---|
bun dev | Start development servers with TUI |
bun build | Build all packages and applications |
bun run db:generate | Generate Drizzle migrations |
bun run db:migrate | Run database migrations |
bun run db:studio | Open Drizzle Studio |
bun run lint | Lint all packages with Oxlint |
bun run format | Format code with Oxfmt |
bun run format:check | Check code formatting |
bun run check-types | Type-check all packages |
bun run clean | Remove build artifacts and node_modules |
bun start | Start production servers |
See the Scripts documentation for detailed information about all available commands.
Troubleshooting
Bun installation issues
Bun installation issues
If Bun fails to install:
Database connection errors
Database connection errors
Common database issues:Connection refused:
- Verify PostgreSQL is running:
pg_isready - Check the connection string format
- Ensure the database exists
- Verify username and password
- Check PostgreSQL user permissions
- For local databases, remove SSL requirements
- For managed databases, ensure SSL is enabled in the connection string
Port conflicts
Port conflicts
If ports 3000 or 4000 are in use:Find the process:Change the ports:
- Frontend: Modify
web/next/package.jsondev script to usenext dev -p 3001 - Backend: Add
HONO_PORT=4001to.env
Module resolution errors
Module resolution errors
If you see “Cannot find module” errors:
Turborepo cache issues
Turborepo cache issues
Clear Turborepo cache:
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.