Databases
Connect your application to PostgreSQL, MySQL, MongoDB, Redis, and more with secure, managed database solutions.
Supported Databases
CupaDev integrates with all major database providers:
PostgreSQL
Powerful relational database with advanced features
- • Supabase
- • Neon
- • Railway
- • Amazon RDS
MySQL
Popular open-source relational database
- • PlanetScale
- • Amazon RDS
- • Google Cloud SQL
- • Self-hosted
MongoDB
NoSQL document database for flexible schemas
- • MongoDB Atlas
- • Self-hosted
Redis
In-memory cache for blazing-fast data access
- • Upstash
- • Redis Cloud
- • Amazon ElastiCache
Connecting Your Database
Connect your database using environment variables:
Step 1: Get Connection String
Obtain your database connection string from your database provider. It typically looks like:
postgresql://user:password@host:5432/databaseStep 2: Add to Environment Variables
In your CupaDev project settings, add the connection string as an environment variable:
DATABASE_URLpostgresql://...Production, Preview, DevelopmentStep 3: Use in Your Application
Access the connection string in your code:
// Node.js / Next.js
import { Client } from 'pg';
const client = new Client({
connectionString: process.env.DATABASE_URL,
ssl: { rejectUnauthorized: false }
});
await client.connect();Recommended Providers
These providers offer excellent integration with CupaDev:
Supabase (PostgreSQL)
Open-source Firebase alternative with real-time subscriptions, authentication, and storage.
Visit Supabase →Neon (PostgreSQL)
Serverless PostgreSQL with branching, autoscaling, and generous free tier.
Visit Neon →PlanetScale (MySQL)
Serverless MySQL with database branching, schema migrations, and horizontal scaling.
Visit PlanetScale →Upstash (Redis)
Serverless Redis with per-request pricing, REST API, and global replication.
Visit Upstash →MongoDB Atlas (MongoDB)
Fully managed MongoDB with automatic scaling, backups, and security features.
Visit MongoDB Atlas →Connection Pooling
For serverless environments, use connection pooling to avoid exhausting database connections:
PostgreSQL with Prisma
// Add to your connection string
DATABASE_URL="postgresql://user:pass@host:5432/db?pgbouncer=true&connection_limit=1"
// prisma/schema.prisma
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}MySQL with PlanetScale
// PlanetScale automatically handles connection pooling DATABASE_URL="mysql://user:pass@host/db?sslaccept=strict"
Security Best Practices
Use SSL Connections
Always enable SSL/TLS for database connections in production:
ssl={ rejectUnauthorized: false }Separate Databases Per Environment
Use different databases for production, preview, and development environments. Never share production databases with test environments.
Rotate Credentials
Regularly rotate database passwords and connection strings, especially when team members change.
Restrict Network Access
Use IP whitelisting or VPC peering to restrict database access to authorized networks only.
Troubleshooting
Connection timeout errors
Check that:
- Your database allows connections from CupaDev's IP addresses
- Connection string is correct with proper credentials
- Database is running and accessible
- Firewall rules allow outbound connections
SSL certificate verification failed
Add ssl: { rejectUnauthorized: false } to your connection config, or ensure your SSL certificate is valid.
Too many connections error
Use connection pooling or limit concurrent connections:
- Add connection pooler like PgBouncer
- Use serverless-friendly database providers
- Set
connection_limit=1in connection string