.niteshift/services.yaml declares the long-running processes an environment needs. Niteshift
supervises them: they start automatically after setup
on every task, restart after a resume, and restart on failure.
.niteshift/services.yaml
Fields
The file is validated against a strict schema. Unknown keys and duplicate names are rejected, and
validation errors name the offending entry.
Ports and previews
Each declaredport publishes an authenticated preview URL, and the preview panel opens the first
one, so put the primary UI first among services that declare ports. A few ports are reserved by
environment infrastructure; validation names them if a service tries to claim one.
Environment
Services receive only what they declare, plusPORT and a small set of Niteshift-provided
variables. Repository environment variables from settings are not inherited. Each entry sets a
name and exactly one of:
value: a literal, for non-secret configuration.secret: a reference to a repository environment variable stored encrypted in Niteshift. The value is fetched each time the service starts, so rotations take effect on restart.
Preview authentication
For an app with a login, the service that serves it declaresauth, so previews open already signed
in. Three types:
magic-dev-login-url: the app serves a development-only login route that mints a session and redirects.cookie-file: a command signs in without user interaction and writes browser state for Niteshift to inject.recorded: Niteshift replays a session you record once by hand.
magic-dev-login-url or cookie-file; recorded is the last resort, since recorded
sessions expire and need re-recording. At most one service declares auth.
Browser authentication covers choosing between
the types and recording sessions.
Tunnels
A tunnel exposes a port at a stable public URL with no Niteshift authentication, for external systems that must reach the environment, like webhook providers. The random URL acts as a credential: share it only with the intended integration, and keep tunnels off the port whose service declaresauth.
Inside a task
The agent (and you, from the terminal tab) can inspect and drive services with thens CLI: