Overview
This guide covers deploying the PixelTech Colombia e-commerce platform to production using Firebase Hosting, Cloud Functions, and related services.Pre-Deployment Checklist
Before deploying, ensure:Firebase project is created and configured
All environment variables are set in Firebase Functions secrets
You’re logged into Firebase CLI (
firebase login)Correct Firebase project is selected (
firebase use production)All tests pass locally
Code is committed to version control
Build Process
Tailwind CSS Compilation
Build Tailwind CSS for Production
Compile Tailwind CSS with optimizations for production:This command:
- Reads the input CSS from
src/input.css - Processes it through Tailwind CSS
- Minifies the output for production
- Writes to
public/css/styles.css
The
--minify flag reduces the CSS file size significantly for faster page loads.Cloud Functions Preparation
Deployment Commands
Full Deployment
Deploy all Firebase services at once:- Cloud Functions
- Firebase Hosting
- Firestore Rules
- Firestore Indexes
- Storage Rules
Selective Deployment
- Hosting Only
- Functions Only
- Firestore Rules
- Storage Rules
Deploy just the frontend (HTML, CSS, JS):Use this when you’ve only changed frontend code or styles.Deploy time: ~30 seconds
Environment Variables for Production
Setting Function Secrets
For production, use Firebase’s secret manager instead of.env files:
Set Email Configuration
Deployment Workflow
Standard Deployment Process
Monitor Deployment
Watch the deployment progress in your terminal. You’ll see:
- Functions being uploaded and deployed
- Hosting files being uploaded
- Rules being updated
- Final deployment URLs
Cloud Functions Deployment Details
Available Functions
The platform includes the following Cloud Functions: Payment Processing:createMercadoPagoPreference- Create MercadoPago paymentmercadoPagoWebhook- Handle MercadoPago webhookscreateCODOrder- Create cash-on-delivery orderscreateAddiCheckout- Create ADDI payment checkoutaddiWebhook- Handle ADDI webhookscreateSistecreditoCheckout- Create Sistecrédito checkoutsistecreditoWebhook- Handle Sistecrédito webhooks
sendOrderConfirmation- Email order confirmationssendDispatchNotification- Email shipping notificationssendWhatsappMessage- Send WhatsApp messageswhatsappWebhook- Handle WhatsApp webhooks
cleanupOldOrders- Runs every 24 hoursprocessScheduledTransfers- Process pending transferscancelAbandonedPayments- Cancel expired paymentscheckExpiredPromotions- Expire outdated promotions
touchProductTimestamp- Update product sync timestampsgenerateProductFeed- Generate Google Merchant feedsitemap- Generate XML sitemap
Function Configuration
Functions are configured to use:- Node.js Runtime: v24 (specified in
functions/package.json) - Region: Auto-selected by Firebase (typically us-central1)
- Memory: Default (256MB, can be increased per function if needed)
- Timeout: Default (60s for HTTP, 540s for scheduled)
Deploying Individual Functions
For faster deployments, deploy only changed functions:Post-Deployment Verification
Check Firestore Rules
Test that security rules are active:
- Go to Firebase Console > Firestore Database
- Try to read/write data without authentication
- Verify proper access control
Rollback Strategy
Rolling Back Hosting
Firebase Hosting keeps previous deployments. To rollback:- Go to Hosting > Release history
- Click on a previous release
- Click Rollback
Rolling Back Functions
Functions don’t have automatic rollback. To revert:-
Checkout the previous code version:
-
Redeploy:
CI/CD Integration
GitHub Actions Example
Create.github/workflows/deploy.yml:
Troubleshooting
Deployment fails with authentication error
Deployment fails with authentication error
Solution:Select your project again.
Functions fail to deploy due to Node version
Functions fail to deploy due to Node version
Ensure your local Node.js version matches the one specified in Use nvm to switch versions if needed.
functions/package.json (v24):Styles not updating after deployment
Styles not updating after deployment
- Clear your browser cache
- Verify the CSS file was rebuilt:
- Check browser DevTools Network tab for 304 vs 200 status
Function environment variables not working
Function environment variables not working
After setting secrets, you must redeploy:Verify secrets are set:
Quota exceeded errors
Quota exceeded errors
Check your usage in Firebase Console:
- Go to Usage and billing
- Check which services are consuming quota
- Optimize function calls or upgrade plan if needed
Performance Optimization
Hosting Performance
- CDN: Firebase Hosting automatically uses a global CDN
- Compression: Gzip/Brotli compression is automatic
- Caching: Configure cache headers in
firebase.jsonif needed - SSL: HTTPS is automatic and free
Function Performance
- Cold Starts: Keep functions warm with scheduled pings if needed
- Memory: Increase memory allocation for heavy functions
- Concurrency: Optimize database queries to reduce execution time
Tailwind CSS Optimization
The--minify flag already optimizes CSS, but you can further reduce size:
tailwind.config.js
content array includes all files that use Tailwind classes to enable proper purging.
Next Steps
Environment Setup
Set up local development environment
Firebase Setup
Configure Firebase services