153 lines became 94: what Hono took out of every feature

EngineeringHonoTanStack StartAdonisJSBunAPI design

Syahmi RafsanjaniCo-founder, CTO

I liked AdonisJS but feared being locked into its way of doing everything. For Flair v2 I moved to Hono inside TanStack Start, on Bun. Saving a customer went from 153 lines of server code to 94, and memory fell by a third.

In Flair v1, adding one field to a customer meant touching five places: the route, the controller, the Vine validator, the action, and the transformer that built the page afterwards. The action was where the real work happened. Everything else was there because the framework wanted it.

Every one of those lines has to be read, kept working and upgraded, for as long as the app lives.

So when I threw v1 away, the stack question wasn’t only about speed. Which framework would leave the least code to look after?

I liked Adonis, and I was afraid of it

I like the way Ruby on Rails works: omakase, the framework chooses for you, and everything fits together. Adonis is the closest thing in TypeScript. Its conventions are strong, the latest major version was very good, and almost everything we needed already had an Adonis library.

That was also what worried me. When a framework brings its own router, validator, ORM, queue and frontend glue, you end up locked into its ecosystem. NestJS is the extreme version of that. Adonis is less strict than Nest, but it still has its own way of doing everything, and leaving means rewriting all of it.

It also tied us to a runtime. Adonis doesn’t run on Bun, so v1 ran on Node in production, with Bun only as our package manager. Node was slower and used more memory. And Adonis can’t run on Cloudflare Workers, where Hono can.

If I could go back, I might keep an Adonis backend and put TanStack Start in front of it. Inertia.js was the real pain, not Adonis. But for us, Hono is simpler. We already have our own conventions, written down for the agents to follow, so we don’t need a framework’s wiring in every file. And the pieces around it aren’t tied to any framework: Zod for input, Drizzle for the database, pg-boss for jobs.

Why Hono inside TanStack Start, not server functions

TanStack Start has two ways to run code on the server. Server functions are typed, but only for the Start app itself: a mobile app can’t call them. Server routes can be called from outside, but they’re a plain request in and response out, with no input schema and no typed client. Hono gives us what we need from both:

TanStack Start server functionsHono inside Start
Who can call itOnly the Start web appThe web app, a mobile app, anyone with access
Input checkedYes, by its validatorYes, by the action’s Zod schema
Typed clientBuilt in, web onlyHono’s typed client, for web and mobile
OpenAPI specNoAvailable if we ever need one
DeploySame processSame process, mounted inside Start

Each module’s routes are one Hono chain. The web app calls them through Hono’s typed client today, and a mobile app can use the same client later. Mounted inside Start, it’s still one process and one deploy.

Where the lines went

It isn’t that v2 is smaller overall. Without the modules we removed, the two apps are about the same size. The difference is the code each feature needs before it does anything.

Saving a customerv1 (Adonis)v2 (Hono)
Route2 lines2 lines
Controller34 linesnone
Input schema24 lines20 lines
The action itself93 lines72 lines
Server total153 lines94 lines

Those are the five places from the start of this post. In v2 the glue around the action is written once, about 380 lines shared by every action, and a feature is mostly its action and its schema. A request to edit a customer passed through about ten layers in v1, and about seven in v2.

Editing a customer, in each version.

These counts are app code only. They leave out database migrations, generated files, tests, and the spec and HTML mockups in the docs folder.

Fewer lines per feature is the part that pays off over years, not weeks. Less code means less to read, test and upgrade, so every new feature takes less time, and so does keeping the old ones working. For a business with one developer, that’s the difference between shipping and maintaining.

It matters for hiring too. Hono, Zod and Drizzle ORM are widely used, and our conventions are written down in one file. A new developer, or a new agent, can be useful on day one, without first learning one framework’s way of doing everything.

A third less memory

Both versions ran on the same VPS, with the same features: from 2 November, v1 also converted catalogue photos to JPEG for Meta and Google, as v2 does.

Memory, same featuresWebJobsPostgresTotal
v1 (Adonis on Node), 4–10 Novabout 410 MBabout 240 MBabout 123 MBabout 775 MB
v2 (Hono on Bun), 11 Novabout 205 MBabout 120 MBabout 200 MBabout 525 MB

The web process uses about half as much, and the total is about a third lower. Postgres uses more in v2, because more of the work happens inside it: pg-boss runs our jobs, retries and schedules there, and live updates listen on it. Add jobs and Postgres together and the two versions are close. v2’s numbers cover only its first day, so I’ll check them again in a month.

One core, many channels

There’s one more thing both versions were designed for: channels we don’t have yet. Today Flair serves the staff web app, the Claude and ChatGPT apps, our payment, WhatsApp and delivery providers, and the photo feed the Fleur Babes website reads. One day it should serve checkout on the website again, and a mobile app.

Flair v1 already kept the business logic in actions shared by the web app, the API and MCP. Flair v2 made it the shape of the whole codebase:

  • Hono is the only API. No TanStack Start server functions, because a mobile app can’t call them. The web app and a future Expo app share one typed API.
  • App routes live under /api/v1 from day one. Mobile builds can’t be updated instantly, so a breaking change becomes /api/v2 instead.
  • Money crosses the API as whole sen, and dates as ISO strings, so web and mobile read them the same way.
  • The website’s feed kept its URLs through the rewrite, so nothing on fleurbabes.com had to change.
Every channel is a door onto the same core actions. Dashed lines are channels to come.

So bringing ecommerce back to the website, or shipping a mobile app, means a new client on the same API and the same actions. Not another rewrite.

The lesson

Pick the stack that leaves the least code to maintain, and the most pieces you can swap.

What I’d tell anyone choosing a backend framework

  • Measure one feature end to end. The whole app’s size hides how much glue each feature needs.
  • Prefer pieces you can swap. Zod, Drizzle and Hono don’t care which framework sits around them.
  • Pick one API every client can call. If your phone app can’t call it, you’ll be writing a second one.
  • Compare memory with the same features. Our v1 numbers only became fair after both versions did the same work.

With the stack chosen, the next step still wasn’t code. It was a spec, mockups and a design system, made before AI wrote a line of code.

Syahmi RafsanjaniCo-founder, CTO

Choosing a stack you'll still be happy with in five years? Let's compare notes.

Book a free callSystem review · build work · fractional CTO
Syahmi RafsanjaniCo-founder, CTO