Workflows
Multi-Service Apps
A single entity can contain multiple services — for example, an API backend and a frontend.
name: my-platform
services:
api:
type: node
path: /api
web:
type: nextjs
path: /
cron:
type: cron
schedule: "0 */6 * * *"
run: job
requires:
- db
- redis
- ai
Directory structure:
my-platform/
cloudgrid.yaml
services/
api/
package.json
src/index.js
web/
package.json
next.config.mjs
app/
page.tsx
layout.tsx
cron/
package.json
src/job.js
Each service gets its own build, its own port, and its own route prefix (defined by path:). The platform handles routing between them.
During local development, grid dev spawns all services and injects sibling URLs:
grid dev
# [api] Listening on port 3001
# [web] ready on port 3000
# [cron] skipped (http-cron, production only)
Each service receives {SIBLING}_URL environment variables (e.g., API_URL=http://localhost:3001 in the web service).