Workspace
Keep Edge Functions and templates in your repository, deploy them from the terminal or CI, and roll back a bad deploy.
A workspace keeps your Edge Functions in your repository, next to the app that calls them, so they are reviewed in pull requests and deployed from the terminal or CI.
nulvless init --org acme --project shopnulvless/
├── nulvless.jsonc organization, project and function settings
├── functions/
│ └── checkout/ one folder per function; the folder name is the slug
│ ├── index.ts
│ └── deno.json optional import map (npm:, jsr:)
├── templates/ email and SMS templates, one folder per channel
└── .gitignore keeps .env.local out of gitInside a workspace every command uses its organization and project, so the flags are only needed to act on another one. The CLI finds the workspace from any subfolder.
A workspace created without them can be linked later with
nulvless link. When a command asks which project to use
in a workspace that is not linked yet, the CLI offers to save the answer.
nulvless.jsonc
{
"$schema": "https://cdn.jsdelivr.net/npm/@nulvless/cli/schema/workspace.schema.json",
"organization": "acme",
"project": "shop",
"functions": {
"checkout": { "name": "Checkout", "secrets": ["STRIPE_SECRET_KEY"] }
}
}organizationstringRequiredOrganization slug.
projectstringRequiredProject slug.
functions.<slug>.namestringOptionalDisplay name used when the function is created. Defaults to the slug.
functions.<slug>.secretsstring[]OptionalThe secrets the function needs, by name only. Values never go in this file.
Deploy
nulvless functions new checkout # nulvless/functions/checkout/index.ts
nulvless functions deploy # create or update every function
nulvless functions deploy checkout # only this onedeploy creates the functions that do not exist yet and updates the others.
It never deletes a function that is missing from the folder. Folders starting
with _ are skipped, and a function's files must sit next to its index.ts.
A function made in the console comes into the workspace with
nulvless functions pull checkout. To bring everything at once, functions and
templates, run nulvless pull.
Roll back
promote puts an earlier version of a function back live, without rebuilding
it. Use it when a deploy goes wrong:
nulvless functions deployments checkout # find the version to go back to
nulvless functions promote checkout v2 # serve it againNulvless keeps the live version and the three successful deploys before it, so
those are the ones you can promote. The next deploy replaces the promoted
version as usual.
Start from an example
github.com/nulvless/examples holds ready-made functions, apps and templates, and the CLI installs them for you:
nulvless examples # list them
nulvless functions new whoami --template verify-session # one function into the workspace
nulvless create my-app --example auth-nextjs # a whole new projectAfter installing a function that needs secrets, the CLI prints the
secrets set commands to run once it is deployed.