ORRN is the fifth version of an ERP I've been building since 2022 for an aluminum extrusion plant. Earlier versions were for one plant. ORRN is multi-tenant, so other plants can run on it.
What it does
Plants track dies, extruded bundles and receipts, stock, dispatch, and customers. Every bundle gets a label printed through orrn-spool, and every change lands in an audit trail.
How it's built
- Bun and Turborepo monorepo. Vite, React, and TanStack Router and Query on the web.
- Expo React Native apps for iOS, iPadOS, and Android, sharing a Tamagui design system with the web.
- tRPC end to end, served by Hono on Cloudflare Workers, with D1 and Drizzle underneath.
Decisions I made, and why
- Tenant isolation lives on the server. The API derives
companyIdfrom the session. A client can send whatever it likes; it never gets read. - One permission matrix. The same table drives the server middleware and the client's
<Can>components, so the UI can't drift from what the API allows. - Impersonation is time-boxed and audited. Support can see what a user sees, for a limited window, and that session is recorded.
What's next
The Workers and D1 version reached its milestones, and then the plant floor asked for things it can't do well, such as working through an internet outage. I'm rebuilding around ISA-95: a Postgres core with row-level security per tenant, and a box in each plant that runs offline and talks MQTT to the machines.