-
Notifications
You must be signed in to change notification settings - Fork 0
Deployment Guide
Step-by-step guide to deploying SideQuest to production.
SideQuest can be deployed to various hosting platforms:
- Firebase Hosting (Recommended)
- Netlify
- Vercel
- GitHub Pages
- Any static file hosting
Firebase Hosting is the recommended deployment method as it integrates seamlessly with Firebase services.
- Firebase project set up
- Firebase CLI installed
- Project tested locally
npm install -g firebase-toolsfirebase logincd /path/to/SideQuest
firebase init hostingAnswer the prompts:
-
What do you want to use as your public directory?
.(current directory) -
Configure as a single-page app?
Yes -
Set up automatic builds and deploys with GitHub?
No(orYesif you want CI/CD)
Ensure your firebase.json has proper configuration:
{
"hosting": {
"public": ".",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**",
"wiki/**",
"README.md",
"FUNCTION_SPEC.md"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
],
"headers": [
{
"source": "**/*.@(jpg|jpeg|gif|png|svg|webp)",
"headers": [
{
"key": "Cache-Control",
"value": "max-age=31536000"
}
]
},
{
"source": "**/*.@(js|css)",
"headers": [
{
"key": "Cache-Control",
"value": "max-age=31536000"
}
]
}
]
},
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
}
}Create a production version of js/firebase-config.js:
// js/firebase-config.js
import { initializeApp } from "https://www.gstatic.com/firebasejs/10.7.1/firebase-app.js";
import { getAuth } from "https://www.gstatic.com/firebasejs/10.7.1/firebase-auth.js";
import { getFirestore } from "https://www.gstatic.com/firebasejs/10.7.1/firebase-firestore.js";
const firebaseConfig = {
apiKey: "YOUR_PRODUCTION_API_KEY",
authDomain: "your-project.firebaseapp.com",
projectId: "your-project-id",
storageBucket: "your-project.appspot.com",
messagingSenderId: "123456789",
appId: "1:123456789:web:abcdef123456"
};
const app = initializeApp(firebaseConfig);
export const auth = getAuth(app);
export const db = getFirestore(app);IMPORTANT: Update Firestore security rules before deploying!
See Security Guide for production-ready security rules.
# Deploy security rules
firebase deploy --only firestore:rules# Deploy everything
firebase deploy
# Or deploy only hosting
firebase deploy --only hosting# Open deployed site
firebase open hosting:siteYour site will be available at:
https://your-project-id.web.apphttps://your-project-id.firebaseapp.com
- Go to Firebase Console → Hosting
- Click "Add custom domain"
- Enter your domain name
- Follow DNS setup instructions
- Wait for SSL certificate provisioning (can take up to 24 hours)
# Create .gitignore if not exists
echo "js/firebase-config.js" >> .gitignore
echo "node_modules/" >> .gitignoregit add .
git commit -m "Prepare for Netlify deployment"
git push origin main- Go to Netlify
- Click "New site from Git"
- Connect your GitHub repository
- Configure build settings:
- Build command: Leave empty (no build needed)
-
Publish directory:
.(root)
- Click "Deploy site"
Since you can't commit firebase-config.js, you have two options:
Option A: Use environment variables with a build step
Create a firebase-config.template.js:
const firebaseConfig = {
apiKey: "{{FIREBASE_API_KEY}}",
authDomain: "{{FIREBASE_AUTH_DOMAIN}}",
// ...
};Option B: Commit the config (less secure)
For a simple deployment, you can commit the Firebase config file, but be aware that Firebase API keys are public anyway (security is handled by Firestore rules).
Create netlify.toml:
[[redirects]]
from = "/*"
to = "/index.html"
status = 200npm install -g vercelcd /path/to/SideQuest
vercelFollow the prompts:
- Set up and deploy?
Yes - Which scope? Choose your account
- Link to existing project?
No - Project name?
sidequest(or your preference) - Directory?
./
Create vercel.json:
{
"rewrites": [
{
"source": "/(.*)",
"destination": "/index.html"
}
],
"headers": [
{
"source": "/js/(.*)",
"headers": [
{
"key": "Cache-Control",
"value": "public, max-age=31536000, immutable"
}
]
}
]
}vercel --prodgit checkout -b gh-pagesFor GitHub Pages, you need to commit the Firebase config:
git add js/firebase-config.js
git commit -m "Add Firebase config for GitHub Pages"git push origin gh-pages- Go to your repository on GitHub
- Settings → Pages
- Source: Deploy from branch
- Branch:
gh-pages, folder:/ (root) - Save
Your site will be available at:
https://username.github.io/SideQuest
If deployed to a subdirectory, update all absolute paths in index.html:
<!-- Change this: -->
<script src="/js/app.js"></script>
<!-- To this: -->
<script src="./js/app.js"></script>Before deploying to production, ensure you've completed these security steps:
- Updated Firestore security rules (see Security Guide)
- Enabled Firebase App Check
- Restricted API keys to your domain
- Enabled email verification
- Configured password requirements
- Reviewed and tested security rules
- All user inputs validated
- No secrets in client-side code
- XSS prevention implemented
- HTTPS enforced
- Rate limiting in place
- Error messages don't leak sensitive info
- Tested on multiple browsers
- Tested on mobile devices
- Tested all core features
- Verified real-time updates work
- Checked map loading
- Verified authentication flow
Create .github/workflows/firebase-hosting.yml:
name: Deploy to Firebase Hosting
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Deploy to Firebase
uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}'
channelId: live
projectId: your-project-id- Go to repository Settings → Secrets
- Add
FIREBASE_SERVICE_ACCOUNT:- Go to Firebase Console → Project Settings → Service Accounts
- Generate new private key
- Copy JSON content
- Paste as secret value
Set up monitoring for your deployed app:
-
Firebase Performance Monitoring
import { getPerformance } from "firebase/performance"; const perf = getPerformance(app);
-
Google Analytics (Optional)
import { getAnalytics } from "firebase/analytics"; const analytics = getAnalytics(app);
-
Error Tracking
- Set up Sentry or similar service
- Monitor browser console errors
- Set up alerts for critical errors
After deployment:
- Test sign up / sign in
- Create a test task
- Claim a test task
- Verify map loads correctly
- Check mobile responsiveness
- Test on multiple browsers
- Verify SSL certificate
- Enable Firebase Hosting caching
- Optimize images
- Minimize JavaScript (if using build tools)
- Enable compression
- Consider CDN for assets
If something goes wrong:
# List previous deployments
firebase hosting:channel:list
# View deployment history
firebase hosting:channel:open
# Rollback to previous version
firebase hosting:rollback# Revert to previous commit
git revert HEAD
git push origin main
# Or hard reset (destructive)
git reset --hard HEAD~1
git push -f origin mainAs your app grows:
-
Firestore Limits
- 1 million free reads/day
- 20k free writes/day
- Monitor usage in Firebase Console
-
Hosting Bandwidth
- 10 GB free per month
- Optimize asset sizes
-
Consider Upgrade
- Switch to Blaze (pay-as-you-go) plan
- Set budget alerts
-
Optimize Queries
- Add pagination for tasks
- Implement geoqueries for nearby tasks only
- Cache frequently accessed data
- Go to Firebase Console → Hosting
- Add custom domain
- Verify ownership with TXT record
- Add A records:
-
@→ IP provided by Firebase -
www→ IP provided by Firebase
-
- Wait for SSL provisioning (up to 24 hours)
- Go to Site settings → Domain management
- Add custom domain
- Update DNS records at your registrar
- Wait for DNS propagation
- Go to project Settings → Domains
- Add your domain
- Configure DNS at your registrar
- Vercel handles SSL automatically
- Firebase Hosting Documentation
- Netlify Documentation
- Vercel Documentation
- GitHub Pages Documentation