How allanlugui/facil works
Facil is an internal facilities-management platform. Staff use a React interface to manage facilities and operational workflows; the client sends API requests to a Cloudflare Worker, which enforces access and persists domain changes in D1. The documented purchasing workflow is a distinct staged process, alongside inventory, assets, service operations, administration, and reporting. The README documents optional R2 attachments, real-time support, and external integrations. Several routes were not sampled, so their internal calls are not inferred.
Main entry points: index.ts Worker entry · api.ts API client · router.tsx App router · auth.ts Session and permissions
Components 26
Client application
- App router
src/client/app/router.tsx - Session state
src/client/lib/session.tsx - API client
src/client/lib/api.ts - Dashboard
src/client/pages/dashboard.tsx - Purchasing UI
src/client/pages/purchases.tsx - Asset UI
src/client/pages/assets.tsx - Work orders UI
src/client/pages/workorders.tsx - Operations pages
src/client/pages
Worker API
- Worker entry
src/worker/index.ts
Facilities operations
- Purchase workflow
src/worker/routes/purchases.ts - Asset management
src/worker/routes/assets.ts - Work orders
src/worker/routes/workorders.ts - Domain routes
src/worker/routes - Support chat
src/client/lib/chat.tsx - Reports and exports
src/worker/routes/reports.ts
Administration and governance
- Authentication
src/worker/routes/auth.ts - Settings
src/worker/routes/settings.ts - Session and permissions
src/worker/auth.ts - Audit trail
src/worker/audit.ts
Persistence and integrations
- Database helpers
src/worker/db.ts - D1 database
- Integration outbox
src/worker/outbox.ts - Realtime support room
src/worker/support-room.ts - Optional attachments
Other components
- Staff user
- External systems
Connections 37
- Staff user → App router: uses
src/client/app/router.tsx - App router → Session state: checks session
src/client/app/router.tsx - App router → Dashboard: routes to
src/client/app/router.tsx - App router → Purchasing UI: routes to
src/client/app/router.tsx - App router → Asset UI: routes to
src/client/app/router.tsx - Staff user → Operations pages: uses
- Purchasing UI → API client: calls
src/client/pages/purchases.tsx - Asset UI → API client: calls
src/client/pages/assets.tsx - Work orders UI → API client: calls
src/client/pages/workorders.tsx - Dashboard → API client: calls
src/client/pages/dashboard.tsx - Session state → API client: calls
src/client/lib/session.tsx - API client → Worker entry: HTTP requests
- Worker entry → Purchase workflow: registers
src/worker/index.ts - Worker entry → Authentication: registers
src/worker/index.ts - Worker entry → Settings: registers
src/worker/index.ts - Worker entry → Asset management: registers
src/worker/index.ts - Worker entry → Work orders: registers
src/worker/index.ts - Worker entry → Domain routes: registers
src/worker/index.ts - Purchase workflow → Session and permissions: uses access
src/worker/routes/purchases.ts - Purchase workflow → Database helpers: uses helpers
src/worker/routes/purchases.ts - Purchase workflow → Integration outbox: writes events
src/worker/routes/purchases.ts - Asset management → Session and permissions: uses access
src/worker/routes/assets.ts - Asset management → Database helpers: uses helpers
src/worker/routes/assets.ts - Asset management → Audit trail: records changes
src/worker/routes/assets.ts - Work orders → Database helpers: uses helpers
src/worker/routes/workorders.ts - Work orders → Audit trail: records changes
src/worker/routes/workorders.ts - Authentication → Session and permissions: creates sessions
src/worker/routes/auth.ts - Authentication → Audit trail: records events
src/worker/routes/auth.ts - Settings → Session and permissions: checks access
src/worker/routes/settings.ts - Settings → Audit trail: records changes
src/worker/routes/settings.ts - Session and permissions → D1 database: stores sessions
src/worker/auth.ts - Database helpers → D1 database: reads and writes
- Audit trail → D1 database: writes audit log
src/worker/audit.ts - Reports and exports → D1 database: queries reports
- Support chat → Realtime support room: realtime chat
README.md - Support chat → Optional attachments: stores attachments
README.md - Integration outbox → External systems: dispatches events
README.md