A modern, full-stack Next.js application template built with Firebase, shadcn/ui, TypeScript, and AI capabilities. This project provides a solid foundation for building scalable web applications with authentication, admin panels, and plugin architecture.
⚠️ The project is under very active development.⚠️ Expect bugs and breaking changes.
- Next.js 16 with App Router and Turbopack support
- Firebase Integration
- Authentication (Email/Password, Email Link, Google Sign-In)
- Firestore Database
- Cloud Storage
- Firebase Emulators for local development
- AI Capabilities
- Google Genkit integration
- Google Imagen for image generation
- Gemini chatbot support
- Modern UI
- shadcn/ui components
- Tailwind CSS 4
- Dark/Light theme support
- Responsive design
- Plugin System - Extensible architecture for adding custom features
- Admin Panel - User management and image administration
- Type Safety - Full TypeScript support
- Testing - Jest and Playwright test setup
- Code Quality - ESLint, Husky pre-commit hooks
Before you begin, ensure you have the following installed:
- Node.js 18+ and pnpm (package manager)
- Firebase CLI -
npm install -g firebase-tools - Google Cloud SDK (for Genkit/AI features)
- A Firebase project with the following services enabled:
- Authentication
- Firestore Database
- Cloud Storage
-
Clone the repository
git clone https://github.com/vinkashq/nextfire.git cd nextfire -
Install dependencies
pnpm install
-
Set up environment variables
Create a
.env.localfile in the root directory with the following variables:# Firebase Web App Configuration (JSON string) FIREBASE_WEBAPP_CONFIG={"apiKey":"your_api_key","authDomain":"your_project.firebaseapp.com","projectId":"your_project_id","storageBucket":"your_project.appspot.com","messagingSenderId":"your_sender_id","appId":"your_app_id","measurementId":"your_measurement_id"} # Application Configuration NEXT_PUBLIC_APP_NAME=NextFire NEXT_PUBLIC_APP_TITLE=Next.js + Firebase + Shadcn UI Template NEXT_PUBLIC_HOSTNAME=your-domain.com # Legal Information (Optional) NEXT_PUBLIC_LEGAL_BUSINESS_NAME=Your Company Name NEXT_PUBLIC_LEGAL_BUSINESS_ADDRESS=Your Address NEXT_PUBLIC_LEGAL_BUSINESS_COUNTRY=Your Country NEXT_PUBLIC_LEGAL_CONTACT_EMAIL=your-email@example.com # reCAPTCHA (Optional - Required for Firebase App Check) NEXT_PUBLIC_RE_CAPTCHA_SITE_KEY=your_recaptcha_site_key # Theme Colors (Optional) NEXT_THEME_PRIMARY_COLOR=#171717 NEXT_THEME_PRIMARY_FOREGROUND_COLOR=#fafafa
Note: For Firebase App Hosting, configure
NEXT_PUBLIC_RE_CAPTCHA_SITE_KEYas a secret inapphosting.yaml(see Configuration section). -
Set up Firebase Admin SDK
For server-side operations, you'll need to set up Firebase Admin credentials. Place your service account key file in the project root or configure it via environment variables.
-
Install Playwright browsers (for E2E testing)
pnpm run playwright:install
Start the development server with Turbopack:
pnpm run devFor plugin development:
pnpm run pluginThe application will be available at http://localhost:3000.
Run Firebase emulators for local development:
pnpm run serveThis starts the Firebase emulators including:
- App Hosting Emulator (port 5002)
- Firebase UI
pnpm run build
pnpm startnextfire/
├── src/
│ ├── app/ # Next.js App Router pages
│ │ ├── (plugins)/ # Plugin routes
│ │ ├── (website)/ # Public website routes
│ │ ├── admin/ # Admin panel
│ │ ├── api/ # API routes
│ │ ├── app/ # Application routes
│ │ └── auth/ # Authentication pages
│ ├── components/ # React components
│ │ ├── ui/ # shadcn/ui components
│ │ └── ... # Custom components
│ ├── config/ # Configuration files
│ ├── context/ # React contexts
│ ├── firebase/ # Firebase client/server setup
│ ├── genkit/ # Genkit AI flows
│ ├── hooks/ # Custom React hooks
│ ├── lib/ # Utility functions
│ └── types/ # TypeScript type definitions
├── plugins/ # Plugin directory
├── public/ # Static assets
├── tests/ # Test files
│ ├── jest/ # Unit tests
│ └── playwright/ # E2E tests
└── ... # Configuration files
NextFire includes a plugin architecture that allows you to extend functionality. To create a plugin:
- Create a directory in the
plugins/folder - Add your routes in
plugins/your-plugin/routes/ - Uncomment and configure the plugin route in
next.config.ts:withPluginRoutes('your-plugin-directory-name');
The application supports multiple authentication methods:
- Email/Password - Traditional email and password authentication
- Email Link - Passwordless authentication via email link
- Google Sign-In - OAuth authentication with Google
- Automatically uses popup method when deployed on a custom domain
- Uses redirect method when the auth domain matches the hostname (for better compatibility)
- Forgot Password - Password reset functionality
Firebase Auth Rewrites: The application includes automatic rewrites for Firebase Auth handler paths (/__/auth/*) to support custom domains. This is configured in next.config.ts and requires the FIREBASE_WEBAPP_CONFIG environment variable.
Authentication pages are located in src/app/auth/.
Access the admin panel at /admin (requires admin privileges). Features include:
- User Management - View and edit user accounts
- Image Administration - Manage generated images
- Dynamic rendering for real-time image updates
- Image generation with Google Imagen
- Image metadata tracking (dimensions, aspect ratio, file size)
- Data Tables - Built with TanStack Table
This project uses shadcn/ui components built on Radix UI and Tailwind CSS. All components are customizable and located in src/components/ui/.
Key components include:
- Buttons, Cards, Dialogs
- Data Tables
- Forms with React Hook Form
- Sidebar navigation
- Theme toggle
The application includes Google Imagen integration for AI-powered image generation:
- Flow-based architecture using Genkit
- Automatic image storage in Firebase Storage
- Metadata tracking in Firestore
Gemini chatbot integration for conversational AI features.
pnpm test
pnpm test:watchTests are located in tests/jest/.
pnpm playwrightTests are located in tests/playwright/.
pnpm dev- Start development server with Turbopackpnpm plugin- Start development server for plugin developmentpnpm build- Build for productionpnpm start- Start production serverpnpm lint- Run ESLintpnpm test- Run Jest testspnpm test:watch- Run Jest tests in watch modepnpm playwright- Run Playwright E2E testspnpm playwright:install- Install Playwright browserspnpm serve- Start Firebase emulatorspnpm login- Login to Google Cloud for Genkitpnpm valet- (Optional) Use Valet for local development with a secure URL
Edit next.config.ts to customize:
- Plugin routes
- Headers and caching
- Redirects
- Firebase Auth rewrites - Automatically configured for custom domains when
FIREBASE_WEBAPP_CONFIGis set - Webpack configuration
The Firebase Auth rewrites allow Firebase Authentication to work properly on custom domains by forwarding requests from __/auth/* paths to the Firebase project's default domain.
Firebase settings are configured in:
firebase.json- Firebase project configurationapphosting.yaml- App Hosting configuration (includes reCAPTCHA site key secret)apphosting.emulator.yaml- Emulator configuration
Firebase Options Handling: The application uses FIREBASE_WEBAPP_CONFIG as a JSON string for Firebase configuration. This allows for server-side and client-side use of the same configuration.
The storage bucket is automatically initialized from the Firebase options, eliminating the need for hardcoded bucket names.
Customize themes in src/config/index.ts or via environment variables.
This project is configured for Firebase App Hosting. To deploy:
-
Ensure you're logged in to Firebase:
firebase login
-
Configure your Firebase project:
firebase use your-project-id
-
Set up secrets (if using reCAPTCHA): Configure secrets in Firebase Secret Manager and reference them in
apphosting.yaml:env: - variable: NEXT_PUBLIC_RE_CAPTCHA_SITE_KEY secret: RE_CAPTCHA_SITE_KEY availability: - BUILD - RUNTIME
-
Deploy:
firebase deploy --only apphosting
Custom Domain Support: When deploying to a custom domain, Firebase Auth rewrites are automatically configured to ensure authentication flows work correctly. The Google Sign-In will use popup mode on custom domains for better UX.
The application can be deployed to any platform that supports Next.js:
- Vercel
- Netlify
- AWS Amplify
- Docker containers
- Framework: Next.js 16.0.1 (with dynamic rendering support)
- Language: TypeScript 5.9.3
- Styling: Tailwind CSS 4.1.16
- UI Components: shadcn/ui (Radix UI)
- Backend: Firebase (Auth, Firestore, Storage)
- Firebase Auth with automatic popup/redirect handling
- Firebase Auth rewrites for custom domains
- AI: Google Genkit, Imagen, Gemini
- State Management: Nanostores
- Forms: React Hook Form + Zod
- Testing: Jest, Playwright
- Package Manager: pnpm
- Firebase Configuration: Support for
FIREBASE_WEBAPP_CONFIGenvironment variable for server-side configuration - Google Sign-In: Automatic popup/redirect selection based on auth domain
- Firebase Auth Rewrites: Automatic configuration for custom domain deployments
- Dynamic Rendering: Images page now uses dynamic rendering for real-time updates
- Storage Initialization: Automatic storage bucket initialization from Firebase options
- reCAPTCHA Integration: Enhanced configuration support in App Hosting
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Vinkas
- Next.js - The React Framework
- Firebase - Backend as a Service
- shadcn/ui - Beautiful UI components
- Google Genkit - AI development framework
For support, please open an issue in the GitHub repository.
Made with ❤️ by Vinkas