Skip to content

Roadmap: large, data-heavy apps

Karni today fits apps with tens of models, a React staff app and a public site. Large apps go further: a hundred or more models, deep hierarchies (disease areas, product taxonomies), access granted node by node and user by user, analytics dashboards, and mobile clients that sign in with Google or Apple. Each of those is written by hand in every such project today. This plan moves them into Karni, item by item, so an agent writes only the domain.

The plan follows Karni's rules. Anything with a meaningful RAM cost or a separate service is a module in modules/, not core. Every abstraction has an escape hatch. A public API change goes through the deprecation cycle in the stability promise. The decisions in ADR 0001 and ADR 0002 still hold: one tenant per deployment, access declared on every viewset with its closed vocabulary, 404 for a row out of scope and 403 for a row readable but not writable, soft delete in BaseModel, and the query budgets.

Items

Status is one of planned, in progress or done. A dependency means the item cannot start before the item it names is done.

Phase 1: blockers

Item Goal Depends on Status
1a Social sign-in by ID token in JWT mode: a mobile or single-page client sends a Google, Microsoft or Apple ID token and gets Karni's token pair. none done
1b Email one-time-code login: sign in with a six-digit code sent by email, no password. none done
1c A versioned terms acceptance gate: the API refuses a signed-in user until they accept the current terms version. none done
2 Integer primary keys as an option, next to UUIDs, working everywhere a key appears. none done
3 External and read-only tables, SQL views and a second database, as models Karni accepts. none done

Phase 2: data and access

Item Goal Depends on Status
4 Tree models: a mixin with cycle-safe recursive queries, tree endpoints, a tree view and a tree select. none done
5 A tree:<field> access scope: a grant on a node covers every row tagged with it or with a node under it. 4 done
6 Per-user grants: access granted to one user, with targets and an expiry, alongside role grants. none done
7 Taxonomy tagging: one declaration tags a model to a tree, with filters, facet counts, import columns and the access scope. 4, 5 done
8 Aggregation endpoints and saved charts: grouped counts and sums under the list's filters and access, and charts defined in the admin. none done
9 Response caching to stable: keys that never mix access scopes, invalidation derived from relations, and an admin screen. none done
10 Cross-model search: one ranked search endpoint over every model that opts in, with access applied per model. none done

Phase 3: pages for large apps

Item Goal Depends on Status
11 Page blocks beyond CRUD in @karni/ui: dashboard grid, chart card, accordion, markdown view, data table, comparison table and related tabs. none done
12 Markdown fields, field groups and column sets, so a model with 100+ columns still has usable forms, detail pages and tables. none done
13 Navigation from data: a menu each user gets from their roles and grants, edited in the admin. 6 done

Phase 4: scale and production

Item Goal Depends on Status
14 Tooling for 100+ models: scoped context, incremental checks, volume seeding, query plans and a CI benchmark. none done
15 Optional modules: reports (PDF), ai (structured extraction) and storage (S3). none done: 15a (reports), 15b (ai) and 15c (storage)
15a The reports module (karni add reports): a row printed to PDF from a template in a Celery task, cached by template and data, served only to users who may retrieve the row, with pre-generation, an admin and @karni/reports-ui. none done
15b The ai module (karni add ai): structured extraction from a text, a web page or a PDF by a language model, into rows that follow the resource's own schema, always through the import preview, with call logs, token budgets and @karni/ai-ui. none done
15c The storage module (karni add storage): protected file fields served only through the row's own viewset by a signed URL, provider presets for AWS, R2, MinIO, Spaces, B2 and GCS, direct uploads with a confirm step, thumbnails and @karni/storage-ui. none done
16 Production proof: a CI job that boots the Docker stack end to end, health and readiness endpoints, API versioning and a deploy guide. none done, except the README's production-readiness answer, which changes after the first green CI run

Then: the reference app

Item Goal Depends on Status
17 A medical-intelligence reference app (examples/medintel) that uses every item above, with synthetic data and a friction log. 1a to 5 to start, then each later item done

Notes on the order:

  • Item 6 designed the interface item 5 builds on: karni.accounts.grants.scope_targets(user, scope, permission=...) gives the target ids a user's role grants and user grants hold under a scope, with the grant behind each. A tree scope adds itself to TARGETED_SCOPES, and item 13 reads the same function.
  • Item 13 stores the database menu as a tree model (item 4's OrderedTreeModel), in the karni.navigation app a project installs only for that source. Settings alone work without it. It reads grants_for, the union of role and user grants that Granted() reads.
  • Item 6 uses the Can("area:action") slot that ADR 0001 reserved for a grants tier. Declarations written with HasRole keep working.
  • Item 8's saved charts and item 15's three modules are modules (karni add charts, karni add reports, ...). Core never imports them.
  • Item 16 overlaps the production stack 0.4.1 adds (karni make deploy compose and its CI job). It extends that work and does not repeat it.

Definition of done

Every item meets all of these before it counts as done.

  • It follows the repository rules and the patterns already in the code. Type hints, ruff, mypy and pytest in Python, strict TypeScript with no any and Vitest in the UI. An escape hatch for every abstraction, and no abstraction without three real uses.
  • New public names start as experimental. They follow the experimental tier of the stability promise: marked Experimental. in the docstring, by an Experimental note in the docs and by Experimental tier in the reference, free to change in a minor release with a CHANGELOG entry, and stable once a reference application uses them.
  • It is tested. Unit and integration tests, plus an assert_* helper or a karni check rule wherever there is a misuse to catch.
  • It is documented. A docs page or section, docs/REFERENCE.md regenerated with scripts/gen_reference.py, a CHANGELOG entry (and a changelog TOML entry when a project must change), and the agent rules updated with karni rules sync when agents need to know.
  • Everything passes. The full test suite on SQLite and PostgreSQL and karni check pass, and the examples are updated when they use the feature.
  • One branch per item. Nothing is pushed and no pull request is opened until the owner asks.
  • The private app stays private. The app whose needs motivated this plan is never named, linked or copied anywhere: code, data, docs, tests or commits. Its code may be read as a reference, never quoted.