Networking
Nhost Run services and the main Nhost stack share the same network, facilitating direct and efficient communication. This network connectivity offers low latency, high throughput, and eliminates egress costs.
Connecting to the Nhost stack
To connect your service to the Nhost stack, use the following information:
- postgres:
postgres://postgres:<password>@postgres-service:5432/<subdomain>?sslmode=disable
- hasura: base URL is
http://hasura-service:8080
- hasura-auth: base URL is
http://hasura-auth-service:4000
- hasura-storage: base URL is
http://hasura-storage-service:5000
Connecting to your service internally
To connect to your own service internally from another service, follow these steps:
- Expose the desired port(s).
Example for Redis service:
- dashboard
- toml
[[ports]]
type = "tcp"
port = 6379
publish = false
- Once the port is exposed, you can connect to the service using its name and the corresponding port.
Example: redis://user:password@redis:6379
If needed, you can open internally more than one port by repeating the block for each one of them:
Example for a service exposing the ports tcp/3000 and udp/4000:
- dashboard
- toml
[[ports]]
type = "tcp"
port = 3000
publish = false
[[ports]]
type = "udp"
port = 4000
publish = false
Exposing Your Service to the Internet
To expose your service to the internet, follow these steps:
- Update your configuration with the relevant port information:
Example for a nodejs service exposing an API on port 3000:
- dashboard
- toml
[[ports]]
type = "http"
port = 3000
publish = true
Currently, only services of type http
can be exposed to the internet.
Once the service of type
http
is published, you can connect to it using a URL with the following format:https://<run_service_subdomain>-<port>.svc.<region>.nhost.run
For example:
https://zlbmqjfczuwqvsquujno-3000.svc.eu-central-1.nhost.run