Overview
CEMAC uses environment variables to configure Firebase integration and server settings. These variables must be set before running the application in both development and production environments.Required Variables
Server Configuration
The port number on which the CEMAC server will listen for incoming requests.Example:
3000Firebase Configuration
CEMAC integrates with Firebase for authentication and database services. The following variables are required to connect to your Firebase project:Your Firebase project’s API key. This is used to authenticate requests to Firebase services.Location: Firebase Console > Project Settings > General > Your apps > Web appExample:
AIzaSyC1234567890abcdefghijklmnopqrstuvThe authentication domain for your Firebase project.Format:
{project-id}.firebaseapp.comExample: cemac-prod.firebaseapp.comYour Firebase project’s unique identifier.Location: Firebase Console > Project Settings > General > Project IDExample:
cemac-prodThe Cloud Storage bucket for your Firebase project.Format:
{project-id}.appspot.comExample: cemac-prod.appspot.comThe sender ID for Firebase Cloud Messaging.Location: Firebase Console > Project Settings > Cloud Messaging > Sender IDExample:
123456789012Your Firebase web app’s unique identifier.Location: Firebase Console > Project Settings > General > Your apps > App IDExample:
1:123456789012:web:abcdef1234567890Setup Instructions
Add environment variables
Copy the following template and replace the placeholder values with your actual Firebase credentials:
Verify configuration
Ensure the If not present, add it:
.env file is listed in your .gitignore to prevent accidental commits:Production Environment
For production deployments (e.g., Vercel), set environment variables through your hosting platform’s dashboard:Add variables
Add each environment variable as a key-value pair. Ensure you select the appropriate environment (Production, Preview, Development).
Validation
You can verify your environment configuration by checking the server logs when the application starts:Troubleshooting
Server won’t start
- Verify all required variables are set in
.env - Check for typos in variable names (they are case-sensitive)
- Ensure no extra spaces around
=signs in.env
Firebase authentication fails
- Verify your Firebase API key is correct
- Check that your Firebase project is active
- Ensure the auth domain matches your Firebase project
Port already in use
- Change the
PORTvalue to an available port - Or stop the process using the current port: