Services are long-running processes managed inside a sprite — databases, web servers, background workers, and similar daemons. The services API lets you define a service with a command, start and stop it on demand, tail its logs in real time via a streaming interface, and send OS signals. Most lifecycle operations return aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/superfly/sprites-go/llms.txt
Use this file to discover all available pages before exploring further.
ServiceStream that delivers log events as the service starts or stops.
Client methods
ListServices
Request context.
Name of the sprite to query.
Slice of services with combined definition and state. Empty slice when no services exist.
Non-nil on network or API errors.
GetService
Request context.
Name of the sprite.
Name of the service to fetch.
Service definition and runtime state.
Wraps
"service not found" when the service does not exist.CreateService
CreateServiceWithDuration to monitor the service for longer than the default window.
Request context. Cancelling closes the stream but does not stop the service.
Name of the sprite.
Name to assign the service.
Service definition. See ServiceRequest.
Stream of
ServiceLogEvent values. Call ProcessAll or iterate with Next.Returns a conflict error if the service name is already in use.
CreateServiceWithDuration
CreateService but keeps the log stream open for the specified duration after the service starts, allowing you to observe initial output. Pass 0 for the default window.
Request context.
Name of the sprite.
Name to assign the service.
Service definition.
How long to keep the stream open after start.
0 uses the server default.DeleteService
Request context.
Name of the sprite.
Name of the service to delete.
Returns
"service not found" or "service conflict" if the service is still running.StartService
Request context.
Name of the sprite.
Name of the service to start.
Stream of startup log events.
Returns
"service not found" if the service does not exist.StartServiceWithDuration
duration. Pass 0 for the default monitoring window.
Request context.
Name of the sprite.
Name of the service to start.
Monitoring window after start.
StopService
Request context.
Name of the sprite.
Name of the service to stop.
Stream of shutdown log events.
Returns
"service not running" if the service is already stopped.StopServiceWithTimeout
0 for the default.
Request context.
Name of the sprite.
Name of the service to stop.
How long to wait for the service to stop gracefully before force-killing it.
SignalService
"SIGHUP", "SIGUSR1").
Request context.
Name of the sprite.
Name of the service to signal.
Signal name, e.g.,
"SIGHUP", "SIGUSR1", "SIGTERM".Returns
"service not found", "service not running", or "invalid signal" on errors.ServiceStream
ServiceStream provides a streaming view of log events produced by service lifecycle operations (create, start, stop).
Next
io.EOF when the stream is exhausted. Empty lines are skipped automatically.
Next event from the stream.
io.EOF at end of stream, or a parse/network error.ProcessAll
handler for each one. Closes the stream automatically when done. Returns the first non-nil error from handler or from reading the stream.
Callback invoked for each event. Return a non-nil error to abort processing.
Close
Types
ServiceRequest
Defines the command and configuration for a new service.Executable to run (e.g.,
"node", "/usr/bin/python3").Arguments passed to the executable.
Names of other services that must be running before this service starts.
Optional. Port the service’s HTTP server listens on, used for health checking.
ServiceLogEvent
Represents a single event emitted by aServiceStream.
Event type. One of
"stdout", "stderr", "exit", "error", "complete", "started", "stopping", "stopped".Event payload — log line content for stdout/stderr events, or a message for status events.
Present on
"exit" events. The process exit code.Unix timestamp in milliseconds when the event was emitted.
Present on
"complete" events. Maps log file names to their paths inside the sprite.ServiceWithState
Combines the service definition with its current runtime state.Embedded service definition.
Runtime state.
nil if the service has never been started.ServiceState
Runtime state of a service as returned insideServiceWithState.
One of
"stopped", "starting", "running", "stopping", or "failed".