oneFlow is a single Next.js application on a single MongoDB database. Its interest is not in scale. It is in the number of different actors that touch the same records: staff in Slack, staff and clients in a browser, applicants and mail recipients on public pages, and four outside services that have to be told what changed.

The system on one page

Three entry points at the top: Slack, sending signed slash commands and modal submissions; a browser, for staff and client users; and public pages, for applicants and mail recipients. Each points into a box labelled one Next.js process. Inside it: Slack routes that verify the signature and route by command or callback; API routes with one folder per domain; public routes for applying, booking an interview and unsubscribing; rules for workflow transitions, the role matrix, recurrence and conflicts; a reminder route called every minute that sends each reminder once; and outbound, the calendar sync and a notifier for Slack, SMS and email. Slack routes point to rules, and rules point down to MongoDB in a state band that also holds object storage for applicant documents and mail images. The reminder route points to outbound, and outbound points to a column of third parties: the Slack Web API for modals, direct messages and channel posts; Google Calendar with one calendar for rooms and one for studio slots; an SMS gateway for interview notices and host confirmations; an email provider for campaigns with an unsubscribe header; and parcel tracking and an LLM for sample shipments and mail drafts.
Figure 1. System architecture. Three kinds of entry point reach one process. Rules for workflow, roles, recurrence and conflicts sit in shared modules, and calls to outside services are made after the database write.
ComponentTechnologyResponsibility
Web applicationNext.js 14 App Router, React 18, TypeScript in strict mode, TailwindStaff and client screens, public application and unsubscribe pages
APINext route handlers, one folder per domainReservations, studio slots, broadcast projects, hosts, brands and agencies, hiring, mail, notifications
Slack entryTwo route handlers: commands and interactionsSignature check, command routing, modal submissions, menu actions
RulesPlain TypeScript modulesWorkflow transitions and preconditions, the role matrix, recurrence generation, conflict queries
DatabaseMongoDB, official Node driver, no ODMOne database, one shared client per process
FilesObject storage with presigned accessApplicant documents, mail images
Calendar syncGoogle Calendar API, service accountOne event per booking, updated and deleted by a stored event id
NotifierSlack Web API, SMS gateway, email providerDirect messages, channel posts, SMS, campaign mail
Processpm2, one instanceRestart on failure and on a memory ceiling
TestsVitestPermission matrices, workflow transitions, field rules, ownership checks

Three ways in

Slack. Two Slack apps point at the same pair of routes: one bot for meeting rooms and one for the studio. Every request carries a signature. The route computes its own over the raw body with each bot’s signing secret in turn, and whichever secret verifies decides which bot’s client answers. A request older than five minutes is refused. The details are in Room booking from Slack.

The browser. Staff sign in with an email and password after an admin has approved the account. Client users, the brands and agencies the company works with, join through an invitation link that expires after seven days and is tied to their brand or agency.

Public pages. Three groups of people use the tool without an account: job applicants, who apply and book interviews, people who fill in a marketing diagnosis, and mail recipients, who unsubscribe.

Data

Each module owns its collections. Nothing is shared through an ORM layer: route handlers and library functions use the driver directly, with TypeScript interfaces describing each document.

ModuleCollectionsWhat a document is
Accountsusers, invitations, page permissionsA person with a role, a rank and departments. A pending client invitation. The allow-list for one page
Calendarreservations, live broadcastsOne booking of a room on one date. One studio slot with its crew
Broadcast projectsbroadcast projects, show hosts, brands, agencies, categoriesOne client broadcast with its stage, dates, hosts, design assets and report. The host roster. Master data
Hiringcareers, applicants, interview bookingsOne job posting with its interview slots. One applicant with a stage and an SMS history
Notesmeetings, team notes, revisionsTeam-lead meeting notes with every revision kept
Mailmail contacts, campaigns, logs, imagesOne contact with imported fields and a subscription status. One campaign and one log row per recipient
Leadsdiagnosis leads, events, settings, recipientsLeads from the two marketing funnels
NotificationsnotificationsOne in-app notice

Dates and times are stored the way the office reads them: a date string and wall-clock times in Korean time. Google Calendar events carry the same local time with an explicit time zone.

Permissions

A table of three layers. Role: nine roles, from staff, designer and writer to team lead, director and client; it decides which of twenty actions a person may take and which workflow transitions they may trigger. Rank and department: six ranks, the departments a person belongs to and the ones they lead; it decides who may use the mail module, and where a rank is missing it is derived from the older role. Page allow-list: for each managed page, the people allowed in; it decides which parts of the tool appear for a person, and a page with no list is open to every signed-in user. A note: clients are users too; a brand or an agency joins by invitation with a link that expires after seven days and sees only the projects tied to its own brand or agency.
Figure 2. Three layers of permission. Roles decide actions and workflow moves, rank and department decide access to modules such as mail, and a per-page allow-list decides what appears for a person.

The first model is roles: nine of them, each mapped to a set of twenty actions, with each workflow transition listing the roles that may trigger it. The broadcast workflow still runs on it.

A second model, added in April 2026, describes a person by a rank, the departments they belong to and the departments they lead. Where a user has no rank yet, it is derived from their role, so the two models work side by side without a migration that has to happen all at once.

The third layer is a page allow-list that an administrator edits in the tool. A page with no list is open to every signed-in user. A page with a list is open to the people on it.

What happens after a write

A booking, a stage change or a host selection usually has to be announced somewhere. One notifier function takes an event and fans it out: an in-app notice for everyone, a Slack direct message for internal users, an SMS for client users, and for some events a post to a team channel.

All of that happens after the database write. On the Slack path the calendar sync and the confirmation message are started and not awaited, because Slack closes the request after three seconds and a slow calendar call must not turn a saved booking into an error on the user’s screen.

Meeting reminders are the one piece of scheduled work. A route designed to be called once a minute finds today’s bookings whose reminder time has arrived, and sends each reminder once. It knows a reminder has been sent because the booking keeps a list of the reminder keys already delivered.

Deployment

The application runs as one pm2 process. A deploy script builds locally, copies the build to the server without touching the environment files or uploaded documents, installs dependencies and reloads the process.

Decisions

1. Slack as an entry point with the same standing as the web. A room is booked, changed and cancelled from a slash command and a modal, and the day’s timeline arrives as a direct message. The web calendar shows the same records.

2. Two bots, one codebase. Rooms and studio slots are two Slack apps. They share the routes, the signature check and the modal builder, and are told apart by which signing secret verifies.

3. Respond first, sync after. The booking is the source of truth and the calendar is a mirror. The response to Slack depends only on the database. The mirror is updated afterwards.

4. One document per occurrence. A stored recurrence rule was the alternative. A weekly meeting for a quarter is thirteen bookings that share a group id, and thirteen calendar events. Conflict checks, reminders and edits then work on plain documents, with no rule to expand at read time.

5. The official driver and shared types, no ODM. Documents are described by TypeScript interfaces shared across the codebase. Queries are written as the database runs them.

6. The workflow as data. Allowed transitions, the roles for each, and the preconditions are three small tables and functions, separate from the routes. That is what lets the tests state the workflow as rows of allowed and refused moves.

7. Clients inside the tool. A brand or agency acts on its own project as a user with the client role: it accepts a date, confirms a host, and approves or sends back a design.