SaaS Engineering
What Production SaaS Teaches You About Edge Cases
How multi-tenancy, billing, scheduling, reporting and permissions turn simple-looking features into hard ones.
- SaaS
- Multi-tenancy
- Operations
Before the saws, I worked on a SaaS platform that gyms, studios and multi-location operators use to run their business: scheduling, billing, leads, member features and reporting. The same code serves a single studio and a national franchise, and they run very differently.
The main thing I learned there is that the UI is usually the small part of a feature.
Booking a class
"Let a member book a class" looks like one button. Before it can work, the code has to know:
- whether the membership is active and includes this class
- whether the class is full, whether there's a waitlist, and whether staff can override it
- whether the last payment failed
- whether the member belongs to a different location
- what happens if the class moves, gets cancelled or changes instructor after they book
Later, reporting needs to tell a no-show from a late cancel too. That one button touches scheduling, billing, membership rules, permissions and reporting, so I got into the habit of mapping all of that before changing anything.
Settings
Configuration is how one product fits many different businesses. It's also how a change that works for one customer breaks for another, because of a membership rule, a tax setting, a staff permission or a location policy nobody tested.
The default setup rarely looks like a real customer's, so I test settings like any other input: which ones interact, which combinations are common, and which are risky. Sometimes the better fix is changing the model so a bad combination can't exist, instead of adding another if-statement.
Tenants
In a multi-tenant system, every query also has to get the right customer's data. Tenant IDs, location scoping, role checks and report filters look like plumbing, but they're what lets many businesses share one system safely.
They change how features get built, too. A query that's fast on a dev database can be slow on production data. A report that's right for one location can be wrong across several. A background job that touches shared tables needs the same filtering as a request, and logs that show it applied it.
Reports
Day to day, staff can work around a vague state because they know the context. Reports can't. They add things up, and owners make decisions from them: revenue, attendance, payroll, retention.
That makes reporting the place where unclear workflows show up. What counts as a completed booking? When does revenue count? How does a refund show up? Is a staff override recorded as one? Each of those is a product decision, and if the data model doesn't record the answer clearly, every report answers it a little differently.
Who it affects
Bugs on this kind of platform land on real people. A billing mistake can reach someone's payroll. A scheduling bug can leave a member at the front desk for a class that isn't there. A permissions mistake can show data to the wrong person.
Working there made me add more validation, clearer error states and more careful migrations, and ask who relies on a behavior before I change it.