Web AppProjects

Digital OS for a group of companies

Digital OS brings 8 departments into one system — designed to scale in user count, role hierarchy and international markets, with a design system, RBAC and bilingual i18n from day one

8 min read

An internal portal that brings Real Factory's 8 departments into one system — from documents scattered across Excel, LINE and email to a single source of truth

Internal Portal8 ModulesRBAC 18 RolesVue 3 + TypeScriptDesign SystemMulti-Tenanti18n TH/EN

The problem

Why does a group of companies need its own Digital OS?

Before and after diagram: tools scattered across many channels, merged into one portal with 8 modules
Before → after: from spreadsheets, chat, forms, email and print-sign-scan to a single portal (illustrative diagram)

8 departments each used their own set of tools — purchase requests in Excel, expense claims in LINE, accommodation bookings in Google Forms, flight tickets over email. The approval cycle took 3–5 days per document and nobody could see the big picture. Management didn't even know whose desk a request was stuck on.

— Insight from stakeholder interviews before the project started

8 departments on separate tools, no one sees the whole picture

Purchase requests in Excel, expense claims in LINE, bookings in Google Forms, flight tickets over email — no single source of truth, no way to tell which stage a document is at

A 3–5 day approval cycle per document

Documents had to be printed → signed → scanned → passed on. Management couldn't see who was holding things up, and overdue items went unresolved — affecting plans across the whole company

No audit trail — nothing to trace back

Who approved, who rejected and why, whether spending went over budget — none of it was recorded. Every audit turned into a document hunt

Every PDF made by hand

Open Word, fill in the numbers → export PDF → print → sign with a pen → scan it back — slow, error-prone, with no standard layout

15+ user roles with different permissions

Role checks hardcoded across the codebase — adding a single new role meant editing every page. Not maintainable as the company grows


The solution

One portal — a Digital OS pattern that serves every department at once

Purchase request detail page showing approval status step by step
A real PR detail page: the approval chain follows the amount, so you can see at a glance which step it's waiting on (approver names blurred)

One portal for every request type

PR/PO, expenses, bookings, HR requests — all in one portal, one source of truth. Users log in once and see all of their own tasks

A configurable approval engine

One central state machine handles chains like M3→E1→E2→E3→CEO based on amount — each doc type and department configures its own, no new code needed

Real-time status via Socket.io

Requesters see right away who has their request, and management sees an "overdue" dashboard in real time — follow-ups in LINE dropped by more than 80%

A reusable document PDF component

Voucher + signature block + attachment index = shared components that work for every doc type, no duplicated layouts

RBAC with 18 roles and separate approval levels

M3/E1/E2/E3, Finance Lv1/Head, Acc Lv1/Head, Procurement Manager + Reviewer and more — mirrors the real org chart, configured through a permissions matrix

Bilingual TH/EN i18n from day one

Every string goes through the useLocale composable with a type-safe LocaleKey, ready for expansion abroad without a refactor


Architecture Overview

Vue 3 + Express + Prisma — Modern stack, shared types, single source of truth

Portal dashboard with shortcuts to create documents, announcements and a document tracking table
Frontend — Portal SPA (Vue 3 + PrimeVue + Tailwind): the home dashboard (logo hidden, names blurred)
Frontend — Portal SPA
Vue 3.5 Vite 8 TypeScript PrimeVue 4 Tailwind v4 Pinia 3
↕
@portal/shared — Zod Schemas
Validation Types Single Source of Truth
↕
Backend API
Express 5 Prisma 6 JWT + Google OAuth Socket.io Pino Logger
↕
Infrastructure
PostgreSQL (Supabase) Supabase Storage Docker Railway / AWS ECS GitHub Actions

What I built — 8 modules

Phase 1 MVP — Core Platform + 7 Functional Modules

Table of expense claims across types: Petty Cash, Reimbursement, Advance, Credit Card, Travel
Expense Suite — 5 sub-flows in one table
Think Tank activity page with individual and department rankings
Think Tank — individual and department leaderboards (names blurred)

PR / Procurement

Purchase Request + PO with approval chain (M3→E1→E2→E3→CEO by amount) + supplier comparison

Expense Suite

Petty Cash, Reimbursement, Advance + Clear, Credit Card OCR, Travel — 5 sub-flows + WHT 1/2/3/5%

Booking

Accommodation (HR confirms from the company voucher pool) + flight tickets (HR attaches the e-ticket)

HR

Employee Directory, Vehicle Registry, Course Library, Form Templates, Announcements

Think Tank

Engagement activities + leaderboard + scoring by C-level, with result reports

Legal

Knowledge Base + AI Chat (Phase 1: Legal Admin only) — collects contracts and internal legal references

C-Level Dashboard

Pending approvals, Budget vs Actual, Approval Bottleneck, Department Ranking, Spending Trend

Admin

Permissions Matrix (18 roles × all routes), workflow config, system settings — change permissions without a deploy


Hacks for hard problems

6 challenges that weren't in any playbook — I had to work out the workarounds myself

Expense claim approval status passing Acc Lv1, Head Acc, Finance Lv1 and Head of Finance
How the roles actually split: department head → Acc Lv1 → Head Acc → Finance Lv1 → Head of Finance (approver names blurred)

RBAC: splitting 11 roles into 18

The PRD specified 15 roles, but the codebase had collapsed them into 11 → approval thresholds didn't match the real org chart. People who should see a document couldn't, and people who shouldn't could

Fix: split manager → m3/e1/e2/e3, Finance → Lv1/Head, Acc → Lv1/Head, Procurement Manager + added Reviewer + a per-role tab filter + backward-compatible normalization of legacy roles through a mapping function

Document PDFs that scale to 8 doc types

8 doc types × signature block × attachment index × a need for real PDF merging (text-selectable) — duplicating the layout per doc would be a maintenance nightmare

Fix: shared components in components/document/* (SignatureBlock, AttachmentIndex, AttachmentPage) + pdf-lib to merge real PDF bytes at the end + html2canvas for image-only attachments — one abstraction for every doc

Project-wide i18n in one sprint

~50 views, 1,000+ strings, and strict TH/EN parity (a missing key on either side breaks the build) — no way to do it by hand alone in time

Fix: a handwritten useLocale composable (zero dependencies, type-safe via a LocaleKey union) + batches delegated to 10 subagents + an automatic type-check on every batch before commit → TH/EN parity enforced by TypeScript, not discipline

A login page that fought dark mode

The app supports dark mode everywhere, but the login page is a brand experience that has to stay white with a dark brand panel — the token cascade kept flipping its colors when dark mode was on

Fix: a .login-light-scope pattern that locks token values inside a CSS scope; the brand panel hardcodes #231F20 + an !important rule to block cascade overrides; SplashScreen reuses the same pattern

Approval Bottleneck Real-time

C-level wanted to see whose desk a request was on, which step of the chain, and for how long — and refreshing the page wasn't fast enough

Fix: Socket.io broadcasts every approve/reject event to the company's channel; a dashboard chart of items "pending >24 hrs" sorted by time + drill-down to the approver's name + one click to send a LINE notification directly

100% design tokens — stopping drift before it starts

Tailwind v4 + PrimeVue Aura theme + custom tokens — 3 layers that can override each other. Without rules, hardcoded hex values keep sneaking in

Fix: audited hardcoded hex values → swapped them for CSS variables; token definitions in design-tokens.css as the single source of truth; dark mode flips via :root.dark-mode overrides — no Tailwind dark: variants needed

Stakeholders & Build Period

An internal product — co-designed with the real team in every department

Announcements page combining posts from the company, HR, IT, Finance and Safety
Announcements from several departments in one feed — every department is both a user and a co-designer

Digital OS wasn't designed from an ivory tower — every flow went through workshops with the actual HR, Finance, Accounting, Procurement, Legal and C-level teams, and every approval threshold comes from Real Factory's actual policy


Real Factory Group

Client + production team — stakeholders from 8 departments


Build Period

6 weeks — Phase 1 MVP (Core + 7 modules)


Team Composition

TechLead, PM×2, BA, UX/UI — cross-functional small team


AI-Augmented Workflow

BMAD framework + Claude subagents for i18n and create-story

Why does co-design matter for internal tools?

Internal users can't leave — if it's mandated, they have to use it. But if the design misses their real pain points, they'll find a workaround and go back to Excel. Co-design means every approval rule, every field and every label comes from real domain experts, not assumptions


Key Takeaways

4 design thinking lessons from Digital OS

Document tracking page showing number, type, details, amount and status
Document tracking — every doc type uses the same table and status badges (composition instead of duplication)
Empathy first — splitting into 18 roles brought the approval flow close to the real org chart:

At first I used the 11 roles the codebase already had. When I tested with the actual Head of Finance, he said, "I'm not Lv1, I'm the Head — why do I see the same documents as Lv1?" That's when I realized roles have to reflect the real hierarchy, not be reduced to make things easier for developers. In the end I split them into 18 roles, and approvals now match company policy exactly

Single Source of Truth — design tokens + Zod schemas + DEPARTMENT_LABELS:

If one constant lives in 3 places, it will drift — not "if" but "when". Digital OS forces every type, every validation and every label to come from a single source → the frontend and backend can't fall out of sync, and tokens and components can't contradict each other

Scale by composition — 4 shared components cover 8 doc types:

SignatureBlock + AttachmentIndex + AttachmentPage + DocumentLayout — just 4 components with one prop interface generate 8 doc types (PR, PO, Petty Cash, Reimbursement, Advance, Clear, Travel, Booking). Duplicating per doc would mean 8× the maintenance — composition beats duplication every time

Subagent workflow — 1,000+ i18n strings done in one day:

Translating file by file, string by string, is a nightmare — so I ran 10 Claude subagents in parallel, each taking a batch of views, with an automatic type-check guard before commit. If a key is missing, TypeScript fails immediately — no reliance on human discipline. The point is to design guards a machine can check, not a checklist in Notion

8
Modules
18
User Roles (RBAC)
2
Languages (TH/EN)
6w
Phase 1 MVP

Tan · Natpakan Sirirat

Product Designer & AI Builder — designing user experiences and building AI tools that actually work.

0%