Requires
Declares required resource dependencies. The app will not start without them. Value is an array; each entry is a string (shorthand) or an object.
A string shorthand (requires: [postgres]) expands to [{ type: "postgres" }].
| Field | Type | Required | Description |
|---|---|---|---|
name |
string |
no | Resource name for expression references (defaults to type) |
type |
string |
yes | Resource type (see Resource Property Vocabulary) |
version |
string |
no | Version constraint using semver ranges (e.g. >=15, ^7.0, 20.x) |
config |
map<string, any> |
no | Resource provisioning hints (platform-interpreted) |
set_env |
map<string, string> |
no | Maps resource properties to app env vars using $ expressions |
requires:
- type: postgres
version: ">=15"
set_env:
DATABASE_URL: $url
DB_HOST: $host
DB_PASSWORD: $passwordResource naming
By default, a resource's name is its type. Expression references like $postgres.host use this name. When an app requires multiple instances of the same type, use the name field to distinguish them:
requires:
- type: postgres
name: primary-db
set_env:
PRIMARY_DB_URL: $url
- type: postgres
name: analytics-db
set_env:
ANALYTICS_DB_URL: $urlReferences use the name: $primary-db.host, $analytics-db.host. Without name, two resources of the same type would be ambiguous.
Version constraints
The version field uses semver range syntax (as defined by node-semver):
| Syntax | Meaning |
|---|---|
>=15 |
Version 15 or higher |
^7.0 |
Compatible with 7.x (>=7.0.0, <8.0.0) |
~2.1.0 |
Approximately 2.1.x (>=2.1.0, <2.2.0) |
20.x |
Any 20.x version |
15.2.0 |
Exact version |
Resource configuration
The config map passes provisioning hints to the platform. Keys and semantics are resource-type-specific:
requires:
- type: postgres
version: ">=15"
config:
extensions: [pgvector, postgis]
shared_buffers: 256MB
- type: redis
config:
maxmemory: 256mb
maxmemory-policy: allkeys-lruThe platform interprets these hints when provisioning the resource. Unknown keys are ignored by platforms that don't support them.
Expression wiring
Values in set_env use the expression syntax. Inside a requires or supports block, bare $prop references resolve against the enclosing resource's property vocabulary.
Real-world examples: See how Ghost, Metabase, and Miniflux declare their database requirements. Browse all apps →