Skip to content

CLI Reference

Command overview

bash
zeptoz init <project>
zeptoz collection create <name> [fields...] --id-strategy <int|uuidv4|uuidv7|ulid|nanoid>
zeptoz collection policy set <name> [--list-policy ...] [--view-policy ...] [--create-policy ...] [--update-policy ...] [--delete-policy ...]
zeptoz relation add <collection> <name> <belongs_to|has_one|has_many|many_to_many> <target> [options]
zeptoz hook add <collection> <event> --lang <rs|js|ts>
zeptoz dev --project-root .
zeptoz deploy --project-root . --output ./dist

zeptoz init

Initialize a new Zeptoz project directory.

Generated files/DB side effects are documented in Bootstrap & Generated Artifacts.

Option / ArgDefaultValues / FormatDescription
<project_name>nonedirectory nameProject directory to initialize.
--dry-runfalseswitchPrint planned file/DB actions without writing.

zeptoz collection create

Create a collection schema and database table.

Generated files/DB side effects are documented in Bootstrap & Generated Artifacts.

Option / ArgDefaultValues / FormatDescription
<name>nonecollection nameCollection name to create.
[fields...]emptyname:type[:modifier...]Field definitions.
--id-strategyintint, uuidv4, uuidv7, ulid, nanoidRecord ID strategy for this collection.
--with-hooknone<event>:<lang>:<name>One-shot hook scaffold + binding during collection create.
--list-policynonepolicy expression or nullOptional list Access Policy for this collection.
--view-policynonepolicy expression or nullOptional view Access Policy for this collection.
--create-policynonepolicy expression or nullOptional create Access Policy for this collection.
--update-policynonepolicy expression or nullOptional update Access Policy for this collection.
--delete-policynonepolicy expression or nullOptional delete Access Policy for this collection.
--dry-runfalseswitchPrint planned DB/filesystem actions only.

zeptoz collection policy set

Update Access Policies on an existing collection.

Generated files/DB side effects are documented in Bootstrap & Generated Artifacts.

Option / ArgDefaultValues / FormatDescription
<name>nonecollection nameCollection name to update.
--list-policyunchangedpolicy expression or nullSet/clear list Access Policy.
--view-policyunchangedpolicy expression or nullSet/clear view Access Policy.
--create-policyunchangedpolicy expression or nullSet/clear create Access Policy.
--update-policyunchangedpolicy expression or nullSet/clear update Access Policy.
--delete-policyunchangedpolicy expression or nullSet/clear delete Access Policy.
--dry-runfalseswitchPrint planned DB changes only.

zeptoz hook add

Register and optionally scaffold a hook for a collection event.

Generated files/DB side effects are documented in Bootstrap & Generated Artifacts.

Option / ArgDefaultValues / FormatDescription
<collection>nonecollection nameTarget collection name.
<event>nonehook event stringLifecycle event to bind (for example before_insert).
--langnoners, ts, js, pyHook language alias.
--sourcenonefile pathUse an existing source file.
--newnonehook nameScaffold a new hook source file.
--dry-runfalseswitchPrint planned writes/DB inserts only.

Notes:

  • --source and --new are mutually exclusive.
  • For TypeScript hooks, Zeptoz writes hooks/_sdk/types.d.ts for typing support.

zeptoz relation add

Create relation metadata and supporting database structures.

Option / ArgDefaultValues / FormatDescription
<collection>nonecollection nameSource collection.
<name>nonerelation nameRelation identifier used in API payload/filter/expand.
<kind>nonebelongs_to, has_one, has_many, many_to_manyRelation cardinality.
<target>nonecollection nameTarget collection.
--fk-column<name>_idfield nameFK field for belongs_to/has_one. Ignored for has_many/many_to_many.
--vianonerelation nameRequired for has_one/has_many. Must point to target-side belongs_to relation name.
--throughrel_<collection>_<name>table nameOptional for many_to_many. If omitted, Zeptoz auto-generates through table name and FK columns (<collection>_id, <target>_id).
--on-deleterestrictrestrict, cascade, set_nullUsed for belongs_to/has_one when deleting referenced target records.
--on-updaterestrictrestrict, cascade, set_nullUsed for belongs_to/has_one reassignment checks on patch/update.
--requiredfalseswitchFor belongs_to/has_one, relation value is required on create and FK is non-nullable.
--autononeauth.id / request.path.* / request.query.* / literal:*Declarative auto-assignment source for belongs_to/has_one.
--strictfalseswitchOnly with --auto: always override client-provided relation value.
--mutable-after-createfalseswitchOnly with --auto: allow reassignment after create (default is immutable).
--dry-runfalseswitchPrint planned DB changes only.

zeptoz dev

Run Zeptoz in development mode.

Option / ArgDefaultValues / FormatDescription
--project-root.pathProject root containing zeptoz.toml.

zeptoz deploy

Build deployment artifacts from a project.

Option / ArgDefaultValues / FormatDescription
--project-root.pathProject root containing zeptoz.toml.
--output./distpathOutput directory for artifacts.
--target<os>-<arch>target labelTarget triple label used in artifact naming.
--manifest-onlyfalseswitchWrite runtime manifest only, skip tarball creation.
--dry-runfalseswitchPrint planned file operations only.

Examples

bash
zeptoz collection create Task title:string:required done:bool:default=false --id-strategy uuidv7
zeptoz collection policy set task --view-policy "@record.owner_id = @request.auth.id"
zeptoz relation add task owner belongs_to users --required --auto auth.id
zeptoz relation add comment post belongs_to post --on-delete cascade
zeptoz hook add Task after_insert --lang ts --new notify