Skip to main content

Backend Service

Operating the wspace-subscriberbot-svc microservice.

Local operations​

Start state services​

cd ~/products/subscriberbot/wspace-subscriberbot-state
docker compose up -d

This starts PostgreSQL (port 5291) and Valkey (port 6291).

Start the service​

cd ~/products/subscriberbot/wspace-subscriberbot-svc
bun run dev

The service starts on port 3291 with hot reload.

Apply migrations​

bun run migrate:deploy

This runs scripts/migrate-safe.sh, which validates the migration against the current schema before applying.

Generate Prisma client​

bun run gendb

Generate GraphQL types​

bun run codegen

This also regenerates .hive-schema.graphql at the repo root.

Health and monitoring​

Local health probe​

curl http://localhost:3291/health

Gateway health (via doctor)​

make test-health

Prometheus metrics​

The service exports metrics via @envelop/prometheus and @graphql-yoga/plugin-prometheus:

  • graphql_operations_total
  • graphql_operations_errors_total
  • graphql_request_duration_seconds

OpenTelemetry traces​

Traces are exported to the platform OTLP collector. Span attributes include workspace id, actor id, operation name, and query complexity.

Logs​

Local logs are written to stdout via pino. In the managed cloud environments, logs are collected by the platform log pipeline (container console logs are intentionally off in pre-launch environments to reduce cost; use the health endpoint and OpenTelemetry for observability).

Scaling​

In the managed cloud environments, the service scales based on HTTP request count and CPU. The default minimum replica count is 1 for prod; pre-launch services may be scaled to 0 when not in active use.

Database connections​

In the managed cloud environments, database connectivity is handled by the platform. Services read their PostgreSQL connection string from the platform secret store and connect over TLS — server names, ports, and pooling are managed by the platform team and are never hard-coded in service code.

The global layer (auth, tenant, billing) and the workspace layer (all wspace-* services) each have their own database server per environment.