KROWFORCE — frontend
The workforce operating system, as a standalone frontend. There is no backend and no API call: every record on every screen comes from a local store that is shaped like the API meant to replace it. It reads no environment variables and ships no deployment configuration.
npm install
npm run dev # http://localhost:5173
npm run build
npm run typecheck
New to this codebase? Read handover/HANDOVER.md first — it covers how to run
it, what is and is not built, and what was taken out before handover.
What this is
A React 19 + Vite + TypeScript application: ~18,000 lines across ~135 files, 49 pages behind 76 routes, running on a deterministic seed held in a local store.
It is a working product prototype rather than a demo veneer: nothing on a screen is hard-coded. Change an assignment and the fill rate, the invoice and the P&L all move, because every figure is derived from the same records.
The seven vantage points
KROWFORCE is one system seen from seven positions, and each gets its own navigation and its own home screen rather than one dashboard with sections switched off:
| Role | Opens the product to ask |
|---|---|
| KROW Admin | What is going wrong across the whole network? |
| Procurement | Who should get the work, and on what terms? |
| Operator | What is going wrong today, in my sectors? |
| Sector Manager | Is my branch covered, and at what margin? |
| Client | Is my event staffed, and what is it costing me? |
| Vendor | Where are my gaps, and how is my score? |
| Staff Member | What am I working, and what did I earn? |
The role switch is in the top bar, not in settings — moving between seats is how the product is reviewed.
Architecture
src/
data/ types.ts, seed.ts, store.ts — the local database
api/ entities.ts, auth.ts — what pages import
lib/ scope, metrics, dates, hooks, i18n, preferences
nav/ routes.ts, navigation.ts — every path, named once
components/
ui/ Radix primitives
ds/ the KROW design system
layout/ shell, sidebar, command palette, notifications, switchers
shared/ status mapping, list toolbar, URL-backed tabs, chart props
pages/ home · orders · network · workforce · worker · finance ·
intelligence · comms · settings
The store (src/data/store.ts) exposes collections with
list / filter / get / create / update / delete, all returning promises,
persisted to localStorage behind a debounce and wrapped in try/catch.
Writes notify subscribers, so a mutation anywhere refreshes every screen
showing that data — the behaviour a real backend with subscriptions gives,
without each page remembering to invalidate.
The seed (src/data/seed.ts) is deterministic. Fill rates follow from
assignments, invoice ageing follows from dates, a vendor's score follows from
the shifts it actually covered.
Metrics (src/lib/metrics.ts) holds every derived figure — fill position,
attendance, ageing, overtime exposure, vendor reliability — so the same number
means the same thing on every screen.
Scope (src/lib/scope.ts) turns the account in view into the filter every
list query applies. A client sees its own orders; a vendor sees the work it was
given; a worker sees their own shifts.
api/entities.ts is the seam. Pages import from there and never name a
transport, so replacing the body of store.ts with HTTP calls is the intended
path to a real backend.
Session
There is no identity provider and no sign-in screen. The app opens on the
seeded admin account; the role switch in the top bar moves to the seeded
account for another role, and the choice is remembered in this browser
(src/api/auth.ts). Settings → Data shows every collection's row count and
resets the dataset.
What is built
Role dashboards (×5), schedule, live activity with check-in and check-out, the availability grid with offer sending, task board, staff directory and detail, teams, onboarding pipeline, document review queue, certifications, compliance, vendors list / detail / performance, clients, sectors, enterprises, invoices list / detail, payroll runs and detail, daily operating report, sales tracker, budget, rate cards, savings engine, reports with CSV export, demand and supply, KROW Command, activity log, messages, announcements, settings, users, the design system page, and the five worker self-service screens.
Routed with an honest "not built yet" page that states the intent and the
records already available: the order board, order detail and order creation,
action center, urgent and permanent order, smart scheduler, vendor roster,
deployments, client / sector / enterprise / team detail, vendor onboarding and
marketplace, staff market, trust network, predictive, KROW EDGE, recruiting,
training, benefits, employee 360, communications hub, permissions, support,
tutorials, new invoice. See src/pages/Stubs.tsx.
Deploying it
npm run build writes a static site to dist/; serve it with any static web
server. One rule matters: any path that is not a real file must be answered
with index.html, or a refresh on a deep link such as /invoices/INV-1042
returns a 404. Files under /assets are content-hashed and can be cached
indefinitely; index.html must not be cached.
Known gaps
npm run lintis declared inpackage.jsonbut ESLint is not installed.- There are no tests and no test runner.
canSee()insrc/lib/scope.tsexists but no route is role-guarded, and the scope filter is applied by a handful of pages rather than all of them. Both are harmless locally and become real holes the moment a server is attached.DsPropsisRecord<string, any>on the design-system components, sotypecheckcannot catch a prop error in them.- The main chunk is ~880 kB; every page is statically imported.
Next: database and API
The frontend was built so these slot in without the pages changing:
- Database —
src/data/types.tsis the schema. Each collection becomes a table;created_date/updated_dateare already stamped on every row. - API — replace the body of
src/data/store.tswith HTTP calls. The collection interface is the contract;src/api/entities.tsis the only import pages use. - Auth — replace
src/api/auth.ts.AuthContextand the scope layer already consume aUserwith role and scope ids.