A modern, type-safe fullstack starter for Next.js 15 with a hard client/server boundary. No server actions, no RSC data fetching — all data flows through a typed Hono API layer with TanStack Query.
This starter enforces a clean separation between client and server:
Client (React) → TanStack Query → Typed Hono RPC Client → Hono Router → Service → Prisma → PostgreSQL
- Next.js 15 (App Router): Latest features with React 19 support
- Hard Client/Server Boundary: No server actions, no RSC data fetching
- Hono API: High-performance API routes with full type safety
- TanStack Query: Client-side data fetching with caching and invalidation
- End-to-End Type Safety: Hono RPC types flow from router →
hc()client → query hooks - Better Auth: Secure, flexible authentication
- Prisma ORM: Type-safe database access with PostgreSQL
- Modular Backend: Feature-based modules with schema → service → router pattern
- Tailwind CSS v4: Latest utility-first styling
- shadcn/ui: Beautifully designed components
| Technology | Purpose |
|---|---|
| Next.js 15 | Framework |
| React 19 | UI Library |
| Hono | API Framework |
| TanStack Query | Data Fetching & Caching |
| Better Auth | Authentication |
| Prisma | ORM |
| Tailwind CSS v4 | Styling |
| shadcn/ui | Component Library |
| Zod | Schema Validation |
git clone https://github.com/manethpak/next-hono-starter.git
cd next-hono-starter
pnpm installCreate a new app directly from this repository with create-next-app:
pnpm dlx create-next-app@latest my-app --example https://github.com/manethpak/next-hono-starterThen set up the environment and database:
cp .example.env .env
pnpm prisma generate
pnpm prisma db pushcp .example.env .envUpdate your DATABASE_URL and generate a BETTER_AUTH_SECRET:
openssl rand -base64 32pnpm prisma generate
pnpm prisma migrate devpnpm devYour app will be available at http://localhost:3000.
src/
├── app/ # Next.js App Router
│ ├── api/[[...route]]/ # Hono catch-all route handler
│ ├── (protected)/ # Auth-gated route group
│ └── auth/ # Auth pages (sign-in, sign-up)
├── components/
│ ├── providers.tsx # QueryClientProvider + ThemeProvider + Toaster
│ ├── module/ # Feature-specific UI components
│ └── ui/ # shadcn/ui primitives
├── features/ # Frontend feature slices
│ └── [feature]/
│ ├── components/ # React components
│ ├── hooks/ # Custom React hooks
│ └── queries.ts # TanStack Query hooks
├── hooks/ # Shared React hooks
├── lib/
│ ├── api-client.ts # Typed Hono RPC client (hc<AppHono>)
│ ├── auth.ts # Better Auth server config
│ ├── auth-client.ts # Better Auth React client
│ ├── prisma.ts # Prisma singleton
│ └── query-client.ts # QueryClient singleton
└── server/
├── factory.ts # Hono typed context factory
├── router.ts # Exports AppHono type
├── middleware/ # Hono middlewares
└── modules/ # Feature-based backend modules
├── _index.ts # Auto-mounts all module routers
└── [feature]/
├── [feature].router.ts # Hono router
├── [feature].service.ts # Business logic
└── [feature].schema.ts # Zod schemas
- Database: Add model(s) to
prisma/schema.prisma - Generate: Run
npx prisma generate(andnpx prisma db pushfor new tables) - Backend: Create
src/server/modules/[feature]/with.schema.ts,.service.ts,.router.ts - Register: Add router to
src/server/modules/_index.ts - Frontend: Create
src/features/[feature]/queries.tswith TanStack Query hooks - UI: Create components in
src/features/[feature]/components/ - Pages: Add route in
src/app/that uses the feature components
| Script | Description |
|---|---|
pnpm dev |
Starts the development server |
pnpm build |
Builds the application for production |
pnpm start |
Starts the production server |
pnpm lint |
Runs oxlint on src/ |
pnpm lint:fix |
Runs oxlint with fixes on src/ |
pnpm fmt |
Formats files in src/ |
pnpm fmt:check |
Checks formatting for files in src/ |
pnpm auth:gen |
Generates Better Auth client/server code |
This project is licensed under the MIT License.
Made with ❤️ by Maneth Pak