Skip to content

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:

ServiceHostnamePort
PostgreSQLpostgres5432
Redisredis6379
Another web serviceapi3000
// Connect to PostgreSQL
const db = new Pool({ host: 'postgres', port: 5432 });
// Connect to Redis
const redis = new Redis({ host: 'redis', port: 6379 });
// Call another service
const 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 typeEnvironment variable
PostgreSQLDATABASE_URL=postgresql://user:pass@postgres:5432/db
MariaDBMYSQL_URL=mysql://user:pass@mariadb:3306/db
RedisREDIS_URL=redis://redis:6379
ValkeyREDIS_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 isolationpostgres in project A resolves to a different container than postgres in project B
  • Performance — no noisy-neighbor effects on network traffic

External access

By default, only web services are exposed externally via HTTPS. Databases and caches are only accessible from within the project’s private network.

This is a security best practice — your database should never be directly accessible from the internet.

What’s next?