What your SaaS needs, on one server
What you buy as a managed service today runs in the same process for us, or beside it on the same server. The examples come from Libretto, our own SaaS for what a car costs.
Sign-in and accounts
Libretto has sign-in with a password or a passkey, email confirmation at sign-up and a limit of five sign-ups per hour and IP address. It issues OAuth tokens for its MCP server. All of it is in the same binary, without an auth service.
We haven’t built single sign-on over SAML or OpenID Connect yet. If your customers need it, it goes into the same binary as a library.
One database per customer
In Libretto every customer has their own SQLite file. A forgotten condition in a query therefore can’t show another customer’s data, and exporting or deleting an account touches exactly one file. The server opens a customer’s file when it needs it, and fetches it from the backup if it has to.
Monitoring and logs
Prometheus, Loki and Grafana run on the same server as Libretto and need about 1.2 GB of memory together. Among other things, the app reports open customer databases, its memory, and what external services such as text recognition cost per month.
Grafana checks rules for errors, capacity, backups and costs and sends alerts to a Discord channel. Which values should wake someone up at your company, and whom, we decide with you.
Backups and outages
Litestream copies every change to object storage about a second later, and a daily test restore checks that the copy works. If the server fails, a new one restores the data as it starts. Until it runs, the product is offline: that is the price of not running a cluster.
Deploys
Libretto has two slots for the binary. A deploy stops the running version cleanly, starts the new one in the other slot and switches only once it is healthy. For the few seconds in between, the web server holds the requests instead of showing errors, and the old version stays in place for an instant rollback.
On this website, open tabs get the new version over their stream after a deploy, without reloading.
Background jobs, mail and payments
Background jobs run in the same process, without a queue service. When a job has to survive a restart, it is a row in the database: for a newsletter Libretto writes one row per recipient, and a worker sends them and carries on where it was after a crash. Libretto sends mail through the host’s SMTP server, with SPF, DKIM and DMARC; its confirmation mails arrive in the inbox at Gmail and Outlook. Libretto bills subscriptions through Wallee.
Search
SQLite comes with full-text search, FTS5, which lives in the same file as the data. We haven’t needed a separate search service so far.
Privacy and security
Libretto’s server and backups are at Infomaniak and its mail goes through cyon, both in Switzerland. Fewer services mean fewer sub-processors to list in the privacy policy and in every contract. Libretto exports and deletes an account’s data on request.
We haven’t been through a formal audit such as ISO 27001 or SOC 2 yet.
When you grow
Many teams build for Google’s or Netflix’s load from day one: microservices, queues, clusters. Very few products ever reach that scale, and one server goes further than most people think. Stack Overflow answered about 209 million HTTP requests a day in 2016 with nine web servers, and according to Nick Craver it also ran on one. Let’s Encrypt issues the certificates for more than 235 million websites from a single database, to keep the complexity down. And Frank McSherry and colleagues showed in 2015 that distributed graph systems often needed hundreds of cores to beat a single thread on a laptop, and some never did.
Libretto runs on 2 CPUs and 1 GiB of memory. That fits about 320 connected customers, or about 260 when all of them are working at once. How many of your users are online at the same time?
Memory sets the limit, not CPU: a connected customer needs about 2.4 MiB while their tabs rest, and about 2.9 MiB when they are all active.
With 256 customers connected, a change shows on screen after 268 ms at the median, and within 620 ms in 95% of cases. When all 256 tabs reconnect at once, as after a deploy, 95% of them are connected within 307 ms.
Very large accounts of about 18,000 entries fit while they rest: 128 of them need about 560 MiB. When all 128 become active at once, the process hits its memory limit and some of the changes time out. For them, capacity is limited by how many work at the same time, not by how many are connected.
Measured on 10 November 2026 with Libretto 534bc3e and lith v0.5.5, the large accounts with Libretto 11f26ac and lith v0.5.6.
The next step is a bigger server: more memory means more customers, with no change to the code. If that isn’t enough either, customers can be spread over several servers, because each has their own file. That takes extra parts, though: a directory that knows which server holds a customer, a proxy in front that sends each request there, and one shared place for what all customers share, such as accounts and billing. Moving a customer then means restoring their file from the backup on the new server and changing their entry in the directory. Libretto hasn’t needed this yet.
The principles we build by
The technology behind it, for your developers.
One process that keeps running
The application doesn’t build itself up for every request; it runs as one process: in Go, or in PHP with an asynchronous runtime such as Swoole. That way it keeps open connections and state in memory. The code is strictly typed; in Go the compiler checks it, in PHP PHPStan does.
The server sends, the browser doesn’t poll
Over Server-Sent Events each tab keeps one HTTP connection open, and the server sends new HTML when something changes. It decides when and how often: it renders once per change for everyone, and a tab that falls behind gets the newest state instead of a backlog.
Measured on our Kanban board: 2.4 ms per frame at 200 tabs, and a moved card costs 0.5 to 1 kB on the wire. Most of the CPU goes into compression, and each busy stream holds about 2.2 MB of brotli state; compression level and window size trade memory for bytes.
The database in the same process
SQLite runs in the application’s process. A query is a function call instead of a network round trip, and writes go one after the other through a single writer, with reads beside it.
view = f(state)
The state lives on the server, and the page is a function of it. The browser gets finished HTML and morphs it into the page, so focus, scroll position and input stay. For what happens only in the browser, such as an open menu, there are signals.
Because the server sends HTML instead of JSON, the browser receives only what the page shows. A JSON API often returns more fields than the interface needs, and anyone can read each of them in the browser.
Collaboration without conflicts in the browser
A click sends a command over HTTP, the server decides on the new state, and every tab gets it over its stream. Writing and reading are separate (CQRS). Because no browser holds a state of its own, there is nothing to merge, even when several people work at once.
Event sourcing, where the history matters
Where it has to be traceable who changed what and when, we store the events rather than only the current state, and derive the state from them. New views then come out of the history that is already there.
Objections
What we hear most often in architecture discussions, and what we answer.
But SPAs are the standard
Single-page apps came up when browsers could hardly push or stream. Today they can do both, and the same interactivity works with HTML over a stream. We decide by the cost over the product’s lifetime, not by what is most widespread.
Without an SPA it feels slow
We measured it, on a mid-range phone over slow 4G. Our version of an AI chat app became interactive 8.3 times sooner than the Next.js original. On our Kanban board a moved card is confirmed by the server after 253 ms, where PLANKA, built with React, needs 712 ms.
Moving between pages doesn’t need an SPA to feel smooth either. With the View Transitions API the browser animates the move from one page to the next without a JavaScript router. On this website the header stays put while a deeper page slides in like a sheet, and a blog post’s image becomes its cover when you click it. That is about 80 lines of CSS and a script of under 2 KB. Speculation Rules let the browser fetch a page while the pointer rests on its link, so it is usually there by the time of the click. Browsers that can’t do this load the page as usual.
What about offline-first?
Offline-first means the browser shows a result before the server has accepted it, and has to take it back when the server refuses. That moves conflicts, rollbacks and their tests into every client. We keep the server in charge and show what it has confirmed; the stream bridges short drops in the connection. Where real offline work is needed, a native app is the better tool.
Scaling only works with microservices
Scaling depends on load and data flow, not on the number of services. A server renders once per change for everyone, and customers with their own databases can be spread over several servers. How far one server goes is under When you grow.
SQLite isn’t a production database
SQLite is transactional, ACID-compliant, and in every browser and every phone. What it rules out is many processes writing at once, and our architecture doesn’t need that. The writer of our Kanban board gathers waiting commands into one transaction, each in its own savepoint, and handles about 26,000 moves a second with 200 people at once, with synchronous=FULL, as durable as PostgreSQL’s defaults.
There are React Server Components
They move work back to the server too, but stay tied to React, its build and its hydration. We use HTTP, SSE and HTML directly, with no framework in between. That is less code to go out of date, and the server sends changes on its own instead of waiting for a request.
A frontend needs the npm ecosystem
Every package is code someone has to update, review, and replace when it has a vulnerability. Our version of the AI chat app needs 33 times fewer dependencies than the original. That means less attack surface and fewer updates that only the tooling demands.