Status: ✅ PRODUCTION READY WITH FIREBASE BACKEND
A cutting-edge Next.js 14 application showcasing AGI technology with a fully implemented Firebase backend for real-time lead management and admin analytics.
- Next.js 14 (App Router)
- TypeScript for type safety
- TailwindCSS for styling
- shadcn/ui for components
- React Hook Form + Zod for form validation
- Firebase Authentication for secure user management
- Cloud Firestore for real-time database operations
- Firebase Security Rules for data protection
- Notification System for email/SMS alerts
leads- Customer and investor lead dataadmins- Admin user managementsettings- Application configurationnotifications- Notification queue
- Public Access: Lead/investor form submissions
- Admin Access: Authenticated users with email verification
- Domain Restriction: Admin access restricted to verified domains
- Firebase Auth with email/password
- Admin verification via
adminscollection - Session management with Firebase tokens
- Role-based permissions system
- Node.js 18+
- Firebase project setup
- Admin Gmail account (for initial access)
- Clone and install dependencies
git clone <repository-url>
cd landing-page-template-2
npm install- Environment Configuration
cp .env.example .env.localUpdate .env.local with your Firebase config:
NEXT_PUBLIC_FIREBASE_API_KEY=your_firebase_api_key
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=sgagilab.firebaseapp.com
NEXT_PUBLIC_FIREBASE_PROJECT_ID=sgagilab
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=sgagilab.firebasestorage.app
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
NEXT_PUBLIC_FIREBASE_APP_ID=your_app_id- Firebase Setup
# Deploy Firestore security rules
firebase deploy --only firestore:rules
# Create initial admin user (run once)
# Use the createAdminUser function in lib/auth.ts- Run Development Server
npm run devOpen http://localhost:3000 to view the application.
- Create an admin user using the
createAdminUser()function - Access the management portal at
/management - Login with admin credentials
- Manage leads and view analytics
- Lead Management: View, filter, and update lead status
- Real-time Data: Live Firebase integration
- CSV Export: Download lead data for analysis
- Statistics Dashboard: Track leads, investors, and conversion metrics
interface Lead {
id?: string;
name: string;
email: string;
company: string;
role: string;
phone?: string;
interestedProducts: string[];
useCase: string;
timeline?: string;
budget?: string;
isInvestor: boolean;
submittedAt: Date;
status: 'new' | 'contacted' | 'qualified' | 'closed';
assignedTo?: string;
notes?: string;
lastContacted?: Date;
}interface AdminUser {
uid: string;
email: string;
role: 'admin';
permissions: string[];
}rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Public lead creation
match /leads/{leadId} {
allow create: if true;
allow read, update, delete: if request.auth != null
&& request.auth.token.email_verified == true
&& request.auth.token.email.matches('.*@gmail.com');
}
// Admin-only collections
match /admins/{userId} {
allow read, write: if request.auth != null
&& request.auth.token.email_verified == true;
}
}
}- Email Verification: Required for admin access
- Domain Restriction: Admin access limited to specific domains
- Session Management: Firebase Auth tokens with proper expiration
- Role-Based Access: Permission system for different admin roles
- Landing Page: Modern, responsive design
- Demo Request Form: Lead capture with validation
- Product Showcase: Interactive product demonstrations
- Contact Forms: Customer and investor inquiry forms
- Management Dashboard: Real-time lead analytics
- Lead Management: Status updates and notes
- Data Export: CSV download functionality
- User Authentication: Secure admin login system
- Real-time Updates: Live Firebase integration
- Form Validation: Comprehensive Zod schemas
- Error Handling: Graceful error management
- Responsive Design: Mobile-first approach
- Create Firebase project at Firebase Console
- Enable Authentication (Email/Password)
- Create Firestore database
- Configure security rules
- Set up web app configuration
# Firebase Configuration
NEXT_PUBLIC_FIREBASE_API_KEY=your_api_key
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
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
# Admin Configuration
ADMIN_EMAIL=admin@yourcompany.com
ADMIN_PASSWORD=your_secure_password
# Optional: Notification Services
EMAIL_SERVICE_PROVIDER=sendgrid
SENDGRID_API_KEY=your_sendgrid_api_key
TWILIO_ACCOUNT_SID=your_twilio_account_sid
TWILIO_AUTH_TOKEN=your_twilio_auth_token- Connect repository to Vercel
- Configure environment variables
- Deploy automatically on push to main branch
# Build for production
npm run build
# Start production server
npm start# Deploy Firestore rules
firebase deploy --only firestore:rules
# Deploy all Firebase resources
firebase deploy- User engagement tracking
- Conversion funnel analysis
- Performance monitoring
- Firebase Crashlytics integration
- Client-side error logging
- Performance metrics
- Authentication event logging
- Admin activity tracking
- Data access auditing
landing-page-template-2/
├── app/ # Next.js 14 App Router
│ ├── management/ # Admin dashboard
│ └── page.tsx # Landing page
├── components/ # React components
│ ├── ui/ # shadcn/ui components
│ ├── Header/ # Navigation components
│ └── ... # Feature components
├── lib/ # Core libraries
│ ├── firebase.ts # Firebase configuration
│ ├── auth.ts # Authentication logic
│ ├── database.ts # Database operations
│ └── notifications.ts # Notification system
└── public/ # Static assets
lib/firebase.ts- Firebase initializationlib/auth.ts- Authentication systemlib/database.ts- Database operationsfirestore.rules- Security rulesapp/management/dashboard/page.tsx- Admin dashboard
# Create sample data
import { testUtils } from '@/lib/database'
// Create sample leads
await testUtils.createSampleLeads()
// Clear all leads (testing only)
await testUtils.clearAllLeads()import { createAdminUser } from '@/lib/auth'
// Create initial admin
await createAdminUser('user-uid', 'admin@yourcompany.com', ['read', 'write', 'admin'])- Firebase Audit Report - Comprehensive backend audit
- Database Audit Report - Legacy database analysis
- Firebase Documentation - Official Firebase docs
- Next.js Documentation - Framework documentation
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
This project is proprietary and confidential to SG AGI Lab.
For technical support or questions:
- Documentation: Check this README and audit reports
- Firebase Console: Firebase Project Dashboard
- Issues: Create GitHub issue for bugs or feature requests
- Firebase project configured
- Environment variables set
- Admin users created
- Security rules deployed
- Forms tested end-to-end
- Authentication flow verified
- Monitor Firebase Analytics
- Set up error tracking
- Configure backup strategy
- Test admin functionality
- Verify notification systems
Status: ✅ PRODUCTION READY
Last Updated: November 14, 2025
Version: 1.0.0
Built with ❤️ by the SG AGI Lab team