System Blueprint

Enterprise Stack & Request Flow

Client TierBrowser UI

Next.js 16 (BFF) gatekeeper. No JWT tokens or credentials exposed in browser localStorage.

Port 3000 · SSR / BFF
AuthenticationKeycloak 26

OAuth 2.1 + PKCE authentication engine. Passwords never reach the application database.

Port 8080 · OIDC PKCE
Calculation EngineFastAPI (Python)

Pure costing engine using arbitrary-precision Decimals. Zero floating-point drift.

Port 8000 · Python Decimal
Storage & IsolationPostgreSQL 18

Multi-tenant database engine with forced Row-Level Security on every table.

Port 5433 · Forced RLS

Role-Based Access Control

Who Does What: The Six Permission Tiers

Operational TaskOwnerAdminFinance MgrCost AnalystProduction OpViewer
Materials & Purchase PricesFullFullFullFullView OnlyView Only
Labor Pay Rates & Machine CostsFullFullFullFullHiddenHidden
Recipes & BOM PublishingFullFullView OnlyFullView OnlyView Only
Calculate & Snapshot CostsFullFullFullFullHiddenView Only
Expenses & Overhead AllocationsFullFullFullView OnlyHiddenHidden
Channel Pricing PoliciesFullFullFullHiddenHiddenHidden
Price ProposalsFullFullFullFullHiddenView Only
Final Price Approval (Sign-Off)AuthorizedForbiddenAuthorizedForbiddenHiddenHidden
What-If Scenarios & SensitivityFullFullFullFullHiddenView Only
Batch Production & ActualsFullFullView OnlyFullRecord ActualsView Only
Ledger Audit & Security LogsFullFullView OnlyView OnlyHiddenHidden

Under the Hood

Cryptographic & Infrastructure Guarantees

Encrypted Session Cookies

Tokens are encrypted server-side; the browser holds only an opaque, HttpOnly, host-only session cookie. Zero sensitive keys in local storage.

30-Day Trusted Browsers

Signed 30-day cookie per user revoked instantly on expiration or when selecting “Log out all devices” after device loss.

Tamper-Evident Audit Ledger

Every price approval, recipe change, supplier invoice revision, and Claude MCP invocation is committed with actor IDs and timestamp signatures.

European Union Residency

Database instances and cryptographic identity run in European Union data centers (Frankfurt) with automated nightly encrypted backups.

Pricing you can prove.

Import one invoice, run one batch, and watch a defensible cost appear. to the third decimal, traceable to its source. Claude can do the typing; finance does the approving. Set your first approved price today.