Node.js 18+
npm or yarn
Firebase account
Gitgit clone https://github.com/AvishkarPatil/PhishGuard.git
cd PhishGuardnpm install
# or
yarn installCreate .env.local file in the root directory:
NEXT_PUBLIC_FIREBASE_API_KEY=your_api_key
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_auth_domain
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your_project_id
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=your_storage_bucket
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
NEXT_PUBLIC_FIREBASE_APP_ID=your_app_id
NEXT_PUBLIC_GEMINI_API_KEY=your_gemini_api_key# Install Firebase CLI
npm install -g firebase-tools
# Login to Firebase
firebase login
# Initialize Firebase (optional)
firebase init
# Deploy Firestore rules
firebase deploy --only firestore:rules# Start development server
npm run dev
# Go to http://localhost:3000/admin
# Click "Seed Firebase Database" buttonnpm run dev
# or
yarn devOpen http://localhost:3000 in your browser.
-
Connect Repository
- Go to Vercel Dashboard
- Click "New Project"
- Import your GitHub repository
-
Environment Variables
- Add all environment variables from
.env.local - Set
NODE_ENV=production
- Add all environment variables from
-
Deploy
- Vercel will automatically build and deploy
- Your app will be available at
https://your-app.vercel.app
# Install Vercel CLI
npm install -g vercel
# Login to Vercel
vercel login
# Deploy
vercel
# Production deployment
vercel --prod-
Build Settings
- Build command:
npm run build - Publish directory:
.next
- Build command:
-
Environment Variables
- Add all Firebase configuration variables
- Set
NODE_ENV=production
# Build the application
npm run build
# Deploy to Firebase Hosting
firebase deploy --only hosting# Development
npm run dev
# Production build
npm run build
# Start production server
npm start
# Lint code
npm run lint
# Type check
npm run type-check- Go to Firebase Console
- Create new project:
phishguard-your-name - Enable Authentication (Email/Password)
- Create Firestore database
- Get configuration keys
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Users can read/write their own profile
match /users/{userId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
// Scenarios are readable by authenticated users
match /scenarios/{scenarioId} {
allow read: if request.auth != null;
allow write: if request.auth != null &&
get(/databases/$(database)/documents/users/$(request.auth.uid)).data.role == 'admin';
}
// Leaderboard is readable by all authenticated users
match /leaderboard/{userId} {
allow read: if request.auth != null;
allow write: if request.auth != null && request.auth.uid == userId;
}
}
}firebase deploy --only firestore:rules- Deploy the application
- Go to
/adminpage - Click "Seed Firebase Database"
- Wait for completion message
# Run seeding script
npm run seed
# Or use Node.js directly
node -e "require('./lib/seed-data').seedDatabase()"| Variable | Description | Required |
|---|---|---|
NEXT_PUBLIC_FIREBASE_API_KEY |
Firebase API Key | β |
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN |
Firebase Auth Domain | β |
NEXT_PUBLIC_FIREBASE_PROJECT_ID |
Firebase Project ID | β |
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET |
Firebase Storage Bucket | β |
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID |
Firebase Messaging Sender ID | β |
NEXT_PUBLIC_FIREBASE_APP_ID |
Firebase App ID | β |
NEXT_PUBLIC_GEMINI_API_KEY |
Google Gemini AI API Key | |
NODE_ENV |
Environment (development/production) | β |
-
Firebase Connection Error
# Check Firebase configuration # Ensure all environment variables are set # Verify Firebase project settings
-
Build Failures
# Clear Next.js cache rm -rf .next npm run build -
Authentication Issues
# Check Firebase Auth settings # Ensure Email/Password provider is enabled # Verify security rules
-
Database Access Denied
# Update Firestore security rules # Check user authentication status # Verify user permissions
-
Enable Compression
// next.config.js module.exports = { compress: true, images: { domains: ['your-domain.com'], }, }
-
Bundle Analysis
npm install --save-dev @next/bundle-analyzer npm run analyze
- Enable in Vercel dashboard
- Monitor performance metrics
- Track user interactions
- Enable Google Analytics in Firebase
- Track user engagement
- Monitor app performance
name: Deploy to Vercel
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '18'
- run: npm install
- run: npm run build
- uses: amondnet/vercel-action@v20
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.ORG_ID }}
vercel-project-id: ${{ secrets.PROJECT_ID }}If you encounter any deployment issues:
- π§ Email: [email protected]
- π GitHub Issues: Create Issue
- π± LinkedIn: Avishkar Patil
π Happy Deploying!