Init & Routing

The yourspace init command scaffolds a project config in the current directory.

1. Initialize

Run yourspace init to create yourspace.yml:

$ yourspace init
  ✓ yourspace.yml created

2. yourspace.yml structure

name: my-site

origin: https://localhost:3000

tls:
  auto: true

routes:
  - path: /api/*
    target: origin
    cache: none

  - path: /static/*
    target: cache
    ttl: 7d

  - path: /*
    target: edge-nearest
    cache: 1h

3. Routing pragmas

Use yourspace new to scaffold a routing.yml with pragma comments explaining each directive:

$ yourspace new api-routes
  ✓ api-routes.yml created
  • path — Glob pattern for matching request paths. Supports * (single segment) and ** (recursive).
  • target — Where matched requests go: origin, cache, edge-nearest, or a URL.
  • cache — Cache behaviour — none or a duration (30m, 1h, 7d).
  • ttl — Alias for cache duration. Ignored if cache is set explicitly.
  • headers — Key-value pairs merged into the response (CORS, security, etc.).
  • edge — Name of an edge function to run on this route. Functions live in ./edge/<name>.js.