Databases
↓ Download .mdDatabases
Create PostgreSQL, MongoDB, and Redis databases in seconds, with automatic credentials and localhost access.
Available Databases
| Database | Type | Common Use |
|---|---|---|
| PostgreSQL | Relational | APIs, web apps, structured data |
| MongoDB | Document (NoSQL) | Flexible apps, semi-structured data |
| Redis | Cache/Key-Value | Cache, queues, sessions, real-time |
Creating a Database
- Go to your stack and click New App
- Select Database as the type
- Choose the desired database (PostgreSQL, MongoDB, or Redis)
- Set a name
- Click Create
PodCubo creates the database automatically with:
- Generated credentials (username and password)
- Persistent volume for data storage
- Access via
localhostwithin the stack
Connecting Your App to the Database
A stack in PodCubo is a pod — all containers share the same local network. This means your app and your database communicate via localhost, exactly like your development environment.
To connect your app to the database, use an environment variable with the connection string. Go to your app's edit screen, in the Environment Variables section, and add the database connection string.
PostgreSQL
DATABASE_URL=postgresql://username:password@localhost:5432/defaultdbFor Java/JDBC applications:
DATABASE_URL=jdbc:postgresql://localhost:5432/defaultdb?user=username&password=passwordMongoDB
DATABASE_URL=mongodb://username:password@localhost:27017/defaultdb?authSource=adminRedis
REDIS_URL=redis://default:password@localhost:6379After adding, click Save & Restart to apply.
Tip: Credentials (username and password) are available in the database app's Connection section. Just copy the connection string from there.
Reading the variable in your application
// Node.js
const dbUrl = process.env.DATABASE_URL;# Python
import os
db_url = os.environ["DATABASE_URL"]// Go
dbUrl := os.Getenv("DATABASE_URL")Why localhost?
All containers in a stack run inside the same pod and share the same network interface. Each service listens on its default port:
| Service | Port |
|---|---|
| PostgreSQL | localhost:5432 |
| MongoDB | localhost:27017 |
| Redis | localhost:6379 |
| Your app | localhost:3000 (or whatever port you configured) |
This is secure (no one from outside can access it), fast (zero network latency), and simple (works just like your local environment).
Connecting Remotely
If you need to access the database from external tools like DBeaver, pgAdmin, or MongoDB Compass, PodCubo provides access via external domain with TLS.
The connection string for remote access is different from the local one — it uses the database's public domain instead of localhost.
PostgreSQL (remote)
PodCubo supports PostgreSQL connections via STARTTLS. Configure your client with:
- Host: the app's domain (e.g.,
my-postgres-xxxx.podcubo.com) - Port:
5432 - SSL: Required
- Username and password: same as in the Connection section
Remote connection string:
postgresql://username:password@my-postgres-xxxx.podcubo.com:5432/defaultdb?sslmode=requireMongoDB (remote)
mongodb://username:password@my-mongo-xxxx.podcubo.com:27017/defaultdb?authSource=admin&tls=trueRedis (remote)
rediss://default:password@my-redis-xxxx.podcubo.com:6379Important: For remote access, always use the connection string with the external domain and TLS. The
localhostconnection string only works within the stack.
Backups
We recommend configuring automatic backups for your databases. PodCubo offers backup via rclone to any S3-compatible storage.