Features¶
Every feature Karni ships, grouped by what you need, with a link to the page
that explains it. The status lists, the
modules, the commands and the
make targets at the end are generated from the source by
scripts/gen_reference.py, and CI fails when this page misses a page of the
Reference or Debugging sections.
Start fast¶
- Quickstart: from an empty folder to a running app with demo data, run verbatim by CI.
- Recipes: six ready apps built by
karni new --recipe: an online shop, booking, a CRM, online courses, a marketplace and a data portal. - The app spec,
karni.yaml: the app in one small file, withkarni spec validate,karni plan, its questions andkarni build. - The
karnicommand: every command and option, fromkarni newtokarni upgrade. - Settings: one
karni_settings(globals())call, driven by the environment and validated at startup. - Demo data:
karni seedfills every table with realistic, connected rows and prints a demo login. - Demo mode (experimental): put a project online for anyone to try. One demo login per role, a write rule that lets only those accounts write, a reset every N hours, one boot command and the sign-in notice, from settings.
- Real content:
karni loadreads a JSON or YAML file by natural key, in one transaction. - A public website: server-rendered pages at
/, every text and image editable in the admin. - From a design to content: a designer's static pages become models and real rows.
- Tutorial: EventHub and adding an entity end to end: a whole app, step by step.
Data and access¶
- Models:
BaseModelwith a UUID key, timestamps, soft delete and audit fields, integer keys, external tables and SQL views, tree models and taxonomies. - Typed fields: money, percent, quantity, phone, country, currency, markdown and more, with rules the database enforces.
- Lifecycle and capacity: declared states and transitions, capacity that never oversells, no-overlap constraints.
- Rules (experimental): bounds, unique among live rows, which rows a relation may point at, frozen fields, delete rules, what a state change needs and stamps, and row actions with the states and roles where each is legal, declared in karni.yaml.
- The API:
BaseViewSetwith a requiredaccessrule, generated serializers, filters, search,?expand=, query budgets and the OpenAPI schema. - Permissions at the queryset: one row filter for list, detail, relations and expansion, so a row outside your scope is a 404.
- Accounts: email sign-in, the auth endpoints, roles as data, per-user grants, two-factor and social login.
- Change history: who changed which field from what to what, in the admin, the API and the UI.
- Events and listeners: react to model changes from
listeners.py, inline or queued to Celery. - Family events (experimental): one app reacts to another by an event's name, through an outbox written in the writer's transaction and delivered after the commit, with retries.
- Scheduling: periodic and background work in
schedules.py, run by Celery beat and workers.
Large apps¶
- Aggregations: counts, sums and averages at
<resource>/aggregate/by category, relation or date. - Search across models:
GET /api/search/with access applied per model, and a command palette. - Navigation from data: each user's menu, opened by the same roles and grants as the API.
- Several recipes in one project (experimental):
karni recipes add,removeandupgrade, parts under their own routes, roles named<prefix>-<role>, one currency, and what each part requires installed with it. - People: one person and one organisation record for every part of a project, found or created by email, merged with a preview, erased on request, with person facts in SQL (experimental).
- Timeline: one stream of moments per person and per record, written from family events that declare a title or by hand, and shown only to callers who may read every record an entry is about (experimental).
- Notifications: message kinds sent to an email, the recipient's inbox in the app or both, emails a business edits, each person's own switches, unsubscribing from marketing emails by a signed link, and one sender (experimental).
- Preferences: the business's details, one settings section per part, values a deployment locks, connections that switch on when what they need is installed, and email switches, behind one Settings API (experimental).
- Import and export: CSV and XLSX from any list, and uploads with a mandatory dry run.
- Large projects:
karni contextone area at a time, a cachedkarni check, volume seeding and query plans for 100 models or more.
Admin¶
- The admin: every model registered with derived columns, filters, search, pagination and bulk edit, with no
admin.py. - Row scope and field visibility: the admin opens rows and fields by the same rules as the API.
- Saved charts: charts defined and previewed in the admin, served under each resource's access (a module).
UI¶
- @karni/ui:
ResourceTable,ResourceFormandResourceDetailfrom the OpenAPI schema, the app shell, sign-in pages, page blocks and hooks. - Theming:
karni ui detectmaps your design system's theme onto Karni's tokens and primitives.
Modules¶
- The module contract: one command to add a module, one to remove it, and the catalog every module describes itself in.
- PDF reports, AI extraction, protected files, commerce, games (with the game API a game client codes against, and the browser side) and the other modules: each a separate package for anything with its own service or a real memory cost.
Build games¶
- A game project (experimental):
karni new "Block Hopper" --kind gamemakes a game first, a small game you can play ingame/block-hopper/, served at/play/block-hopper/, with its server declared incontent/game.yaml, the admin, and a package per game portal withnpm run package.--kind app+gameputs the game on a page of an app, where a guest keeps their progress by signing in. - Game starters (experimental):
karni new "Sky Dash" --kind game --genre runnerwrites a complete one-tap runner on every layer of@karni/game: a seeded endless track with replay-checked scores, loading, title, play, pause, game-over and shop scenes, parallax and particles, procedural sound, settings and touch buttons, save slots, a daily run with its own board, trails and hats bought with coins, and an ad continue. Its rules, determinism, fuzz, browser smoke and server tests come with it, andkarni starters list --matchfinds the starter for a one-line request. - The server side, karni-game (experimental): guest players with a token the server issues, cloud saves with a version counter, leaderboards with plausible ranges, a soft-currency wallet with a ledger, rewards and a shop, daily content on the server's date, achievements and missions, remote config and analytics, decided on the server.
- The browser side, @karni/game (experimental): a canvas loop with a fixed step, input, audio, saves on the device, a seeded random generator, a simulation contract with a recorder, replay, a state hash and a test kit, scenes with overlays and transitions, a DOM UI kit (settings, pause, dialogs, toasts, touch buttons, a boot failure screen), an asset loader (groups, progress, unloading, WebP copies, size budgets), procedural sound (one-shots, music, ducking), an offline-first data client, per-portal builds with checks, adapters for Poki, CrazyGames, GameDistribution and Y8, adapters for Phaser, PixiJS and React Three Fiber, and a browser smoke harness.
- Drawing, @karni/game/draw (experimental): a light 2D layer on Canvas 2D: layers in order, a camera that follows, shakes and zooms, shapes, text, sprites and frame animation, tweens, pooled particles, and time scale and hit-stop on the loop.
- Collision, @karni/game/collide (experimental): boxes and circles, overlap and sweep tests, a ray cast, a box mover with one-way ledges, and trigger zones.
- The game API (experimental): the HTTP contract a game client, a realtime server of your own and a portal's server call.
- A game inside an app:
examples/hybrid-demo, an app whose members play a game as their accounts, with a leaderboard page and the game in the admin.
Coding agents¶
- Karni for coding agents: AGENTS.md from one rule set,
karni context,karni rules, the procedures and the MCP server. - The /new-app flow: from a one-line request to a running app, through
karni.yamlandkarni build. - Building with an agent and without one: the same project, both ways.
- Enforcement:
karni checkand the ESLint preset fail the build when code rebuilds what Karni ships, with an inline opt-out and a reason (why). - Error codes: every code with its cause and fix, offline through
karni explain <code>. - Coding-agent benchmark: three apps built by a coding agent on plain Django + React and on Karni, with the method and the raw data.
Debugging¶
- Request ids and capture: one id across requests, tasks, email and webhooks.
- Trace, replay and failure briefs:
karni trace,karni replayandkarni explain --failure. - Explain a traceback:
karni explainnames the failure in a pasted traceback, with the fix. - Find an N+1:
karni queriesreports every SQL query of one endpoint and the fix. - Why is it missing?:
karni whysays why a row, field or action is refused for a user. - Measured: three seeded bugs: the debugging commands tried on real bugs.
Production¶
- Deploying to a server: the production Docker Compose stack with Caddy and automatic TLS,
karni check --deploy, backups, restore and health checks. - Security: safe defaults, the security headers and the deploy checks.
- Testing:
assert_crud,assert_isolatedandassert_pages, query budgets and the architecture rules. - Stability promise: what is public API, the deprecation cycle, and
karni upgradewith its codemods. - The reference: every command, base class, setting, component, hook, module and error code, generated from the source.
Status of every capability¶
stable: public under the stability promise and used by a
reference application. experimental: public and covered by Karni's own
tests, not yet used by a reference application. planned: documented as
coming, not in the code. Each capability's evidence is in the
reference.
Models¶
stableBaseModel: UUID key, created and updated timestamps, soft delete,created_byandupdated_byexperimentalBigIntBaseModel: the same base on a 64-bit integer key, chosen per model (karni make model --pk bigint,KARNI_PK), with legacy ids in imports andkarni load, andkarni.W530for a public resource. Experimental tierstableRealistic, connected seed data (karni seed,<app>/seeds.py)experimentalReal content from a JSON or YAML file, created or updated by natural key (karni load)experimentalModels and real rows from a designer's pages: the repeated content, its fields and relations (karni design analyze,karni design extract)stableModel events and listeners, optionally queued to Celery (@on_updated)experimentalFamily events with an outbox:declare,publishin the writer's transaction,subscribeby name, delivered after the commit with retries and a sweep (karni.outbox). Experimental tierstableField-level change history (class Karni: audit = True)experimentalScheduled tasks (<app>/schedules.py,karni schedule)experimentalExternal tables, SQL views and a second database as models Karni reads (class Karni: external,writable,database,karni make model --external). Experimental tierexperimentalTree models:TreeModelandOrderedTreeModelwith cycle-safe walks (roots,children,ancestors,descendants,subtree_ids),move_to()anddelete_branch(), and the tree changelist in the admin. Experimental tierexperimentalTaxonomy tagging: one declaration tags a model to tree models (class Karni: taxonomies), a generated or adopted many-to-many per key, import and export columns by natural key, and thetree:<key>scope. Experimental tierplannedA tenant scope on every model (thekarni-tenancymodule)experimentalThe people contract (karni.people,KARNI_PEOPLE): one person and one organisation record for every part of a project,people.resolveby account or email, the account linked once its email is verified, person facts in SQL, duplicates, merge with a preview and hooks, erase on request,/api/people/. Experimental tierexperimentalThe timeline contract (karni.timeline): one stream of moments per person and per record,timeline.recordby hand, entries from family events that declaretimeline=,GET /api/timeline/with each entry checked against the row scope of every record it is about, cursor paging, retention. Experimental tierexperimentalThe preferences contract (karni.preferences): the business's details, one settings section per part as a Pydantic model,preferences.value(path, default)with a typed default, locks a deployment fixes, connections and email switches, audited changes,/api/preferences/behind the Settings page. Experimental tierexperimentalThe notifications contract (karni.notify): message kinds onkarni.mailsent to an email, the inbox or both,notify.sendto users, people or addresses, emails a business edits (/api/email-templates/), the inbox API with retention, each person's switches, unsubscribing from marketing kinds by a signed link. Experimental tier
Base classes: AuditedModel, BaseModel, BigIntBaseModel, GuardedModel, IntegerKeyModel, OrderedTreeModel, SoftDeleteModel, TimestampedModel, TreeModel, UUIDModel.
API¶
stableBaseViewSet: CRUD, filters, search, ordering, pagination,?expand=and the OpenAPI document, with no serializerstableaccessdeclarations (Public,Owned,HasRole,Where,Granted) compiled into both the request gate and the row filterstableQuery budgets: a list endpoint that runs more queries than declared fails its teststableCSV and XLSX export of any list (/export/?format=)stableImport from CSV or XLSX with a mandatory preview (/import/)stableResponse caching per viewset (Cache,Uncached,KARNI_API_CACHE): entries shared only by callers with the same access, invalidated on every write,X-CacheexperimentalRows of any resource read from text, a web page or a PDF by a language model, always through the import preview (karni add ai,POST /api/ai/extract/, usage, costs and budgets). Experimental tierexperimentalSign-in with a Google, Microsoft or Apple ID token in JWT and session mode (social/<provider>/,KARNI_SOCIAL_TOKEN_PROVIDERS). Experimental tierexperimentalSign-in with a one-time code sent by email, in JWT and session mode (otp/send/,otp/verify/,KARNI_EMAIL_OTP). Experimental tierexperimentalA versioned terms acceptance gate: 403E245under/api/until a signed-in user accepts the current version (terms/,terms/accept/,KARNI_TERMS). Experimental tierexperimentalDemo mode (karni.demo): demo accounts with one login per role, a write rule that lets only those accounts write, a reset to a fixed seed every N hours under a lock,manage.py karni_demo_bootandGET /api/demo/(KARNI_DEMO_MODE,KARNI_DEMO_ACCOUNTS,karni.E950toE954). Experimental tierexperimentalTree endpoints on a tree model's viewset (tree/,children/,ancestors/,move/,?parent=,?descendants_of=,DELETE ?branch=true) andx-karni-treein the OpenAPI document. Experimental tierexperimentalTaxonomy filters and counts:?<key>=and?<key>_descendants=on the list,facets/(rows per node under the list's filters and access, rolled up on request) and a tree node'stagged/per tagging model. Experimental tierexperimentalSearch across models: one rankedGET /api/search/over every model that declaresclass Karni: search, each under its own list access, one query per model, with the trigram indexes in its migrations (karni.W590). Experimental tierexperimentalPDF reports of a row (thereportsmodule): a template rendered in the background with WeasyPrint, cached by template and data, served only to users who may retrieve the row (/api/reports/<report>/<id>/,ReportButton). Experimental tierexperimentalProtected files (thestoragemodule): kept in a private S3-compatible bucket or on disk, downloaded only through the row's own viewset by a signed URL, with direct uploads and thumbnails (ProtectedFileField,<resource>/<id>/files/<field>/). Experimental tierstableTypeScript types and typed hooks from the OpenAPI document (karni types)experimentalGrouped counts and sums under the list's filters and access:GET <resource>/aggregate/fromclass Karni: aggregate, with date buckets, top N and Other, a second dimension and numbers stored as text (TextNumber). Experimental tier
Declarations: Access, Authenticated, Budget, Cache, Can, Granted, HasRole, Matching, Owned, Public, RowAction, Scaling, Throttle, Uncached, Unpaginated, Unscoped, Where.
Admin¶
stableEvery model registered with derived columns, filters and search, with noadmin.pyexperimentalRow scope from the roles' grants: a staff user sees and edits only the rows a grant allowsexperimentalField visibility, change history and the import and export screensexperimentalA permission matrix of every role against every model and action
UI components and hooks¶
stableResourceTable,ResourceFormandResourceDetaildriven by the OpenAPI schemastableSign-in, session restore and role checks (AuthProvider,LoginForm,usePermission)stableData hooks with shared caching (useResourceList,useResourceItem)stableImport screen with column mapping and preview (ResourceImport)stablePage building blocks:Page,Layout,Stat,Modal,Toaster,EmptyStateexperimentalChangeHistory,DataChartandFileUploadexperimentaluseAggregateandDataChart'saggregateandstacked: a resource's aggregate, read directly. Experimental tierexperimentalSocialButtonanduseSocialLogin: sign-in with an ID token from the provider's own SDK. Experimental tierexperimentalOtpLoginFormanduseOtpLogin: sign-in with a code sent by email, also asLoginForm'scodeSignInswitch. Experimental tierexperimentalGlobalSearchanduseGlobalSearch: a Cmd or Ctrl+K command palette over search across models, grouped per resource, each hit linking to its ResourceDetail page (<Layout search>). Experimental tierexperimentalTermsGateanduseAuth()'stermsRequiredandacceptTerms: the app renders once the user accepts the current terms. Experimental tierexperimentalDemoNotice,DemoSignInPromptanduseDemo: the demo accounts of a demo-mode server above the sign-in form (GET /api/demo/). Experimental tierexperimentalTreeView,TreeSelect(used byResourceFormfor a relation to a tree) andTreeBreadcrumb(onResourceDetailof a tree), withuseResourceTree. Experimental tierexperimentalLayout's server menu (navSource="server",useNavigation): collapsible groups, icons by name and the current page marked. Experimental tierexperimentalFacetPanelandResourceTable'sfacets: rows per node of a taxonomy, and choosing nodes filters the table, withuseResourceFacets. Experimental tierexperimentalkarni ui detect: the project's shadcn/ui, Tailwind, Material UI, Chakra UI or Mantine theme, or any stylesheet (--css), as Karni's tokens, and shadcn/ui components as Karni's primitivesexperimentalDashboard(the staff app's home page fromKarni.dashboard) andResourceDetail's buttons for aStateField's transitionsexperimentalPage blocks beyond CRUD:DashboardGrid,ChartCard,DataTable(computed rows: sorting, a sticky header and first column, CSV and XLSX export, only the rows in view rendered),ComparisonTable,Accordion,MarkdownView(sanitized, loaded on first use) anduseResourceCounts. Experimental tierexperimentalResourceDetail's related tabs (related): a table per reverse relation, from thex-karni-relatedextension of the OpenAPI schema. Experimental tierexperimentalWide models:MarkdownField(edited with a preview, shown sanitized),class Karni: field_groups(form and detail sections or tabs, admin fieldsets) andcolumn_sets(table presets kept per user), withkarni.E550toE553. Experimental tier
99 components and 40 hooks, among them ResourceTable, ResourceForm, ResourceDetail, ResourceSelect, ResourceImport, AuthProvider, AuthGuard, LoginForm, Page, Layout, ResourceGrid, ResourceBoard, ResourceCalendar. The hooks are useDelayedFlag, useOnlineStatus, useTheme, useKarniPrimitives, useUnsavedChangesGuard, useResourceTree, useResourceChildren, useResourceAncestors, useResourceAccessForest, useTreeMutations, useResourceFacets, useChangeHistory, useImportDescribe, useImportJob, useImportActions, useResourceList, useResourceItem, useResourceMutations, useResourceCounts, useAggregate, useGlobalSearch, useKarniClient, useResourceSchemaIfKnown, useSchema, useAuth, useDemo, usePermission, useSocialLogin, useOtpLogin, useNavigation, useToast, useDashboardTiles, usePageMeta, useAudience, useBusiness, useSiteName, useTimeline, useInboxUnread, usePersonFacts, useMenu.
Permissions¶
stableOneaccessdeclaration per viewset: 404 outside the read scope, 403 for read-but-not-writestableRoles as data (KARNI_ROLES) with theallandownscopesexperimentalTherelated:<key>scope (class Karni: scope_paths) andcustom:scopesstableMembership through a path:owner_field = "workspace__members"stableScope paths that do not resolve failkarni check(E214) instead of answering 500experimentalPer-user grants next to the role grants: a pattern and a scope for one user, with targets and an expiry, in the admin and an API (UserGrant,KARNI_USER_GRANTS). Experimental tierexperimentalThe tree scope: a grant on a node of a tree reaches every row under it (tree:<path>inKARNI_ROLESand user grants, one subtree subquery, theaccess/forest,TreeView'saccess). Experimental tierexperimentalNavigation from data: each user's menu fromKARNI_NAVIGATIONor aNavItemtree edited in the admin, opened by the same role and per-user grants as the API (GET /api/navigation/). Experimental tierexperimentalField visibility per role (class Karni: field_roles)experimentalRow scope in the admin, from the same grants as the APIstableChange history: who changed which field, when, from what to whatexperimentalSensitive fields recorded in the history without their valuesexperimentalMaker-checker approvals and safe impersonation (theapprovalsandimpersonationmodules)plannedTenancy: a tenant scope applied to every model
Agent integration¶
stablekarni context,karni rulesandkarni checkin the project workflowstableAGENTS.md, the one agent file, generated from the rule set (karni rules sync)stableProcedures for the routine tasks (new-model,new-page, …), listed in AGENTS.md:karni rules --procedure <name>, or/<name>in a requestexperimentalkarni explain <code>: why an error happens and the fix, offlineexperimentalThe app spec,karni.yaml, with a published JSON Schema:karni spec validate(every problem with its code and line),karni spec export(the spec of an existing project) andkarni plan(whatkarni buildwould change, risky changes with their row counts). Experimental tierexperimentalClarifying questions:karni plan --questionslists the few gaps ofkarni.yamlworth asking the user (owners, access, the sign-up role, the kind, each module's and feature's asks), chosen by fixed rules, andkarni spec answerwrites an answer keeping the file's comments. Experimental tierexperimentalkarni build: the spec applied in one command, idempotently. Karni's code in files of its own (<app>/karni/), the project's created once and never rewritten, a hand edit found by its sha256 (.karni/build.json), then migrations, seed, types, tests andkarni check. Experimental tierexperimentalSpec pages beyond CRUD: a detail page's related tabs and dashboard pages of charts, inkarni plan,karni build,karni spec exportandkarni make page. Experimental tierexperimentalThe module catalog: a manifest per module and built-in feature,karni modules listandshow, aCATALOG:line per entry inkarni context,karni addwiring from the manifest andkarni remove, which never drops data. Experimental tierexperimentalThe/new-appflow, from a one-line request to a running app: recipes (karni recipes list --match,show, thekarni.recipesentry points, the blank start), thenew-appprocedure and rule K311 in AGENTS.md, and the MCP toolsrecipes,spec_validate,questions,answer,plan,buildandmodules, each returning JSON with a published schema. Experimental tierexperimentalSix recipes,shop,booking,crm,lms,marketplaceanddata-portal, andkarni new "<Name>" --recipe <name>: the recipe's karni.yaml, thenkarni build, which writes the recipe's domain code, seeds and tests over its own stubs, never over the project's code, and runs the tests andkarni check. Each is built from scratch in CI. Experimental tierexperimentalkarni why/karni why-empty: why a row, field or action is refused or missing for a user, from the code that decides itexperimentalMCP server exposingcontext,rules,check,whyandwhy_emptyas toolsexperimentalLarge projects, one area at a time:karni context --summary,--app,--modeland--max-tokens, and akarni checkthat skips unchanged files (a cache per check and file,--changed [REF]for the files git reports). Experimental tier
Procedures: /new-model, /new-page, /add-module, /new-module, /site-from-design, /new-app.
Testing¶
stableassert_crudandassert_isolated: the whole API surface and owner isolation in two callsstableGenerated tests fromkarni make model … --with teststableOpenAPI snapshot test (assert_schema_snapshot)stableClients per role (client_as)experimentalquery_budgetanduser_with_roleshelpersexperimentalPerformance at volume:karni seed --volume(bulk rows that keep their relations), scaling row counts and a time budget per viewset (Scaling),karni queries --explainwith the index a sequential scan wants (PostgreSQL), and a CI benchmark on 100 models. Experimental tierexperimentalassert_pages: a public site's pages, their title, description, alt text and links, in one callstableArchitecture rules that fail the build (karni check, the ESLint preset)
Helpers: APITestCase, assert_admin_row_hidden, assert_crud, assert_events_declared, assert_isolated, assert_module_manifest, assert_pages, assert_row_hidden, assert_schema_snapshot, capture_events, client_as, create_external_tables, deliver_now, load_content, query_budget, user_with_roles.
Every module¶
Install a module, then karni add <name> wires it into settings, the URLs and
the agent files (the module contract).
experimentalkarni add ai: Rows for any resource read from text, a web page or a PDF by a language model, always through the import previewexperimentalkarni add approvals: A second person approves high-value changes before they are written, with a queue, an API and an audit trailexperimentalkarni add charts: Charts defined and previewed in the admin, served through each resource's aggregate action under its accessexperimentalkarni add commerce: One cart, checkout, orders, order numbers, payment settlement and refunds for anything a project sells, through a sellable adapter per kindexperimentalkarni add game: Guest players, cloud saves, leaderboards, a soft-currency wallet, daily content and achievements, with a realtime server contractexperimentalkarni add impersonation: Safe 'log in as user' for Karni support staff: an explicit permission, no privilege escalation, a banner, a time limit, both identities in the audit trailstablekarni add payments: Hosted checkout, refunds and signature-verified webhooks for Stripe and Razorpay, with a test provider for CIexperimentalkarni add reports: A row printed to PDF from an HTML template in the background, cached by template and data, served only to users who may see the rowexperimentalkarni add site: Every text, image and menu editable in the admin, public forms, redirects, and error pages that cannot failexperimentalkarni add storage: Files a row owns, in S3 or an S3-compatible service, served only to whoever may read that row, with direct uploads and thumbnailsplannedkarni-tenancy
Commands¶
Each command links to its entry in the reference.
| Command | What it does |
|---|---|
karni new |
Create a project: a public website, an app, both, or a game |
karni add |
Install an optional module and wire it into settings |
karni remove |
Take a module out again: what karni add wired, never its data |
karni modules |
The module catalog (experimental): every module and built-in feature, added or not, with what it provides and the questions to ask (list, show): list, show |
karni upgrade |
Upgrade across Karni versions: codemods, diff, manual-change report |
karni doctor |
Report the environment: project, interpreter, Node, adapters, history |
karni config |
Read and write Karni settings in the project's .karni/config.toml (committed) or, with --global, in ~/.config/karni/config.toml: get, set, list |
karni ui |
Fit Karni's components to the project's design system: detect |
karni context |
Print a compact machine-readable project inventory |
karni rules |
Karni's conventions for humans and AI agents (no Django needed): sync |
karni check |
Run architecture and system checks |
karni suggest |
What Karni could do that the project does by hand, with the fix of each |
karni explain |
Explain an error code (E104, C101, PAY004, K106), or a pasted traceback or log line (karni explain -): class, cause, where, fix |
karni types |
Generate TS types and typed hooks from the backend OpenAPI |
karni mcp |
Serve context, rules, check, the debugging tools and the app-builder flow (recipes, questions, answer, plan, build) as MCP tools (needs karni-cli[mcp]) |
karni queries |
Run one endpoint in-process as a user and report its queries |
karni serve |
Start the dev stack |
karni migrate |
Apply migrations |
karni test |
Run the test suite |
karni shell |
Open a Django shell |
karni routes |
List every URL with its methods, name, view, model and access |
karni schema |
Show every column, constraint and index, and the declaration behind each |
karni worker |
Run a Celery worker |
karni beat |
Run Celery beat |
karni schedule |
List and run the Celery beat schedules: list, run |
karni seed |
Fill every model with realistic demo data |
karni load |
Load real content from a JSON or YAML file |
karni sync-roles |
Create or update the roles KARNI_ROLES declares |
karni createsuperuser |
Create an admin user |
karni manage |
Run any management command |
karni why |
Explain an access decision: why a row, field or action is refused or missing |
karni why-empty |
Explain an empty list: which step removes the rows, and the fix |
karni make |
Generate project code: apps, models, viewsets, tasks, schedules, listeners, pages: app, model, viewset, serializer, migration, test, factory, seeder, task, schedule, event, listener, command, service, middleware, page, component, site, view, deploy, form, module |
karni import |
Import a designer's files into the project: design |
karni design |
Read a designer's pages: the models their content needs, and the content itself: analyze, extract |
karni spec |
The app spec, karni.yaml (experimental): check it (validate), write it from an existing project (export), or answer a question of karni plan --questions (answer): validate, export, answer |
karni plan |
Compare karni.yaml with the project: what karni build would change |
karni build |
Make the project match karni.yaml, without touching hand-written code |
karni trace |
Follow a captured request: its tasks, retries, email, webhooks, audit |
karni replay |
Re-run a captured request against the current code, as any user |
karni recipes |
Recipes (experimental): ready-made karni.yaml files a new app starts from, matched to a one-line request (list, show), and the parts of a project (add, remove, upgrade): list, show, add, remove, upgrade |
karni starters |
Game starters (experimental): ready games karni new --kind game --genre <genre> writes, matched to a one-line request (list, show): list, show |
Make targets¶
The Makefile of every new project:
make up # karni serve -d
make down # docker compose down
make serve # karni serve
make migrate # karni make migration; karni migrate
make types # karni types
make check # karni check; karni rules sync --check
make rules # karni rules
make agents # karni rules sync
make context # karni context
make test # karni test
make shell # karni shell
make routes # karni routes
make schedules # karni schedule list
make superuser # karni createsuperuser
make logs # docker compose logs -f django worker beat