Init & Routing
The yourspace init command scaffolds a project config in the current directory.
1. Initialize
Run yourspace init for an interactive walk — it defaults the site name from the directory basename (lower-cased, non-alphanumeric runs collapsed to hyphens), probes the API so a taken name surfaces here rather than at deploy time, and asks for the static-output directory:
$ yourspace init site name [my-site]: ✓ my-site is available static output [dist]: ✓ wrote yourspace.yml next step: run `yourspace deploy` to ship it
For scripting, pass flags instead: --name sets the site name, --dir scaffolds somewhere other than ., and --force overwrites an existing yourspace.yml.
2. yourspace.yml structure
name: my-site
build:
dist: dist
# Routing block is optional — omitted, everything under the directory is
# served statically. Paths and headers are active today; target/cache/ttl/edge
# parse cleanly but resolve to static file serving in v0.1 (see callout).
routes:
- path: /api/*
target: origin
cache: none
- path: /static/*
target: cache
ttl: 7d
- path: /*
target: edge-nearest
cache: 1h
3. Routing pragmas
Design preview — routing DSL
Path matching, header injection, per-route error pages, redirects, and
custom-domain bindings are live. The target,
cache, ttl, and edge semantics below
parse cleanly but currently resolve to static file serving regardless of
value — full behaviour lands with the edge-routing and cache-layer
workstreams.
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 —noneor a duration (30m, 1h, 7d).ttl— Alias for cache duration. Ignored ifcacheis 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.