Zero-configuration development environment for Firebase + Next.js projects with TypeScript, automated setup, and CI/CD pipeline.
Get up and running in under 5 minutes:
# 1. Use this template to create your new repository (click "Use this template" button above)
# 2. Clone your new repository
git clone <your-repository-url>
cd <your-repository-name>
# 3. Run automated setup
npm run setup
# 4. Start development environment
npm run dev:allThat's it! Your app is now running at http://localhost:3004
- β Centralized Firebase Configuration - Type-safe config service with environment-based settings
- β Automated Development Setup - One-command environment initialization
- β CI/CD Pipeline - GitHub Actions for testing and deployment
- β Firebase Emulator Integration - Local development with emulators
- β TypeScript Monorepo - Fully typed codebase with shared packages
- β Testing Infrastructure - Unit and E2E testing setup
- β Development Scripts - Automated workflows for common tasks
- Node.js 18 or later
- npm 8 or later
- Firebase Project (for production deployment)
This template uses a monorepo structure:
βββ apps/
β βββ web/ # Next.js frontend
β β βββ src/
β β β βββ config/ # ConfigService (centralized configuration)
β β β βββ app/ # Next.js App Router pages
β β β βββ components/ # React components
β β βββ package.json
β βββ functions/ # Firebase Functions
β βββ src/
β βββ package.json
βββ packages/
β βββ shared-types/ # Shared TypeScript types
βββ scripts/
β βββ setup.js # One-time setup automation
β βββ e2e-start.js # Start services for E2E tests
β βββ e2e-stop.js # Stop all services
β βββ e2e-health.js # Health check services
βββ .github/workflows/ # CI/CD pipelines
βββ firebase.json # Firebase configuration
βββ package.json # Monorepo configuration
Copy .env.local.example to .env.local (done automatically by npm run setup):
# Firebase Project Configuration
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your-project-id
NEXT_PUBLIC_FIREBASE_API_KEY=your-api-key
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your-project.appspot.com
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your-sender-id
NEXT_PUBLIC_FIREBASE_APP_ID=your-app-id
# Development (uses Firebase Emulators)
NEXT_PUBLIC_APP_ENV=development- Create Firebase Project at Firebase Console
- Get your project credentials from Project Settings
- Update
.env.localwith your credentials - Update
.firebasercwith your project ID:cp .firebaserc.example .firebaserc # Edit .firebaserc and replace 'your-project-id-here' with your actual project ID
| Command | Description |
|---|---|
| Setup & Development | |
npm run setup |
One-time setup: validate environment and create config files |
npm run dev:all |
Start everything: Firebase Emulators + Next.js (recommended) |
npm run dev |
Start Next.js development server only |
| Firebase | |
npm run firebase:emulators |
Start Firebase emulators only |
npm run firebase:deploy |
Deploy to Firebase |
| Testing & Quality | |
npm run test |
Run all tests |
npm run lint |
Lint all workspaces |
npm run typecheck |
Type check all workspaces |
| Building | |
npm run build |
Build web application |
npm run build:all |
Build all packages and applications |
| E2E Testing | |
npm run e2e:health |
Check if all services are running |
npm run e2e:start |
Start all services for E2E testing |
npm run e2e:stop |
Stop all E2E services |
| Service | URL |
|---|---|
| Web Application | http://localhost:3004 |
| Auth Emulator | http://localhost:9099 |
| Firestore Emulator | http://localhost:8080 |
| Functions Emulator | http://localhost:5001 |
| Storage Emulator | http://localhost:9199 |
| Hosting Emulator | http://localhost:5000 |
| Emulator Hub | http://localhost:4400 |
Every pull request triggers:
- β Type checking
- β Linting
- β Unit tests
- β Build validation
- β E2E tests (optional)
Pushes to main branch automatically:
- Run all tests
- Build application
- Deploy to Firebase (if tests pass)
For CI/CD to work, add these secrets to your GitHub repository:
| Secret | Description |
|---|---|
FIREBASE_SERVICE_ACCOUNT |
Firebase service account JSON |
To get service account:
- Go to Firebase Console β Project Settings β Service Accounts
- Click "Generate New Private Key"
- Copy entire JSON content to GitHub secret
- Frontend: Next.js 15, React 19, TypeScript, Tailwind CSS
- Backend: Firebase Functions, Node.js 18
- Database: Cloud Firestore
- Auth: Firebase Authentication
- Hosting: Firebase Hosting
- Development: Firebase Emulator Suite
- Testing: Jest, Playwright (optional)
- CI/CD: GitHub Actions
- Make changes in
apps/web/src/orapps/functions/src/ - Test locally with
npm run dev:all - Run tests with
npm test - Commit changes and push to GitHub
- CI pipeline runs automatically
- Merge to main triggers deployment
- Setup Guide - Detailed setup instructions
- Architecture Overview - System design and patterns
- Troubleshooting - Common issues and solutions
# Stop all services
npm run e2e:stop
# Check service health
npm run e2e:health
# Start again
npm run dev:all# Windows: Check what's using the ports
netstat -ano | findstr ":3004 :9099 :8080"
# Mac/Linux: Kill processes on specific ports
lsof -ti:3004 | xargs kill -9# Check .env.local exists
ls apps/web/.env.local
# If missing, run setup
npm run setup- Fork the repository
- Create a feature branch
- Make your changes
- Run tests (
npm test) - Commit and push
- Open a Pull Request
MIT License - see LICENSE file for details
This template is based on patterns developed during the SavvyProxy Firebase Infrastructure Modernization project (Epic 4).
Happy coding! π
For questions or issues, please open a GitHub issue.