Case study
Appointo
A booking platform for local service businesses: one API, a web app and a mobile app, live on the web, the App Store and Google Play. This page covers how the hard parts work, what each one cost, and what I would change.
- Role
- Founder and sole developer. A business partner handles marketing and sales.
- When
- 2026 to present
- Stack
- TypeScript, Fastify, PostgreSQL, Prisma, React, Expo
The problem
Local service businesses in North Macedonia — salons, barbershops and studios — take bookings by phone call and Instagram DM. There's no shared availability, no record, and no way for a customer to see what's free at 6pm on Thursday without asking someone.
What I built
Appointo is one API, a web app and a mobile app. Four roles use it. Clients search for a business, pick one or more services, a professional and a time, and book. Owners run the calendar, team, services, opening hours and booking rules. Staff sign in to see their own day. An admin approves each new business before customers can find it.
Behind them is a Fastify and PostgreSQL API of about 230 endpoints over 33 tables. The web app is React. The mobile app is Expo and React Native, and it is live on the App Store and Google Play. All of it is available in English, Albanian and Macedonian. I am the only developer.




Architecture
Appointo is a modular monolith: one Node.js process running Fastify, split into 28 modules, in front of one PostgreSQL database. There is no queue, no cache server and no second service. Background jobs run on a timer inside the API process, and the availability cache is a map in memory.
The part I would point to is the shared package. Types, time-zone handling, the availability engine and the visit planner live in one TypeScript package that is compiled into the API, the web app and the mobile app. The app can show a customer the same slots the server will accept, because both run the same code. The server still checks everything again.
One process was the right size because the product has one developer and a small number of businesses. A monolith on one database gives me a transaction around the whole booking flow and one thing to deploy.
Trade-off
It is built for a single instance. The cache, the rate-limit counters and the job timer all live in the process, so running a second copy would change how they behave. Moving those out is the first job if the load ever calls for it.
No double bookings
Problem
Two customers open the same business, see the same free slot and tap it within the same second. If the API asks "is this free?" and then inserts, both checks pass and both bookings are saved.
Approach
I let the database decide. A PostgreSQL exclusion constraint on the bookings table refuses any two active bookings for the same staff member whose time ranges overlap. The API plans the visit, inserts it inside a transaction, and if the constraint rejects the insert the whole visit rolls back. The API turns that rejection into a 409 with the code VISIT_SLOT_TAKEN and the nearest free times, so the app can offer an alternative straight away.
The constraint works on multiranges, so a staff member stays bookable during a service's processing time, for example while hair colour develops. Each request also carries an idempotency key, so a retry after a dropped connection returns the original booking instead of making a second one. An integration test runs 20 parallel clients against overlapping slots and checks that only whole bookings remain.
Trade-off
The rule lives in raw SQL, because Prisma cannot express an exclusion constraint. I have to keep it in step with the schema by hand. The API also recognises the rejection by matching the database error, which would break quietly if the ORM changed its error format.
Planning a multi-service visit
Problem
A customer wants a cut, a colour and a manicure in one visit. Each service can be done by different staff, and each of them has their own hours, breaks and existing bookings. The customer wants one start time and no long waits in between.
Approach
For each possible start time the planner tries the allowed service orders and searches depth first, placing each service with each eligible person at the earliest start that still leads to a complete plan. It drops a branch as soon as some remaining service has no reachable start for anyone. Complete plans are scored: earliest finish, then fewest hand-offs between staff, then least waiting. A visit can hold up to six services.
The planner is pure code in the shared package, so the server and both clients run the same logic. Separately, I wrote a validator from the booking rules and not from the search. The server uses it to check the plan a client sends back, and a seeded random test generates 5,000 days and requires every plan the search produces to pass it.
Trade-off
The search has a budget of 2,000 placements per start time. That keeps the response time predictable, and it means the search is not exhaustive. On a very crowded day it can miss a plan that exists, and nothing in production records when that happens.
Sessions and two-factor
Problem
The first version signed users in with a JWT that stayed valid for seven days, whatever happened. Changing a password did not end it, and there was no "sign out everywhere". Owner accounts, which hold their customers' names and phone numbers, had no second factor.
Approach
Sessions are now rows in the database, one per device. The token is opaque and only a hash of its secret is stored, so a copy of the database does not contain usable sessions. The website receives the session in an HttpOnly cookie and must send a CSRF token with every change. The apps send it as a bearer token. One middleware handles both. A password change, an email change or "sign out of all other devices" ends sessions at once.
Owners and the admin must use an authenticator app, with recovery codes, and sensitive changes ask for fresh proof. To avoid signing everyone out, the API still accepts the old tokens from older app builds behind a switch, and checks them against a per-account version so a password reset ends them too.
Trade-off
I wrote the session protocol and the one-time-code check by hand instead of using a maintained library. It is tested, including replay of a used code, and it is security code I now have to maintain. Session lookups are also cached for a minute in each server process. The process that ends a session forgets it at once, which covers the single instance in production today, but on a second instance an ended session could keep working for up to a minute.
Changing the schema under a live app
Problem
I rebuilt the booking model around visits that hold several services. The earlier version of the app was still installed on people's phones, calling the old endpoints and expecting the old columns. I could not update every phone at once, and the product had to keep taking bookings throughout.
Approach
Migrations only add. New tables and columns went in beside the old ones, and the API writes both. A v2 API lives under its own URL prefix while v1 keeps answering old builds, with tests that pin the old response shapes. Existing data was moved by backfill scripts that are safe to run twice and have a dry-run mode. A read-only checker counts rows that break the new model's rules, so it can be run against production before and after a backfill. The admin can raise the minimum supported app version to retire old builds.
Trade-off
I did the expand half of expand-and-contract and not the contract half. Bookings still store their time in three forms, prices exist as both a float and an integer column, and about 60 v1 endpoints are still in the code. Rolling back a release stays simple because of that, and the schema is harder to read than it should be.
Security review
I went through my own system the way an attacker would: reading the sign-in and ownership checks on every route, then reproducing each weakness with a test. I documented 26 findings and fixed or mitigated each one, with regression tests so they stay fixed. Three of them:
- Account takeover before the owner ever signs in. Sign-up did not prove that an email address belonged to the person typing it, and Google or Apple sign-in joined an existing account with the same address. Someone could register another person's email with their own password and keep access after the real owner arrived. Now the account is created only after a code sent to that address is entered, and a first Google or Apple sign-in drops a password nobody proved.
- Rate limits that counted the proxy. The API saw the hosting platform's relay address instead of the visitor's, so the sign-in limit hardly applied. It now trusts exactly two proxy hops, which also ignores a forged forwarding header.
- An API open to every origin. Production accepted cross-origin requests from any website. A wildcard is no longer honoured, and there is an explicit allow-list.
The review also shows what was missing: for its first months the product had no security baseline at all. A few findings remain as accepted risks, each written down with the reason.
What I'd do differently
- Error monitoring and a staging environment from the start. Error tracking and alerting are not in place yet, and they should have been there from day one. There is also no staging, so every migration runs for the first time in production.
- Background jobs out of the web process. They run on a timer inside the API, with no history, no retry and no alert when one fails.
- Finish removing the legacy schema. The duplicate columns and the v1 endpoints described above should have been removed once the old app versions were retired.
- Appointment reminders. The product sends push notifications when a booking changes and has no "your appointment is tomorrow" reminder, which is a core feature for a booking product.