Prerequisites
Before deploying, ensure you have:- GitHub repository with your PaparcApp code
- Render account (free tier available)
- Neon account for PostgreSQL (free tier available)
- n8n instance configured (see Notifications Guide)
- Firebase project set up (for social authentication)
Architecture Overview
Production deployment stack:Step 1: Database Setup (Neon)
Create Neon Project
- Sign up at neon.tech
- Click “New Project”
- Configure your database:
- Name:
paparcapp-production - Region: Choose closest to your users (e.g.,
US East,EU West) - PostgreSQL Version:
15or latest
- Name:
- Click “Create Project”
Get Connection String
Neon provides a connection string in this format:Initialize Database Schema
- Open the SQL Editor in Neon console
- Run the SQL scripts in order:
- Run constraints (from
database/02_constraints.sql) - Run indexes (from
database/03_indexes.sql) - Run initial data (from
database/04_initial_data.sql)
Step 2: Render Web Service Setup
Create Web Service
- Log in to Render Dashboard
- Click “New +” → “Web Service”
- Connect your GitHub repository
- Configure the service:
| Setting | Value |
|---|---|
| Name | paparcapp |
| Region | Same as Neon (e.g., Oregon, Frankfurt) |
| Branch | main or production |
| Runtime | Node |
| Build Command | npm install |
| Start Command | npm start |
| Instance Type | Free (or Starter for production) |
Environment Variables
Add the following environment variables in Render dashboard:Required Variables
Generating SESSION_SECRET
Generate a strong secret using Node.js:Database Connection Configuration
PaparcApp is already configured to use Neon’s connection string:config/database.js
ssl: { rejectUnauthorized: false } setting is required for cloud PostgreSQL providers like Neon and Render.
Step 3: Application Configuration
Trust Proxy for HTTPS
Render uses a reverse proxy with SSL termination. PaparcApp is pre-configured:app.js
secure: true flag ensures session cookies are only sent over HTTPS in production.
Static Files
Render automatically serves files from thepublic/ directory:
app.js
Step 4: Firebase Configuration
Update Firebase Config
If deploying to a custom domain, update the authorized domains in Firebase Console:- Go to Firebase Console
- Select your project:
paparcapp-b0ac1 - Navigate to Authentication → Settings → Authorized domains
- Add your Render domain:
your-app.onrender.com- Your custom domain (if using one)
Environment-Specific Config
The Firebase config is inpublic/javascripts/firebase-config.js:
Firebase config is safe to expose in frontend code. The API key is not a secret - it’s restricted by domain authorization.
Step 5: Deploy
Initial Deployment
- Push your code to GitHub
- Render automatically detects the push and starts building
- Monitor the deployment in Render dashboard:
- Logs tab shows build progress
- Look for “Build successful” and “Server started”
Deployment Process
Render executes these steps:Verify Deployment
Check that services are running:- Web Service: Visit
https://your-app.onrender.com - Database: Check Neon dashboard for active connections
- Logs: Review Render logs for errors:
Step 6: Post-Deployment
Create Admin User
Connect to your Neon database and create an admin account:Test Critical Features
Verify these features work in production:- User registration and login
- Google/Facebook social login
- Create a reservation
- Email notification received
- Admin dashboard access
- Session persistence
- HTTPS redirects
Environment Variables Reference
Complete.env.example for production:
.env.example
Required vs Optional
| Variable | Required | Default | Purpose |
|---|---|---|---|
NODE_ENV | Yes | development | Enables production optimizations |
PORT | No | 3000 | Server port (Render sets automatically) |
SESSION_SECRET | Yes | ⚠️ Insecure fallback | Signs session cookies |
DATABASE_URL | Yes | None | PostgreSQL connection string |
N8N_WEBHOOK_URL | Yes | Localhost fallback | Email notification endpoint |
Custom Domain (Optional)
Add Custom Domain to Render
- In Render dashboard, go to Settings → Custom Domain
- Add your domain:
paparcapp.com - Configure DNS records at your domain registrar:
- Render automatically provisions SSL certificate
Update Firebase Authorized Domains
Add your custom domain to Firebase (see Step 4 above).Monitoring and Logs
Render Logs
Access real-time logs in Render dashboard:Database Monitoring
Neon provides built-in monitoring:- Connections: Track active database connections
- Queries: Monitor slow queries
- Storage: Check database size and limits
Error Tracking
For production error tracking, consider integrating:- Sentry: Application error monitoring
- LogDNA or Datadog: Log aggregation
- Uptime Robot: Availability monitoring
Troubleshooting
Common Issues
Database Connection Failed
Error:Error inesperado en el cliente de la base de datos
Solutions:
- Verify
DATABASE_URLis correct in Render environment variables - Check Neon database is active (not suspended)
- Ensure
ssl: { rejectUnauthorized: false }is set inconfig/database.js - Test connection string locally:
Session Not Persisting
Error: Users logged out on every request Solutions:- Check
SESSION_SECRETis set in environment variables - Verify
trust proxyis set to1inapp.js - Ensure
NODE_ENV=productionfor secure cookies - Check browser isn’t blocking cookies
Firebase Auth Fails
Error:auth/unauthorized-domain
Solutions:
- Add Render domain to Firebase authorized domains
- Clear browser cache and retry
- Check Firebase console for service outages
Email Notifications Not Sending
Error:Error al contactar con n8n
Solutions:
- Verify
N8N_WEBHOOK_URLis correct - Check n8n workflow is active
- Test webhook directly with curl:
- Review n8n execution logs
Performance Optimization
Enable Connection Pooling
Already configured inconfig/database.js:
Cache Pricing Data
The app preloads pricing data on startup:app.js
Scaling Considerations
Render Free Tier Limits
- Service spins down after 15 minutes of inactivity
- First request after spin-down takes 30-60 seconds
- 750 hours/month free (enough for 1 service)
Upgrading to Paid Plans
Render Starter ($7/month):- Always-on service (no spin-down)
- Faster builds
- Custom domains with auto-SSL
- Increased storage (10GB)
- Longer data retention
- Branch management
Backup Strategy
Database Backups (Neon)
Neon automatically backs up your database:- Retention: 7 days (free tier) / 30 days (paid)
- Point-in-time recovery: Available on Pro plan
Code Backups
Git repository serves as code backup:- Push to GitHub regularly
- Tag production releases:
git tag v1.0.0 - Consider GitHub automated backups or secondary remote
Security Checklist
Before going live:-
SESSION_SECRETis strong and unique - Database credentials are not in code
- HTTPS is enforced (automatic on Render)
- Firebase authorized domains configured
- Admin default password changed
- SQL injection protection (parameterized queries used)
- CORS configured if using API
- Rate limiting considered for auth endpoints
Next Steps
Authentication
Set up user authentication and session management
Notifications
Configure email notifications with n8n
