Connecting Services
Services within a Stackpad project communicate over a private Docker network using simple DNS names. No IP addresses, no external URLs, no configuration — just use the service name as the hostname.
How it works
When you create a project, Stackpad creates an isolated Docker network for that project. Every service in the project is attached to this network and gets a DNS alias matching its name.
For example, if your project has:
- A web service called
web - A PostgreSQL service called
postgres - A Redis service called
redis
Then from your web service, you can connect to:
| Service | Hostname | Port |
|---|---|---|
| PostgreSQL | postgres | 5432 |
| Redis | redis | 6379 |
| Another web service | api | 3000 |
// Connect to PostgreSQLconst db = new Pool({ host: 'postgres', port: 5432 });
// Connect to Redisconst redis = new Redis({ host: 'redis', port: 6379 });
// Call another serviceconst response = await fetch('http://api:3000/health');Automatic credential injection
For database and cache services, Stackpad goes a step further — it automatically generates credentials and injects connection strings into your web services:
| Service type | Environment variable |
|---|---|
| PostgreSQL | DATABASE_URL=postgresql://user:pass@postgres:5432/db |
| MariaDB | MYSQL_URL=mysql://user:pass@mariadb:3306/db |
| Redis | REDIS_URL=redis://redis:6379 |
| Valkey | REDIS_URL=redis://valkey:6379 |
Your application just reads process.env.DATABASE_URL and it works.
Network isolation
Each project has its own isolated network. Services from different projects cannot communicate with each other. This ensures:
- Security — no cross-project data leaks
- DNS isolation —
postgresin project A resolves to a different container thanpostgresin project B - Performance — no noisy-neighbor effects on network traffic
Public access
By default, only web services are exposed externally via HTTPS. Databases and caches are only accessible from within the project’s private network.
If you need to connect from outside Stackpad (e.g. your local machine, an external tool, or a CI pipeline), you can enable public access per service:
- Go to the service Settings tab
- Toggle Public access on
- A connection string with the public endpoint appears
Encrypted public access
All public connections are TLS-encrypted and use standard ports:
| Service type | Port | TLS parameter |
|---|---|---|
| PostgreSQL | 5432 | sslmode=require |
| MySQL / MariaDB | 3306 | ssl=true |
| Redis / Valkey | 6379 | ssl=true |
| MongoDB | 27017 | tls=true |
The public hostname follows the format {serviceId}.db.stackpad.eu. Connection strings include full credentials — copy and paste into TablePlus, pgAdmin, Redis Insight, or your application.
postgresql://user:pass@abc123.db.stackpad.eu:5432/db?sslmode=requireWhat’s next?
- PostgreSQL — add a database to your project
- Redis & Valkey — add caching to your project
- PgBouncer — connection pooling for PostgreSQL
- Networking concepts — deep dive into the networking architecture