Most web apps you use are really two things. There is the part on the server that keeps the data and does the work, and there is the part you see in the browser: the pages, buttons, charts and forms. In a lot of companies these are built by different teams, shipped separately and often hosted in different places.
Our server apps are built differently. The web interface lives inside the same program as the server. You install one file, start it, open the address in a browser, and everything you see comes from that one program on your own machine.
This post explains what that choice gives the person running the app, what it costs, and when we would pick the other way.
What “built in” actually means
When we build a server app in Go, the finished web interface (its pages, styles, scripts, icons and fonts) is packed into the program itself at build time. Go supports this out of the box, in its standard library. The result is one program that can serve its own interface without a single extra file next to it. Delete the folder the pages were built from, and the program still shows them, because it never needed that folder after the build.
The same goes for the database setup. The steps that create and upgrade the database tables travel inside the program too, so a new version brings its own changes with it and applies them when it starts.
Some real cases:
- OXI Metric, our open source analytics server. Its web console is part of the server program, so there is no separate frontend to deploy. Every script and stylesheet the console uses is served by the program itself.
- A sync server for a to-do app. People can host it themselves. The web version of the app comes inside the server, so the same install gives you sync and a browser client.
- A self-hosted analytics tool for our store sales. One program, one database file, and a dashboard built in.
Installing is copying one file
For someone who runs the app, this is the part that matters most. There is no web server to configure for the frontend, no second package that has to match the first, no build step on their side. It runs the same way on a small rented server, an office machine or in a container. The container for our sync server holds the program and practically nothing else: no operating system tools, no shell, nothing to patch except the program itself.
That fits with how we choose the rest of the stack. In Go or Rust, how we pick the language we wrote that code which runs on its own, on a server, for years, is where Go is the natural pick. A program that also carries its own interface is the logical next step: there is one thing to run, so there is one thing to keep running.
Nobody else sees your users
This is the privacy side, and it is easy to miss.
A typical web interface loads parts of itself from other companies: fonts from a font service, scripts from a public file host, a chart library from someone else’s servers. Every one of those requests tells that company the visitor’s address, which browser they use, and which page of which app they just opened. Nobody planned that data flow. It is just how the page was put together.
When the interface is inside the program, everything it needs to work is already there. The browser talks to your server, not to a chain of other companies. OXI Metric and the sync server go one step further and tell the browser so: they send a strict security policy that allows scripts, styles and data only from the app’s own address. If some script ever ended up in the page by mistake, the browser would refuse to send anything to a foreign address.
For a business running our software for its staff or its customers, that means one less thing to list in a privacy notice, and one less company to sign a data processing agreement with. In why we build with Go, Flutter and Rust we wrote about keeping private data on the phone whenever we can. This is the same idea on the server side: what never leaves your machine needs no promise from anyone else.
It also works offline in the boring sense. A server in a closed office network, with no internet at all, shows its interface exactly as it does anywhere else.
Updates and going back
Because the server and its interface are one program, they always match. There is no “new page talking to an old server” moment, no cache serving yesterday’s scripts against today’s data, no half-finished update where one side moved and the other did not.
An update is replacing one file and restarting it.
Going back is putting the previous file back. That is simple, but there is one honest condition: if the new version already upgraded the database, an older program may not understand the newer tables. So the rule is the same as for any app that keeps data: take a backup before the update, and if you ever roll back, restore the backup that belongs to that version. Our apps make that backup easy, because their data is usually a single file too, as we described in SQLite or PostgreSQL.
When a separate frontend is the better choice
One program is not the right shape for everything. We would split the web interface out when:
- Separate teams own the two parts. If a design team ships the interface every day and the server changes once a month, tying them into one release slows everyone down.
- The site has heavy public traffic. A public website with visitors from all over the world benefits from copies of its pages stored close to each visitor. Static files on their own are easy to spread out like that; a program on one server is not.
- The interface is mostly marketing. A product website, a blog, a documentation site: these are static pages, and they are better served as static pages. This blog is one.
- Many clients share one server. If a mobile app, a desktop app and three partner integrations all talk to the same server, the browser interface is just one more client of it. Building it in still works, but it stops being the main point.
Even then, the privacy part does not have to go. A separate frontend can still be hosted on your own server and load nothing from third parties. It just takes more care to keep it that way.
What to ask when someone installs an app for you
If a developer or vendor is setting up a self-hosted app on your server, a few questions show quickly how much you will have to look after:
- How many separate pieces have to run for this to work? Each one is something to update and secure.
- Does the web interface load anything from other companies’ servers? Fonts and scripts count. Open the browser’s network view once and look.
- How do I update it, and how do I go back if the update is bad? A clear answer is a short one.
- Where is the backup taken before an update? If nobody knows, there isn’t one.
For the kind of apps we build, one program that carries everything it needs is the simplest thing to install and the hardest thing to leak from. You get one file to run, one file to update, and a browser that only ever talks to you.