Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Celaya55/app-cr/llms.txt
Use this file to discover all available pages before exploring further.
Environment Variables
App CR uses environment variables to configure database connections, authentication, and server settings. This guide covers all required and optional environment variables.Required Variables
These environment variables must be set for the application to run:DATABASE_URL
The PostgreSQL database connection string used by Prisma.postgresql://[user]:[password]@[host]:[port]/[database]
When using Docker Compose, replace
localhost with the service name (e.g., postgres) if your backend runs in a container.JWT_SECRET
Secret key used to sign and verify JWT tokens for authentication.PORT
The port on which the Express.js server will run. Defaults to 3000 if not specified.Configuration Setup
Environment-Specific Configuration
Development Environment
.env.development
Docker Environment
When running the backend in Docker alongside the PostgreSQL container:.env.docker
Production Environment
For production deployments:.env.production
Variable Usage in Code
The application loads environment variables using thedotenv package:
backend/index.js
DATABASE_URL from the environment:
schema.prisma
Generating Secure Values
JWT Secret
Generate a secure random string for your JWT_SECRET:Database Connection String Components
Breakdown of theDATABASE_URL format:
| Component | Description | Example |
|---|---|---|
| Protocol | Database type | postgresql:// |
| User | Database username | user_admin |
| Password | Database password | password123 |
| Host | Database server address | localhost or postgres |
| Port | Database port | 5432 |
| Database | Database name | mi_db_crud |
Validation and Testing
Check Environment Variables
Verify that your environment variables are loaded correctly:Test Database Connection
Test your database connection with Prisma:DATABASE_URL is configured correctly.
Common Issues
Missing Environment Variables
Solution: Ensure your.env file exists in the backend directory and contains all required variables.
Connection Refused
If you see “connection refused” errors:- Verify PostgreSQL is running:
docker-compose ps - Check the host in your
DATABASE_URL(uselocalhostfor local,postgresfor Docker) - Ensure the port matches your Docker configuration
Invalid JWT Secret
If authentication fails:- Verify
JWT_SECRETis set and matches across all instances - Ensure the value doesn’t contain quotes in the
.envfile - Restart your application after changing the secret
Environment Variable Checklist
Before deploying, verify:-
.envfile exists in thebackenddirectory -
DATABASE_URLis set and points to your database -
JWT_SECRETis set with a strong random value -
PORTis set (or defaults to 3000) -
.envis listed in.gitignore -
.env.exampleexists for team reference - Production values use strong passwords and secrets
Next Steps
Docker Deployment
Set up Docker Compose for your environment
Production Best Practices
Learn how to securely deploy to production