- Status: Accepted (2026-07-02 — all 9 features complete across 4 phases)
- Date: 2026-06-26
- Decision Makers: Stakeholder, UI Team, Engine Team
- Supersedes: —
- Amends: —
- Related: ADR-005 (Metadata-Driven UI / BcRenderer), ADR-006 (Universal Component Strategy), ADR-007 (Enterprise Universal UI API Contract), ADR-008 (Contract-First API Freeze)
BitCode engine currently ships 110/110 enterprise-grade components in @bitcode/ui
(Mitosis) + 130 widgets in @bitcode/ui-flutter, plus 122 legacy Stencil components.
However, the engine itself is still SSR-based (Go HTML templates) and many components
that are fully built and tested are not wired to engine features. This ADR defines the
contract, scope, and execution plan for wiring 9 high-value engine features to their
existing UI components.
Components exist and are production-ready, but the engine cannot use them because:
- No API contract between engine feature (Go) and component (TS/Dart) — components define props, but engine does not emit the matching JSON/data shape.
- No SPA mode — engine renders HTML server-side; components that need interactivity (form builder, workflow builder, pivot table) cannot function without client-side rendering.
- Backend gaps — some features (pivot table, email/notification) have UI but no backend endpoint to feed data.
- No reference integration — even where wiring is trivial (BcChatter, BcActivity, BcExport), there is no canonical pattern showing how engine JSON → component props.
| # | Feature | UI Component | Backend | Effort | Status |
|---|---|---|---|---|---|
| 1 | Visual Form Builder | New (BcFormBuilder) | Partial (view JSON exists) | L | Belum |
| 2 | Visual Workflow Builder | New (BcWorkflowBuilder) | Partial (process JSON exists) | L | Belum |
| 3 | Visual Schema Builder | New (BcSchemaBuilder) | Partial (model JSON exists) | L | Belum |
| 4 | Multi-Step Wizard | BcWizard ✅ |
— | M | Belum |
| 5 | Comment & Mention | BcChatter ✅ |
Belum (no comment endpoint) | M | Component ada, belum wire |
| 6 | Activity Feed | BcActivity ✅ |
Partial (audit_log exists) | M | Component ada, belum wire |
| 7 | Export Data (CSV/Excel) | BcExport ✅ |
Partial (query builder exists) | M | Component ada, belum wire |
| 8 | Pivot Table | BcDataTable ✅ + new BcPivot |
Belum (no pivot aggregation endpoint) | L | Component ada, backend belum |
| 9 | Email/Notification UI | New (BcNotificationCenter) | Partial (email infra exists, no notification store) | L | Belum |
Each feature follows a 3-tier contract:
┌─────────────────────────────────────────────────────────┐
│ Tier 1: Engine API (Go) │
│ - REST endpoint OR WebSocket action OR template data │
│ - Emits JSON matching component contract (ADR-008) │
└──────────────────────┬──────────────────────────────────┘
│ JSON / data-fetcher
┌──────────────────────▼──────────────────────────────────┐
│ Tier 2: BcRenderer integration (ADR-005) │
│ - view.json `part` declaration │
│ - data-source binding (ADR-005 Section 3) │
│ - event bridge (ADR-010) for client actions │
└──────────────────────┬──────────────────────────────────┘
│ props
┌──────────────────────▼──────────────────────────────────┐
│ Tier 3: Component (Mitosis/Flutter) │
│ - Consumes props per contract (ADR-007) │
│ - Emits events per event bridge (ADR-010) │
└─────────────────────────────────────────────────────────┘
- Engine: New
commentbuilt-in model (auto-created percomments: truemodel flag). Fields:id,model,record_id,author_id,body,mentions(JSON array),parent_id(threading),created_at. CRUD at/api/v1/{module}/comments. - Mention:
@usernameparsed server-side → createsnotificationrecord (see #9). - Component:
BcChatteralready hasmessages,onSubmit,onMentionprops. Wire toGET/POST /api/v1/{module}/comments?record_id=X. - BcRenderer:
part: "chatter"withdata-source: { model: "comment", filter: { record_id: "{{record.id}}" } }.
- Engine: New
/api/v1/activityendpoint aggregatingaudit_log+ domain events. Query params:model,record_id,user,since,limit. - Component:
BcActivityhasitems,variantprops. Map audit_log entries →BcActivityItem[]via server-side transformer. - BcRenderer:
part: "activity"withdata-source: { endpoint: "/api/v1/activity", params: { record_id: "{{record.id}}" } }.
- Engine: New
POST /api/v1/{module}/{model}/exportendpoint. Accepts:{ format: "csv"|"xlsx"|"json", columns: [...], filter: {...}, sort: {...} }. Uses existing query builder (ADR in features.md). Streams file response. - Component:
BcExporthasformat,columns,onExportprops. Wire to export endpoint. - BcRenderer:
part: "export"withdata-source: { model: "{{model}}" }.
- Engine: New
wizardview type inview.json—type: "wizard"withsteps[], each step is a form fragment. Process engine drives step transitions. - Component:
BcWizardalready complete (16350 bytes, 16k). Wirestepsfrom view JSON. - BcRenderer:
part: "wizard"declarative in view JSON.
- Engine: New
POST /api/v1/{module}/{model}/pivotendpoint. Accepts:{ rows: [...], cols: [...], values: [{ field, agg: "sum"|"count"|"avg" }], filter: {...} }. Returns aggregated 2D matrix. - Component: New
BcPivotcomponent (extendBcDataTablewith pivot mode). - BcRenderer:
part: "pivot"with pivot config in view JSON.
- Pattern: Shared
BcBuilderbase — drag-drop canvas + property panel + JSON preview. - Engine: Endpoints to validate & save generated JSON:
POST /api/v1/admin/views/validate(form builder)POST /api/v1/admin/processes/validate(workflow builder)POST /api/v1/admin/models/validate(schema builder)
- Component: New
BcFormBuilder,BcWorkflowBuilder,BcSchemaBuilder. - BcRenderer: Admin-only parts, mounted in
/adminpanel (ADR-005 Section 4).
- Engine: New
notificationbuilt-in model. Fields:id,user_id,type,title,body,data(JSON),read_at,created_at. Endpoints:GET /api/v1/notifications,POST /api/v1/notifications/{id}/read,POST /api/v1/notifications/read-all. - WebSocket: Push new notifications via existing WebSocket hub (already broadcasts domain events).
- Component: New
BcNotificationCenter(dropdown panel) +BcNotificationItem. - BcRenderer:
part: "notification-center"in layout navbar.
Engine gains an opt-in SPA mode per view: view.json { "render": "spa" } flag.
When set, engine returns JSON (view definition + initial data) instead of HTML;
client-side BcRenderer (ADR-005) renders the component tree. SSR remains default
for backwards compatibility.
This is required for visual builders (#1-3) and pivot table (#8) which need client-side interactivity. Other features (#4-7, #9) work in both SSR + SPA.
| Phase | Features | Rationale |
|---|---|---|
| Phase 1: Wire existing | #5 Comment, #6 Activity, #7 Export, #4 Wizard | Components ready, only API + BcRenderer part needed. Fastest value. |
| Phase 2: SPA foundation | SPA mode + BcRenderer client runtime | Prerequisite for visual builders. |
| Phase 3: New components | #8 Pivot, #9 Notification | New component + backend. |
| Phase 4: Visual builders | #1 Form, #2 Workflow, #3 Schema | Most complex, depends on SPA + BcRenderer maturity. |
This ADR touches the following file ownership boundaries to enable parallel work with ADR-013 (Cross-tier Infrastructure) and ADR-015 (Chart Strategy):
engine/internal/presentation/api/ — new endpoints (comments, activity, export, pivot, notifications)
engine/internal/presentation/view/ — new view types (wizard, pivot), SPA mode
engine/internal/presentation/template/ — template wiring for new parts
engine/internal/presentation/admin/ — admin panel for visual builders
engine/internal/domain/ — new domain models (comment, notification) IF new
engine/internal/runtime/ — pivot aggregation, export streaming
packages/ui/src/components/views/ — BcWizard wiring (if needed)
packages/ui/src/components/social/ — BcChatter, BcActivity wiring (IF prop changes needed)
packages/ui/src/components/print/ — BcExport wiring (IF prop changes needed)
packages/ui/src/components/overlays/ — BcNotificationCenter (new)
packages/ui-flutter/lib/src/components/ — bc_chatter.dart, bc_activity.dart, bc_export.dart (IF wiring)
packages/ui/src/core/ — ADR-013 owns (hooks, providers, adapt, animation)
packages/ui/src/components/charts/ — ADR-015 owns
packages/ui-flutter/lib/src/core/ — ADR-013 owns
packages/ui-flutter/lib/src/components/bc_chart.dart — ADR-015 owns
packages/components/src/components/charts/ — ADR-015 owns
packages/ui/src/index.ts — barrel exports (coordinate with ADR-013, ADR-015)
docs/components-progress.md — progress tracker
docs/adr/README.md — ADR index
engine/docs/features/ — feature docs (per-feature, low conflict)
ADR-014 Phase 1 (wire existing) can start immediately — it does not depend on
ADR-013. ADR-014 Phase 2 (SPA mode) touches BcRenderer which ADR-013 may also
touch for AppProvider adoption. Rule: ADR-014 Phase 2 starts after ADR-013
core refaktor stabilizes (estimated Week 2).
- 9 high-value ERP features become usable (comments, activity, export, wizards, pivot, notifications, visual builders).
- Establishes canonical engine↔UI wiring pattern reusable for future features.
- SPA mode unlocks client-side rendering path (prerequisite for visual builders).
- Reuses 100% of existing components — no new component needed for #4-7.
- Visual builders (#1-3) are L effort each — significant investment.
- SPA mode is a paradigm shift from current SSR-only — risk of dual-render bugs.
- Pivot backend is non-trivial (OLAP aggregation in Go).
- New built-in models (comment, notification) add to base module surface.
- BcRenderer (ADR-005) must mature to client-side runtime — currently SSR-only.
-
commentmodel auto-created for models withcomments: true -
GET/POST /api/v1/{module}/commentsworking withBcChatter -
GET /api/v1/activityworking withBcActivity -
POST /api/v1/{module}/{model}/exportworking withBcExport(CSV + XLSX) -
wizardview type working withBcWizard - At least 1 engine test per feature (handler + integration)
-
view.json{ "render": "spa" }flag respected — engine parser acceptsRenderfield onViewDefinitionwithRenderSSR/RenderSPAconstants - BcRenderer client runtime renders component tree from JSON —
packages/ui/src/spa-runtime.ts(web/Mitosis) +packages/ui-flutter/lib/src/spa_runtime.dart(Flutter) fetch envelope, map toUiSchema, buildBcRendererProps+ReactiveStore - SSR mode unchanged (backwards compatible) —
view.IsSPAModepredicate returns true only for"spa"; views withrender:"ssr"or norendercontinue to return HTML - Engine SPA envelope =
{ view, data, meta }(data-parity with SSR enforced byTestDataParity_SPAEqualsSSR_FormView) - Test coverage: 11 engine tests, 13 web tests, 28 Flutter tests, 100% passing
-
POST /api/v1/{module}/{model}/pivotendpoint -
BcPivotcomponent renders aggregated matrix -
notificationmodel + endpoints + WebSocket push -
BcNotificationCenterin navbar
-
BcFormBuilderdrag-drop → validview.json -
BcWorkflowBuilderdrag-drop → validprocess.json -
BcSchemaBuilderdrag-drop → validmodel.json - All 3 validate via admin endpoints before save
- ADR-005: Metadata-Driven UI (BcRenderer) —
partdeclaration, data-source binding - ADR-006: Universal Component Strategy — Pure/Adapt pattern for new components
- ADR-007: Enterprise Universal UI API Contract — component prop contracts
- ADR-008: Contract-First API Freeze — engine↔component contract freeze
- ADR-010: Web Component Event Bridge — event emission from components
docs/features.md— feature inventory & roadmapengine/docs/features/— per-feature engine docs