Next.js + Hono Starter
A Turborepo monorepo where Hono runs as a real backend — not Next.js API routes. Typed end-to-end with OpenAPI, Prisma, and Supabase Auth wired from day one.
How it fits together
Two apps, two shared packages, one build graph. The API is a real Hono server — not a Next.js route handler.
Next.js App Router with auth-aware layouts, dashboard scaffold, and shadcn/ui components.
Hono server with versioned routes, Zod/OpenAPI schemas, service layer, and JWT middleware.
Prisma and migrations in database; shared contracts in types. The API imports both; the web app imports types and calls the API.
What the code looks like
Schema-first API routes. Typed user context. Protected server pages. This is what you clone into.
// apps/api/src/routes/v1/users.ts
const route = createRoute({
method: "get",
path: "/api/v1/users/me",
middleware: [authMiddleware],
responses: {
200: { content: { "application/json": { schema: UserSchema } } },
},
})
app.openapi(route, async (c) => {
const user = c.get("user") // typed — set by authMiddleware
const profile = await userService
.findById(user.id) // @repo/database Prisma client
return c.json(profile)
})// apps/web/app/(dashboard)/overview/page.tsx
import { getServerUser } from "@/lib/auth/server"
import { redirect } from "next/navigation"
export default async function OverviewPage() {
const user = await getServerUser()
if (!user) redirect("/auth/sign-in")
return <Dashboard user={user} />
}- Sign-up / sign-in / forgot password flows
- Token refresh + HTTP-only cookie sessions
- RBAC middleware (USER / ADMIN / DEMO roles)
- Prisma migrations workflow with seed scripts
- OpenAPI docs served at /api/v1/docs
- Husky + commitlint + pnpm workspace scripts
Architecture & features
Security, typed API contracts, and a monorepo workflow you can extend without fighting the template.
Build real SaaS faster
Opinionated where it matters (auth, API contracts, DB workflow), flexible where it counts (your product).
- MVP buildersYou want signup/login, protected pages, and a real database on day one—not mock auth.
- Teams shipping internal toolsYou need RBAC, a clean service layer, and a typed API surface you can extend safely.
- B2B SaaSYou value explicit contracts (OpenAPI) and predictable backend structure as features grow.
- Client work / templatesYou want a consistent foundation you can reuse, customize, and keep maintainable across projects.
- Update landing copy/branding and the nav anchors
- Add your first domain model in Prisma and run migrations
- Create your first feature module (web) + versioned route (api)
- Lock down protected endpoints and role rules
Community Reviews
Used this boilerplate? Share a quick note — it helps other developers decide.