Overview
PixelTech Colombia uses Firebase as its backend infrastructure, including Firestore, Authentication, Cloud Functions, Hosting, and Storage. This guide walks you through setting up a new Firebase project.Creating a Firebase Project
Create Project in Firebase Console
- Go to the Firebase Console
- Click Add project
- Enter your project name (e.g.,
pixeltech-colombia) - Configure Google Analytics (optional but recommended)
- Click Create project
Register Your Web App
- In the Firebase Console, click the Web icon (
</>) - Register your app with a nickname
- Enable Firebase Hosting for this app
- Copy the Firebase configuration object - you’ll need this for your frontend
Enabling Firebase Services
Firestore Database
Enable Firestore
- In Firebase Console, go to Firestore Database
- Click Create database
- Start in Production mode (we’ll deploy custom rules)
- Select the location: nam5 (US Central - matches your config)
Deploy Firestore Configuration
Your project includes pre-configured Firestore rules and indexes. Deploy them:The security rules define access control for:
- Users: Read/write own data, admins can access all
- Products: Public read, admin write, authenticated users can update stock
- Orders: Create validation, users can read own orders
- Categories & Brands: Public read, admin write
- Warranties: Users can create, read own warranties
- Chats: Admin only access
Authentication
Enable Authentication Providers
- Go to Authentication > Sign-in method
- Enable the following providers:
- Email/Password: For admin and customer accounts
- Google (optional): For social login
- Anonymous (optional): For guest checkout tracking
Cloud Storage
Enable Cloud Storage
- In Firebase Console, go to Storage
- Click Get started
- Use Production mode (we’ll deploy custom rules)
- Select the same location as Firestore
Deploy Storage Rules
Deploy the pre-configured storage security rules:Storage rules allow:
- Products, Banners, Categories, Brands: Public read, authenticated write
- Warranties: Authenticated users can read/write
- Invoices: Authenticated users only
- Chats: Public read (for WhatsApp), authenticated write
Cloud Functions
Upgrade to Blaze Plan
Cloud Functions require the Blaze (pay-as-you-go) plan:
- Go to Firebase Console > Upgrade
- Select the Blaze plan
- Set up billing alerts (recommended)
The Blaze plan includes a generous free tier. You only pay for usage beyond the free quota.
Configure Service Account
For production deployments, set up a service account:
- Go to Google Cloud Console
- Select your Firebase project
- Navigate to IAM & Admin > Service Accounts
- Create a service account with these roles:
- Firebase Admin
- Cloud Functions Developer
- Generate and download a JSON key
Firebase Hosting
Review Hosting Configuration
The This configuration:
firebase.json file includes hosting configuration:- Serves static files from the
public/directory - Routes
/sitemap.xmlto a Cloud Function - Routes
/google-feed.xmlto a Cloud Function for Google Merchant - Implements SPA routing (all routes serve
index.html)
Firebase Configuration File
Yourfirebase.json defines the complete Firebase configuration:
firebase.json
Firestore Indexes
The project includes afirestore.indexes.json file for composite indexes:
firestore.indexes.json
Security Best Practices
Admin User Setup
Admin User Setup
Create your first admin user:
- Create a user via Firebase Console > Authentication
- Manually add a document in Firestore at
/users/{userId}with:
API Key Security
API Key Security
- Your Firebase API key is safe to include in frontend code
- Security is enforced by Firestore and Storage rules, not the API key
- Use Firebase App Check for additional protection against abuse
Function Secrets
Function Secrets
- Never commit secrets to version control
- Use
firebase functions:secrets:setfor production secrets - Use
.envfiles only for local development - Rotate secrets regularly, especially payment gateway credentials
Monitoring and Analytics
Enable Cloud Monitoring
- Go to Google Cloud Console
- Enable Cloud Monitoring API
- Create alerts for:
- Function execution errors
- High latency
- Budget thresholds
Firebase Analytics
If you enabled Google Analytics during project creation:- View user engagement in Firebase Console > Analytics
- Track e-commerce events (product views, purchases, etc.)
- Monitor conversion funnels
Next Steps
Environment Setup
Set up your local development environment
Deployment
Deploy your application to production