@ungic/cli
v0.7.0
Published
The ungic CLI for a Site as code: ungic dev (CMS + admin + app frontends built live from the theme, restarts on change), ungic build (typecheck, function contract, migrations check, production bundle, app frontends), ungic start, ungic migrate.
Readme
@ungic/cli
The ungic command: runs, builds and deploys an ungic Site — ungic.base.ts (the data model, rules, sign-in,
admin layout, functions, apps) and ungic.config.ts (your configuration over it). Start a Site with
npm create @ungic my-site.
ungic dev run the Site for development: API, admin and apps on one port, restarted on change
ungic build check the Site and bundle it for production into dist/
ungic start run the production build (dist/server.mjs)
ungic migrate write, apply and inspect migration files: plan | apply | status
ungic owner create the Site's first owner: the admin account that invites the rest of the staff
ungic keys rotate re-encrypt the stored secrets after a site-key rotation
ungic functions pin follow the base's functions with your replacements
ungic adopt turn a standalone-source export of the ungic builder into a theme projectungic <command> --help prints a command's options. Every command reads .env in the Site's folder (variables
already set win) and takes --config <file> (default ./ungic.config.ts).
- dev runs the content API (
/api), the admin (/admin/, with your pages and field editors fromadmin/) and the apps on one port, and restarts the CMS when the config, the base, server code, a migration or.envchanges. Database:DATABASE_URL, else PGlite in.ungic/pglite(--memoryfor a throwaway one). Safe schema changes are applied by themselves; a risky one is refused with its fix. - build fails, with the fix, on what would fail in production — TypeScript, the config, the function contract
(every
mock: truefunction of the base replaced inungic.config.ts), a schema change without a committed migration — then writesdist/:server.mjs(a Node server),handler.mjs(a fetch handler for serverless hosts), the apps built fromtheme/, your admin pages.--vercelalso writes the Vercel function andvercel.json. - start runs
dist/server.mjsin production mode: only committed migration files are applied, and any other difference between the database and the schema refuses the start. NeedsDATABASE_URL(orPGLITE_DIRfor one instance on a persistent disk). - migrate
planwritesmigrations/<NNNN>_<name>.tsfrom the schema change,applyapplies pending files (what a production start does),statuslists them.
The apps built from theme/ need @ungic/web (an optional peer: the projects the ungic builder exports list it;
npm i @ungic/web otherwise).
ungic dev runs as two processes: the one you started owns the port and serves the apps built from theme/ (Vite,
HMR); the CMS runs in a child on an internal port (127.0.0.1, random) that is restarted on change, and everything that
is not such an app (/api, /admin, prebuilt frontends) is proxied to it.
Documentation
- CLI reference: every command and option.
- Getting started · Migrations · Deployment
- Functions and hooks (the function contract
ungic buildchecks) - Apps built from theme/ (server rendering, prerendered pages)
- Ungic CMS documentation.
License: Apache-2.0.
