CLI and Generators
The semitra CLI is the operational entrypoint for Semitra applications.
Core commands
Section titled “Core commands”The current CLI supports:
semitra new [name]semitra dev [app-root|workspace-root]semitra console [app-root]semitra migrate [app-root]semitra db:migrate [app-root]semitra deploy [app-root]semitra test [app-root]semitra codegen [app-root]semitra generate <type> <name>
What each command does
Section titled “What each command does”newcreates a new Semitra workspace withapps/apiandapps/web.devruns the local Cloudflare dev environment. In a generated workspace root, it runs bothapps/apiandapps/webconcurrently.consolestarts a REPL with the generated app and registries loaded.migrateapplies pending D1 migrations through the configured binding.deployruns remote migrations and then deploys the Worker.testprepares the app and runs Bun tests.codegengenerates the Semitra manifest and bootstrap.generatecreates conventional framework files.
Generators
Section titled “Generators”The built-in generators include:
modelcontrollerpolicyresourcejobchannelmailermailbox
New workspace output
Section titled “New workspace output”semitra new [name] creates the opinionated full-stack shape:
apps/ api/ web/apps/api is the Semitra Worker backend. apps/web is the React Router 7,
Vite, and Tailwind frontend with a centralized API client in
apps/web/app/lib/api.ts and frontend models in apps/web/app/models.
App-root resolution
Section titled “App-root resolution”If you omit [app-root], the CLI resolves:
- the nearest Semitra app
- or the single app inside
./apps
A Semitra app root is defined by convention. It must contain both
config/routes.ts and src/index.ts.
For semitra dev, a generated workspace root containing apps/api and
apps/web is treated as a full-stack dev target before app-root fallback.
Workspace commands in this repository
Section titled “Workspace commands in this repository”From the repository root:
bun run codegenbun run devbun run migrate:localbun run migrate:remotebun testbun run docs:devbun run docs:buildThe docs scripts target the Astro/Starlight site in apps/docs.
Example workflow
Section titled “Example workflow”A typical CLI flow for a new Semitra app looks like this:
semitra new support-portalcd support-portalsemitra generate model Postsemitra generate controller Postssemitra generate policy Postsemitra generate resource Postsemitra codegen apps/apibun run migrate:localbun run devbun run dev delegates to semitra dev, which starts the generated API and
frontend together. You can still run either side directly when needed:
bun run dev:apibun run dev:webAfter the local app is working, the usual next steps are:
bun run test:apibun run build:webbun run deploy:apiThat workflow matches the framework’s conventions: generate conventional files, regenerate the manifest, apply migrations, run the Worker locally, then test and deploy.