Nexora is a multi-country corporate tax compliance workspace β document intake, a rule-based risk engine, AI-assisted case investigation and fiscal reconciliation β designed for corporate tax directors, CFOs, and tax consultants across Southeast Asia and the United States (Indonesia full P0 depth; Singapore, Malaysia, and US statutory previews).
Submitted for Google Cloud AI Builder Cup, Track 1: BFSI (Smart Risk, Fraud Prevention & Financial Experience).
- Live Production URL: https://nexora-chi-cyan.vercel.app
- Active Branch:
main
Nexora is organised around the 6-step cycle a tax team actually runs. Each step feeds the next, so a finding becomes a case, a confirmed case becomes a fiscal correction, the correction changes the return, and the approved return issues the billing code β no copy-paste between screens. Everything works with sample data and no API key.
flowchart LR
S1[1. Entitas & struktur] --> S2[2. Dokumen]
S2 --> S3[3. Kasus<br/>evidence Β· AI investigation Β· maker-checker]
S3 --> S4[4. Rekonsiliasi fiskal]
S4 --> S5[5. SPT tahunan<br/>maker-checker]
S5 --> S6[6. Pembayaran]
| Step | Module | What it does |
|---|---|---|
| β | Ringkasan (/overview) |
Group dashboard: dues β€ 30 days, open findings, exposure, compliance score per entity, action centre, VAT trend, next deadlines. |
| 1 | Entitas & struktur (/entities) |
Org chart of the group, entity profiles, legal-document checklist (uploads wait for a person to mark them checked), shareholders/UBO, add subsidiaries, group consolidation & Pillar Two threshold. |
| 2 | Dokumen (/documents) |
Inbox of e-Faktur / invoices / share registers per entity. Upload (PDF/PNG/JPG β€ 10 MB), AI extraction with per-field confidence, manual override, verification. |
| 3 | Kasus (/cases) |
One screen per finding. A deterministic rule engine (TBTS, Missing Trader, split invoicing, Z-Score outliers, MyInvois UUID, non-deductible costs, vendor & share-register cross-validation) opens the case; the case shows the checks that fired, the flagged document fields with per-field extraction confidence, the rule basis, an AI investigation with cited steps, the maker-checker decision, and a Rupiah trail (what the correction does to PPh due, computed by the same CIT engine as the return). /risk and /review redirect here. |
| 4 | Rekonsiliasi fiskal (/calculation) |
Commercial β fiscal reconciliation per entity, CIT for ID (Pasal 31E), SG (partial exemption), MY (SME tiers), US (21%); tax credits; VAT recap with blocked input VAT; withholding calculator; what-if simulator. |
| 5 | SPT tahunan (/tax-return) |
SPT 1771 / Form C-S / Borang C / Form 1120 generated live from the reconciliation, pre-submission checks, maker-checker approval that locks the figures, XML/JSON export, print. |
| 6 | Pembayaran (/payments) |
All liabilities across jurisdictions, billing codes, NTPN recording, overdue detection and indicative penalties. Approving the return issues the PPh 29 / balance-due billing automatically. |
| Kalender, Pemegang saham & UBO, Laporan & audit, Studi & simulator | Deadlines with .ics export, group-wide UBO register with PII masking & dividend WHT simulator, executive report & append-only audit trail (CSV), treaty / Pillar Two / TP simulators and knowledge library. |
Design: an editorial system β warm paper, serif headlines and figures (Newsreader), one Prussian-blue accent and a highlighter mark for the thing to look at. Every cycle page ends its header with a Berikutnya line: what is still open on that step, and where to go next.
Cross-cutting: βK command palette (pages, entities, findings, documents), live notifications, RBAC personas (parent executives see the group; subsidiary staff are scoped to their entity), and the Tax Copilot side panel, which can be scoped to a single case.
src/
βββ app/ Next.js App Router β one route per module
β βββ layout.tsx Fonts, globals, <Providers>
β βββ providers.tsx WorkspaceProvider + UiProvider + AppShell
β βββ overview/ entities/ entities/[id]/ documents/ cases/ (risk/ review/ redirect)
β βββ calculation/ tax-return/ payments/ calendar/ shareholders/ reports/ studies/
β βββ api/ bootstrap Β· sync Β· reset Β· status Β· copilot Β· investigate Β· scan-document
βββ features/ Feature modules (one folder per route)
βββ shell/ Sidebar, top bar, command palette, notifications,
β account/RBAC menu, copilot, toasts, cycle status
βββ ui/ Design system: Button, Card, Badge, Field, Dialog, Sheet,
β Tabs, Table, MetricBand (dark/light), Meter, charts (SVG) β¦
βββ state/ WorkspaceProvider (single source of truth, DB sync), UI state
βββ lib/
β βββ compliance.ts Documents β risk engine β maker-checker review β corrections
β βββ cases.ts Per-case checks, flagged fields, serialisable case context
β βββ investigation.ts Investigation tools, offline plan, cited brief + validation
β βββ rupiahTrail.ts Correction β PPh due before/after (real CIT engine)
β βββ ai/ Gemini client, engine badges, grounded Copilot, investigator loop
β βββ cit.ts Corporate income tax per jurisdiction
β βββ fraud.ts Rule engine & Z-Score (used by compliance.ts)
β βββ crossValidation.ts Vendor/share-register consistency checks
β βββ returns.ts Return draft + XML serialisation
β βββ database.ts SQLite (node:sqlite) / MySQL / memory persistence
β βββ format.ts fx.ts schedule.ts download.ts
βββ data/ Sample group, personas, seed dataset, country configs,
taxCorpus.ts (rule library: internal summaries, marked unverified)
Persistence: entity, payment, calendar, audit and study tables plus an app_state key/value table holding the compliance workspace (compliance) and per-entity reconciliations & returns (ledger). The database is re-seeded automatically when the sample dataset version changes.
Every AI output carries an engine badge: Gemini Β· live (with the model id) or Simulasi lokal Β· offline, plus fallback when a live call failed and the local engine answered instead. Confidence is shown as a word with its basis, never as a percentage.
| Surface | Live (GEMINI_API_KEY set) |
Offline (no key) | Guardrails |
|---|---|---|---|
Tax Copilot (/api/copilot) |
Gemini answers only from the numbered sources it is given (case data, workspace findings, rule library) and must cite them | Composes the answer from the same sources | Off-topic and prompt-injection questions are refused before any model call; citations that point at nothing are dropped; "no source" is said plainly |
Case investigation (/api/investigate) |
Gemini function calling over 8 deterministic tools (vendor master, vendor history, tax math, supporting docs, same-day invoices, share register, extraction confidence, e-invoice UUID) | A rule-specific plan runs the same tools | Every brief line must cite tool steps that ran; uncited lines are dropped; the result is a suggestion for the maker, never a decision |
Document extraction (/api/scan-document) |
Gemini reads the file (PDF/PNG/JPG β€ 3 MB) and returns fields with per-field confidence; text addressed to an AI inside the document is surfaced, not followed | Values are generated from the file name and labelled as a simulation | Extraction never marks a vendor as validated |
The rule library (src/data/taxCorpus.ts) is a set of short internal summaries, marked verified: false; answers that rely on it say so. The model id is configurable with GEMINI_MODEL (default gemini-2.5-flash). Fraud rules, scores, the CIT engine and maker-checker always run deterministically.
| Infrastructure | Status |
|---|---|
| Cloud Run / Vercel | Next.js standalone build; set GEMINI_API_KEY as a server-side secret |
| MySQL | Persistent workspace via MYSQL_URL; SQLite/in-memory fallback with zero setup |
| Document AI, BigQuery | Not used. Environment variables are reserved for a future adapter |
- Node.js 18+ (tested on Node.js 20+)
- npm 9+
git clone https://github.com/fabrianivan/nexora.git
cd nexora
npm installcp .env.example .env.local- Leave
GEMINI_API_KEYblank to run every AI surface offline (zero setup, labelled in the UI). - Add
GEMINI_API_KEY=your_key_here(and optionallyGEMINI_MODEL) to enable live Gemini. MYSQL_URLis optional; if omitted, Nexora automatically activates the robust in-memory workspace repository.
npm run devOpen http://localhost:3000. The sample group loads automatically; reset it from the sidebar's database footer or the command palette.
Checks run on every change:
# Run unit tests (tax engine, CIT per country, risk engine, maker-checker, cases, investigation, copilot grounding)
npm run test
# Run TypeScript typecheck with zero errors
npm run typecheck
# Run ESLint with zero errors and zero warnings
npm run lint
# Build standalone production bundle
npm run build
# Run Playwright end-to-end smoke tests
npm run test:e2eSwitch persona from the account menu (top right). Access follows segregation of duties:
| Persona | Scope | Maker | Checker |
|---|---|---|---|
| Group CEO Β· Group CFO (parent company) | All entities | β | β (never on their own proposal or draft) |
| Director SG Β· Director MY Β· Controller US | Own entity only | β | β |
- Maker-checker applies to case decisions (Kasus) and annual returns (SPT tahunan); the UI offers a one-click switch to an eligible checker for demos.
- Subsidiary personas cannot open other entities; identity numbers in the UBO register are masked unless revealed (the reveal is audit-logged).
- Every mutation writes to the append-only audit trail (Laporan & audit β Jejak audit, CSV export).
Nexora is released under the MIT License. Built for the Google Cloud AI Builder Cup 2026.