- AiHomePage: move the Overview (KPI tiles) below Action Required, so the page reads Quick Launch -> Action Required -> Overview -> Recent Transactions. - krishtech-repairs.sql: capture this session's live kw.definition changes as idempotent SQL (task-first Home widgets+dashboard, report From-date defaults, raw-caption field hide/relabel, reqfq supplier hint) so the repo reproduces live. Verified idempotent against live (report/field blocks re-run as no-ops). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UnrQB3KMANKKnKu9MsPDcs
Qwenter
Qwenter is a modern, AI-native low-code platform that can take over from Axpert 11.2. It can adopt or migrate existing Axpert customers.
Repository layout
| Path | What it is |
|---|---|
docs/TECH_ARCHITECTURE.md |
Technical blueprint: stack, database layers, migration, VPS deployment, phases |
docs/AI_LAYER_DESIGN_NOTES.md |
AI agent, event/action model, SQL layer, audit engine |
packages/schema |
@kwenter/schema: metadata format (Zod) for forms, sections and fields |
packages/expr |
@kwenter/expr: expression engine (Axpert-compatible syntax), shared by browser and server |
packages/form-engine |
@kwenter/form-engine: headless form runtime (dependency graph, recalculation, lookups, validation) |
packages/query |
@kwenter/query: SQL parameter binding, read-only checks, LOOKUP compiler, database-backed DataProvider |
packages/store |
@kwenter/store: records in Axpert-shaped tables — load, list, save (server-side recalculation, validation, conflict check, grid row ids kept), audit trail in the kw schema |
packages/axpert-compat |
@kwenter/axpert-compat: decodes Axpert structures and converts them to Qwenter definitions |
packages/agent |
@kwenter/agent: the AI assistant (Claude) — tools that read metadata only, dry-run SQL with EXPLAIN, validate definitions and file proposals for human approval |
apps/cli |
kw command-line tool: kw axpert report checks every form in an Axpert database; kw axpert parity recomputes calculated fields on stored records and compares with Axpert's values |
apps/api |
@kwenter/api: Fastify API — forms, records (open, create, update), lookups from the form definition (read-only, never client SQL) |
apps/web |
@kwenter/web: React web app — forms (the engine runs in the browser: live calculations, rules, validation; lookups via the API) and reports |
apps/ |
Other applications (worker) — coming next |
go/ |
Go data tools: kw-anonymize (safe developer copies of customer data), kw-migrate (verify, copy, attachment extraction) |
infra/ |
Docker Compose deployment for a VPS: Caddy, API, Keycloak (realm import), PostgreSQL 16, backups — see docs/DEPLOY.md |
reference/ |
Axpert 11.2 source, structure exports and release notes. Reference only; proprietary to Agile Labs, never copy into Qwenter. |
local/ |
Git-ignored local files, e.g. the krishtech database dump (confidential customer data). |
Getting started
Local database setup (Postgres.app + krishtech test data): see docs/LOCAL_DEV.md.
Requires Node 22+ (see .nvmrc). pnpm runs through corepack, so no global install is needed.
corepack pnpm install
corepack pnpm -r typecheck
corepack pnpm -r test
Compatibility report for the Axpert app in DATABASE_URL (writes to the git-ignored local/reports/):
cd apps/cli && npx tsx src/main.ts axpert report
cd apps/cli && npx tsx src/main.ts axpert parity --limit 20 # real records vs Qwenter's calculations
cd apps/cli && npx tsx src/main.ts axpert layouts # how Axpert Design Mode layouts carry over
cd apps/cli && npx tsx src/main.ts axpert import-metadata # move the Axpert app's metadata into Qwenter (re-run is safe)
cd apps/cli && npx tsx src/main.ts users import --keycloak-url URL [--apply] # Axpert users → Keycloak (docs/DEPLOY.md §4)
cd apps/cli && npx tsx src/main.ts axpert reports --user admin # run every report read-only
Run the API against the local database (dev authentication via the x-kw-user header):
cd apps/api && npx tsx src/main.ts
curl -H 'x-kw-user: me' localhost:4000/api/forms
| Endpoint | Purpose |
|---|---|
GET /health |
Liveness (no auth) |
GET /api/forms |
Forms of the application |
GET /api/forms/:form |
Converted definition, engine problems, app globals |
GET /api/forms/:form/records?limit&offset&search |
Record list; search looks through the document number and the header's text fields |
GET /api/forms/:form/records/:id/history |
Saves, approvals and file changes with field-level differences |
GET/PUT/DELETE /api/forms/:form/records/:id/images/:field |
Image fields (photo, logo), in Axpert's <form><field> table; PUT takes the image as the body (PNG/JPEG/GIF/WebP, 5 MB) |
GET /api/forms/:form/records/:id/attachments[/:name] |
List / download attachments (Axpert's <form>attach table); downloads are never shown inline |
PUT/DELETE /api/forms/:form/records/:id/attachments/:name |
Add or replace / remove an attachment (body = the file, 20 MB) |
GET /api/branding, GET /api/branding/logo |
Company name and logo (public) |
PUT /api/admin/branding, PUT/DELETE /api/admin/branding/logo |
Change them (all-access users only) |
GET /api/forms/:form/records/:id |
Record values (storage form) and version |
POST /api/forms/:form/records |
Create (server recalculation, validation, audit) |
PUT /api/forms/:form/records/:id |
Update; send the version from open (409 on conflicting edits) |
POST /api/forms/:form/lookup |
{ field, purpose: options|value|fill|display, params, search? } |
GET /api/reports |
Reports of the application |
GET /api/reports/:report |
Converted report definition and this user's default parameter values |
POST /api/reports/:report/params/:param/options |
{ params } → choices of a list parameter (its SQL, read-only, with the user's session values) |
POST /api/reports/:report/run |
{ params, page, pageSize } → rows, count, totals (read-only, timeout) |
GET /api/studio/status |
Where the application's metadata lives (axpert = read live, kwenter = imported) and definition counts |
POST /api/studio/import-axpert |
Import / re-import the Axpert app (forms with layouts, reports, workflows, menu, rights) into Qwenter's versioned store; afterwards Qwenter is the only source. All-access users |
GET /api/studio/menu |
The whole menu (not limited by rights), every form and report it can open, pending menu changes. Designers |
POST /api/studio/menu |
{ menu, note?, publish? }: checked, then saved as a change (kind menu); publish lets an approver publish it at once. Needs the application imported into Qwenter |
GET /api/studio/workflows |
Every approval workflow (on or off) and the forms without one. Designers |
GET /api/studio/workflows/:form |
A form's workflow with its fields, the roles, and how many records are at each step. Designers |
POST /api/studio/workflows/check |
{ definition }: problems (levels, roles, condition fields), warnings about records already in the workflow, and the database changes it needs |
POST /api/studio/workflows |
{ definition, note?, publish?, applySchema? }: saved as a change; approvers can publish it at once. enabled: false turns a workflow off |
GET /api/studio/history/:kind/:key |
Every saved version of a definition (who, when, from where) |
GET /api/studio/sql/schema |
Tables and views of the application schema with columns and approximate rows (KW_SQL_ROLES, default all-access) |
POST /api/studio/sql/run |
{ sql, mode: read|dry-run|commit }: one statement; read runs in a READ ONLY transaction (30 s, first 1,000 rows); dry-run runs and rolls back; commit changes data (all-access only). Every statement is logged in kw.sql_audit |
GET /api/studio/sql/history |
The user's recent statements |
POST /api/designer/report/check |
{ definition } → problems (schema, single read, unknown parameters, columns missing from the result) and the result columns with types, from PostgreSQL without reading rows |
POST /api/designer/report/preview |
{ definition, params, page } → a draft report's rows (read-only) |
POST /api/designer/reports |
{ definition, note?, publish? }: save a report design as a change; approvers can publish at once |
GET /api/designer/status |
Whether the user may design forms (KW_DESIGNER_ROLES, default all-access) and publish them |
POST /api/designer/check |
{ definition } → problems (schema and form engine) and the database changes publishing would make |
POST /api/designer/forms |
{ definition, note?, publish?, applySchema? }: save a design as a change for approval; approvers can publish at once |
GET /api/menu |
The application menu (Axpert's axpages tree), limited to what the user may open |
GET /api/admin/roles |
Roles with their users, groups and rule counts (all-access users only) |
GET /api/admin/roles/:role/rights |
A role's rights on every form and report: current, Axpert's, and whether a Qwenter rule overrides it |
GET /api/admin/access?role= |
Qwenter grants (all-access users only) |
PUT /api/admin/access |
{ role, kind: form|report|page, key, actions: [view, create, edit, delete] }: a Qwenter rule that replaces Axpert's for that role and form/report; empty actions revokes |
GET /api/admin/users |
Users with their roles, the role groups, and whether each has a Keycloak sign-in account. All-access users |
POST /api/admin/users · PUT /api/admin/users/:username |
Create / change a user (name, e-mail, mobile, active, roles) in the application's tables and in Keycloak, in one step; you cannot disable yourself or drop your own all-access role |
POST /api/admin/users/:username/password |
{ mode: temporary, password } or { mode: email }: reset through Keycloak; ends the user's sessions |
POST /api/admin/roles |
{ role }: a new role (role group), then given rights under Rights |
GET /api/dashboard |
The Home dashboard: its widgets this user may see (report widgets follow the report's rights; SQL widgets their listed roles) |
GET /api/widgets/:key/data |
A widget's data, run read-only like a report |
GET /api/designer/widgets · POST /api/designer/widget/preview |
Widgets and the Home layout; run a draft widget for the builder's preview. Designers |
POST /api/designer/widgets · POST /api/designer/dashboard |
Save a widget / the Home layout as a change; approvers can publish at once. SQL widgets are for all-access users |
GET /api/forms/:form/prints |
The form's print formats (invoice, order…), for users who may view the form; the browser renders and prints them (or saves PDF) |
POST /api/reports/:report/export |
{ params, format: xlsx|csv }: the whole result (up to 50,000 rows) as Excel or CSV; report view rights; logged |
GET /api/forms/:form/export?format=&search= |
The form's records (header fields, dropdowns as their labels), as in the list and its search; form view rights; logged |
POST /api/forms/:form/import/preview |
Body: an .xlsx or CSV file. Its columns, first rows and a suggested column → field matching. Create rights |
POST /api/forms/:form/import?options= |
Body: the file; options { mapping, groupBy?, dryRun, onError: stop|skip }. Each record is created like a user would (defaults, dropdowns by name, calculations, rules, checks, numbering); one transaction, a savepoint per record; a dry run rolls back. Logged |
GET /api/notifications · POST /api/notifications/read |
The signed-in user's notifications (approvals waiting for them, decisions on their records) and unread count; mark some ({ ids }) or all ({ ids: "all" }) read |
GET /api/schedules · POST /api/reports/:report/schedules · DELETE /api/schedules/:id · POST /api/schedules/:id/send |
The user's scheduled report e-mails ({ params, format, frequency, time, weekday?, monthday? }); remove one; send (and resume) one now |
GET /api/studio/health?refresh=1 |
Everything that would not work: reports whose SQL fails (planned with LIMIT 0, nothing runs), form definition problems, menu entries, workflows, print formats and widgets pointing at what doesn't exist. Cached 10 minutes. Designers |
POST /api/forms/:form/records/:id/cancel |
{ remarks, version? }: cancel a record as Axpert does — kept, read-only, marked cancelled with the reason; its postings removed and master updates reversed; audited. Needs delete rights; lists hide cancelled records unless ?cancelled=1 |
POST /mcp |
MCP server (Streamable HTTP, JSON-RPC): initialize, tools/list, tools/call — the assistant's design tools plus run_report, list_records, get_record, as the signed-in user with their rights; proposals still need an approver. /.well-known/oauth-protected-resource tells clients where to sign in |
GET /api/designer/prints · POST /api/designer/prints/check · POST /api/designer/prints |
Print formats: list, check against the form, save as a change or publish. Designers |
DELETE /api/admin/access?role&kind&key |
Remove the Qwenter rule: back to Axpert's |
GET /api/ai/status |
Assistant enabled, model, whether this user may approve proposals |
POST /api/ai/chat |
{ message, conversationId? } → the assistant's reply, tools used, proposals filed |
GET /api/ai/conversations[/:id] |
The user's conversations / one conversation's text |
GET /api/ai/proposals?status= |
Proposed changes |
GET /api/ai/proposals/:id/plan |
Database changes a form/workflow proposal needs (additive DDL), warnings, blockers |
POST /api/ai/proposals/:id/decision |
{ decision: approve|reject, comment?, applySchema? } (roles in KW_AI_APPROVER_ROLES); approved reports, forms and workflows go live |
Rights. Every endpoint checks the user's rights on the server, and anything not granted is refused (403).
- A user's roles come from Axpert (
axuserlevelgroups→axusergroups) plus the sign-in token. - Axpert's
axuseraccessgrants roles their forms and reports. - A Qwenter rule (
kw.access) for a role and form/report replaces Axpert's for that pair: narrow it, widen it, or revoke it. Axpert's tables are never changed. Manage rules in the web app under Rights (shield icon, all-access users only). - The role
defaulthas all access. - If the customer has access rules Qwenter cannot apply yet (field rules, record rules, data scopes), the API refuses to start rather than ignore them.
KW_ALLOW_UNSUPPORTED_RIGHTS=1overrides this; it is meant for development copies only.
Run the web app (with the API running on port 4000):
cd apps/web && npx vite # http://localhost:5173 — development sign-in with any user name, e.g. admin
Go data tools (Go 1.24+; see docs/LOCAL_DEV.md for the anonymized developer copy):
cd go && go build -o bin/ ./cmd/...
bin/kw-anonymize --db postgres://postgres@localhost:5432/krishtech_anon --schema krishtech --plan # list columns, change nothing
bin/kw-migrate verify --from $SRC --to $DST --schema krishtech # row counts + content checksums per table
bin/kw-migrate copy --from $SRC --to $DST --schema krishtech --tables a,b --truncate
bin/kw-migrate attachments --from $SRC --schema krishtech --out ./attachments # files + manifest.jsonl
KW_TEST_PG=postgres://postgres@localhost:5432/postgres go test ./... # tests use throwaway databases
Inspect how individual Axpert export files convert:
corepack pnpm --filter @kwenter/axpert-compat inspect "$PWD"/reference/axpert-structures/AxpertDeveloper/Export/*.trn
corepack pnpm --filter @kwenter/axpert-compat inspect --json <file.trn> # full converted definition
corepack pnpm --filter @kwenter/axpert-compat inspect --xml <file.trn> # decoded Axpert XML