Project Structure
Understand the monorepo structure and organization of ZeroStarter.
Overview
ZeroStarter uses a monorepo architecture to organize code into logical packages. This structure enables code sharing, type safety, and efficient development workflows.
Project Structure
This project is a monorepo organized as follows:
.
├── api/
│ └── hono/ # Backend API server (Hono)
├── web/
│ └── next/ # Frontend application (Next.js)
│ └── content/ # Documentation and blog content (MDX)
└── packages/
├── auth/ # Shared authentication logic (Better Auth)
├── db/ # Database schema and Drizzle configuration
├── env/ # Type-safe environment variables
└── tsconfig/ # Shared TypeScript configurationDirectory Details
api/hono/
The backend API server built with Hono.
src/index.ts: Main application entry point, exportsAppTypefor type-safe RPCsrc/routers/: API route handlersauth.ts: Authentication routes (Better Auth handler)v1.ts: Protected API routes requiring authentication
src/middlewares/: Custom middlewaresauth.ts: Authentication middleware for protected routesmetadata.ts: Request metadata injection
web/next/
The frontend application built with Next.js 16.
src/app/: Next.js App Router pages and layouts(content)/: Documentation and blog pages(protected)/: Authenticated user pages (dashboard)(llms.txt)/: Auto-generated AI documentation endpoints
src/components/: React componentsui/: Shadcn UI componentssidebar/: Navigation sidebar components
src/lib/: Shared utilitiesapi/client.ts: Type-safe API client using Hono RPCauth/: Authentication client and utilitiesconfig.ts: Application configuration
content/: MDX contentdocs/: Documentation pagesblog/: Blog posts
packages/auth/
Shared authentication logic using Better Auth.
src/index.ts: Auth configuration with database adapter and social providers- Supports GitHub and Google OAuth
- Exports session types for type safety
packages/db/
Database schema and configuration using Drizzle ORM.
src/schema/: Database table definitionsauth.ts: User, session, account, and verification tables
drizzle/: Generated migrationsdrizzle.config.ts: Drizzle Kit configuration
packages/env/
Type-safe environment variables using @t3-oss/env-core.
src/api-hono.ts: API server environment variablessrc/auth.ts: Authentication environment variablessrc/db.ts: Database environment variablessrc/web-next.ts: Frontend environment variables (client and server)
packages/tsconfig/
Shared TypeScript configuration files for consistent settings across packages.
Key Files
| File | Purpose |
|---|---|
package.json | Root package with workspace configuration and scripts |
turbo.json | Turborepo build configuration and global environment variables |
lefthook.yml | Git hooks configuration for linting and formatting |
.env | Environment variables (create from .env.example) |