A modern Next.js + Firebase starter — Next.js 16 (App Router) on the frontend, Firebase Auth + Firestore + App Hosting on the backend, with Stripe, shadcn/ui, Tailwind v4, and Vitest wired up. Built around the integrated Firebase route — auth, database, hosting, and storage all live under one project. The trade-off is vendor lock-in (see stack.md). For a modular alternative (Vite + Hono + Neon + Clerk + Drizzle), see the sibling app-starter.
# GitHub CLI (for cloning private repos)
brew install gh
gh auth login
# pnpm (package manager)
brew install pnpm
# Firebase CLI (for project setup + deployment)
npm install -g firebase-tools
firebase loginThen create your Firebase project before scaffolding:
- Create a project at console.firebase.google.com
- Enable Authentication and Firestore in the console
- Note your project ID — you'll paste it into
.firebasercafter scaffolding
Skip this if you only want to explore the scaffold locally —
pnpm devworks without Firebase wired up. You'll just hit errors on any auth/Firestore-touching route.
This project uses codefu for AI-assisted development skills and commands. Clone it as a sibling before scaffolding — scripts/setup.sh looks for ../codefu and silently links the wrong skills if it's missing:
gh repo clone webventurer/codefu
add-codefu.sh # if not there alreadygh repo clone webventurer/firebase-nextjs-starter
./firebase-nextjs-starter/scripts/create.sh my-appThis creates a new my-app/ directory alongside the starter and:
- Scaffolds a Next.js + TypeScript + Tailwind project (
create-next-app) - Installs the full dep list (Firebase, Stripe, shadcn, Vitest, Biome, AWS SDK for R2)
- Initialises shadcn/ui (new-york style, neutral base, lucide icons) with 11 components
- Copies Firebase config (
firebase.json,firestore.rules,apphosting.yaml) into the project root - Copies the lib helpers (
firebase.ts,firebase-admin.ts,firebase-storage.ts,r2.ts,stripe.ts,demo-config.ts,admin.ts, API auth/admin-auth/responses helpers) intosrc/lib/ - Wires up the auth layer —
AuthProvider+useAuth()hook +<AuthGuard>+ route groups(public)and(auth)with login/signup/dashboard pages, plusverifyAdminAuth()for admin-only routes - Sets up three Stripe routes — webhook, checkout, billing portal
- Sets up Biome for linting + formatting (replaces ESLint)
- Initialises a git repo with the first commit
| File | What it is | When to read it |
|---|---|---|
scripts/create.sh |
Automated setup script — scaffolds Next.js, installs deps, configures Firebase + shadcn/ui + Biome | You don't — just run it |
package.json |
Declarative dependency list for the full stack — the script copies this into your new project | When you want to see exactly what gets installed |
stack.md |
The why — explains why we chose Firebase-integrated over modular, what we considered, and what we rejected | Before starting a project, to understand the decisions |
tech-spec.md |
The how — project structure, Firebase project setup, env vars, deployment via App Hosting | During development, as a reference guide |
templates/ |
Source-of-truth files copied into every new project (Firebase config, lib helpers, configs) | When you want to change the default scaffold |
- Update
.firebasercwith the project ID you noted in Prerequisites - Copy
.env.exampleto.env.localand fill in the values - Update
apphosting.yamlwith your public Firebase config - Run
pnpm dev— the app should boot onhttp://localhost:3000
See tech-spec.md for the full setup walkthrough and deployment steps.
These are not in package.json — add them only when needed:
# State management — when useState outgrows local state
pnpm add zustand
# Server state — only if you need cross-component caching beyond Next's fetch cache
pnpm add @tanstack/react-query
# Charts
pnpm add recharts
# Email (transactional)
pnpm add loops
# Analytics
pnpm add posthog-js- stack.md — the rationale behind every technology choice
- tech-spec.md — the actionable setup guide
- integrated-vs-modular.md — the long-form comparison: when each stack wins, what each pays for it
- app-starter — the modular alternative (Vite + Hono + Neon + Clerk + Drizzle)