Private Networking
DocsNetworkingPrivate Networking

Private Networking

Apps and add-ons in the same phase talk over the private network. Attach them on the canvas — there is no private-DNS settings page.

Same-phase attach

From the phase canvas, connect a database or other add-on to the app (or add it from the app Add-ons tab). Connected apps get the add-on’s connection variables injected on the Variables tab. Commit those changes on the canvas so the app restarts with the new values.

Attach Postgres on the canvas in the same phase, then read the injected DATABASE_URL on the Variables tab. Reach a sibling app by its service name on the private network.

Reach a sibling app

Use the other app’s name as the hostname (the name you gave it when you created it). There is no extra DNS form to fill in.

Examples
# Web API named "api"
http://api:8080

# Worker named "background-worker"
http://background-worker:3000

Listen on the port from PORT (default 8080) unless you changed it on Settings.

Add-on connection strings

Prefer the injected variables after you attach — they include host, port, and credentials. Typical ports if you assemble a URL yourself:

  • PostgreSQL: 5432
  • MySQL / MariaDB: 3306
  • Redis / Valkey: 6379
  • MongoDB: 27017

Example: API calling a worker

api/src/jobs.ts
const response = await fetch('http://worker:3000/process', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ jobId: '123', payload: data }),
})

const result = await response.json()

Who can reach what

Private traffic stays inside the phase. Another project cannot use these hostnames. For a public caller, use the app’s *.stackblaze.app URL (or a custom domain) and authenticate in your app.

Shared secrets

If two of your apps call each other on the private network, add the same key on each Variables tab (or attach the same add-on) and check it in application code. There is no Environment Groups feature.

Do not use the public hostname for databases

Add-ons are attached in-phase. Use the injected connection URL, not *.stackblaze.app. That hostname is for web apps exposed to the internet.