A modern, production-ready template for building full-stack applications with Next.js 15, Firebase, and TypeScript. This template provides a solid foundation with authentication, user management, and a beautiful UI built with Radix UI and Tailwind CSS.
- Complete Auth Flow: Login, registration, password reset, and account setup
- Firebase Authentication: Secure user authentication with Firebase Auth
- Protected Routes: Automatic route protection and redirects
- User Profile Management: User details form with validation
- Dark/Light Mode: Built-in theme switching with
next-themes - Responsive Design: Mobile-first approach with Tailwind CSS
- Component Library: Pre-built UI components using shadcn/ui
- Form Handling: Advanced forms with React Hook Form and Zod validation
- Toast Notifications: User feedback with React Hot Toast
- TypeScript: Full type safety throughout the application
- ESLint: Code quality and consistency
- Turbopack: Fast development builds
- React Query: Powerful data fetching and caching
- Server Actions: Modern server-side data mutations
- Firestore: NoSQL database with security rules
- Firebase Storage: File upload and management
- Firebase Admin: Server-side Firebase operations
- Security Rules: Pre-configured Firestore and Storage rules
- Node.js 18+
- Firebase project
- Git
git clone https://github.com/your-username/next-firebase-template.git
cd next-firebase-templatenpm installCreate a .env.local file in the root directory:
# Firebase Client Configuration
NEXT_PUBLIC_FIREBASE_API_KEY=your_api_key_here
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_project_id.firebaseapp.com
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your_project_id.appspot.com
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
NEXT_PUBLIC_FIREBASE_APP_ID=your_app_id
# Firebase Admin (Server-side)
FIREBASE_ADMIN_KEY_BASE64=your_base64_encoded_service_account_key- Create a new Firebase project at Firebase Console
- Enable Authentication and Firestore Database
- Generate a service account key and encode it in base64
- Deploy Firebase rules:
npm run firebase:deploynpm run devOpen http://localhost:3000 to see your application.
src/
├── app/ # Next.js App Router
│ ├── auth/ # Authentication pages
│ ├── app/ # Protected app pages
│ └── setup-account/ # Account setup flow
├── components/ # Reusable components
│ ├── form/ # Form components
│ └── ui/ # UI component library
├── hooks/ # Custom React hooks
├── lib/ # Utility libraries
│ ├── firebase/ # Firebase configuration
│ └── server-actions/ # Server actions
└── types/ # TypeScript type definitions
npm run dev- Start development server with Turbopacknpm run build- Build for productionnpm run start- Start production servernpm run lint- Run ESLintnpm run firebase:deploy- Deploy Firebase rules
The template includes pre-configured security rules for Firestore and Storage:
- Firestore: Basic read/write rules for authenticated users
- Storage: File upload rules with size and type restrictions
The app supports system, light, and dark themes. Theme preference is persisted in localStorage.
- Framework: Next.js 15 with App Router
- Language: TypeScript
- Styling: Tailwind CSS v4
- UI Components: Radix UI
- Forms: React Hook Form + Zod
- State Management: React Query
- Authentication: Firebase Auth
- Database: Firestore
- Deployment: Vercel-ready
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.