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.
Overview
App CR uses PostgreSQL 15 as the database, managed through Docker Compose for development and Prisma ORM for database operations.Prerequisites
Docker & Docker Compose
Required to run PostgreSQL container
Node.js & npm
Required to run Prisma CLI commands
Quick Start
Docker Configuration
PostgreSQL Container
Thedocker-compose.yml defines the PostgreSQL service:
Configuration Details
PostgreSQL version 15 official Docker image
Automatically restart container if it stops
Database superuser username
Database superuser password
Initial database name
Maps container port 5432 to host port 5432
Persists database data in Docker volume
postgres_dataDocker Commands
Environment Variables
DATABASE_URL Format
TheDATABASE_URL follows PostgreSQL connection string format:
Default Configuration
URL Components
postgresql:// - PostgreSQL protocol identifierDatabase username from
POSTGRES_USERDatabase password from
POSTGRES_PASSWORDDatabase host
localhostfor local developmentpostgreswhen connecting from another Docker container- Production hostname/IP in deployment
PostgreSQL port (default: 5432)
Database name from
POSTGRES_DBOptional schema name (defaults to
public)Example: ?schema=app_schemaEnvironment File Location
Database Connection
Using Prisma Client
Connection Pooling
Prisma automatically manages connection pooling. Configure pool size via environment:Maximum number of database connections in the pool
Testing Database Connection
Using Prisma Studio
Open the interactive database browser:http://localhost:5555
Using psql CLI
Connect directly to PostgreSQL:Test Queries
Production Setup
Environment Configuration
For production, use secure environment variables:SSL/TLS mode for encrypted connectionsValues:
disable- No SSL (development only)require- Require SSLverify-ca- Require and verify CAverify-full- Full certificate verification
Security Best Practices
Use strong passwords
Use strong passwords
- Minimum 16 characters
- Mix of uppercase, lowercase, numbers, symbols
- Use password manager or secrets management service
Enable SSL/TLS
Enable SSL/TLS
Always use encrypted connections in production:
Restrict database access
Restrict database access
- Use firewall rules to limit access
- Create application-specific database user (not superuser)
- Grant minimal required permissions
Use secrets management
Use secrets management
Store
DATABASE_URL in:- AWS Secrets Manager
- HashiCorp Vault
- GitHub Secrets (for CI/CD)
- Never hardcode in application code
Enable connection pooling
Enable connection pooling
Use connection pooler like PgBouncer for high-traffic applications:
Troubleshooting
Connection Refused
Error:ECONNREFUSED 127.0.0.1:5432
Authentication Failed
Error:password authentication failed for user
Verify credentials
Check
.env file matches docker-compose.yml:- User:
user_admin - Password:
password123 - Database:
mi_db_crud
Database Does Not Exist
Error:database "mi_db_crud" does not exist
Schema Out of Sync
Error:The database schema is not in sync with your Prisma schema
Next Steps
Database Schema
Explore the complete database schema
Run Migrations
Learn how to manage database migrations