Dynamic fields: a small idea that re-shapes the backend
Server-side JavaScript scoped to a single field. No microservices, no Lambdas — just data that knows how to compute itself.
Engineering
By Turbofy®
Most backend code, when you look at it honestly, is doing one of three things:
- Computing a value from other values.
- Looking up a related record.
- Sending the answer back to the client.
We used to build a service for each of those. Endpoint. Handler. Probably a queue if we got nervous.
Turbofy's dynamic fields collapse all three into a single primitive: a few lines of JavaScript that live on the data itself.
How they work
A dynamic field is a field on a table — like priority on Inquiry — but instead of holding a stored value, it holds a function. When a client reads the field, the function runs server-side in a sandboxed VM and the result is returned as if it had always been there.
// Article.formattedDate
const d = $$self.publishedAt;
d ? new Date(d).toLocaleDateString() : '—';
That's the entire definition. Two lines. No deploy. No Lambda. No second project.
What you can do with five lines
More than you'd think.
- Derive values: a
fullNamefield that concatenatesfirstNameandlastName. - Look up related records: a
manufacturerfield onProductthat calls$$std.getRecord(...)and returns the manufacturer in one go. - Apply business rules: a
priorityfield that returns"high"when the order amount crosses a threshold. - Localise: a
localizedTitlefield that picks the right translation based on$$args.lang.
What changes when the backend is field-shaped
Three things get noticeably better.
Co-location. The logic for a value sits next to the data that defines it. New engineer wants to know how priority is set? They open the Inquiry table and read it. No cross-repo hunt.
Composability. Dynamic fields read other fields, including other dynamic fields. The system composes like a spreadsheet, not like a service mesh.
Latency. No round trip. The field runs on the same machine that serves the query. A read that used to be client → API → service → DB → service → API → client becomes client → API → DB.
The interesting thing isn't that dynamic fields exist. The interesting thing is what you don't need anymore once they do.
No more single-purpose microservice. No more queue for a one-line computation. No more separate repository for the "compute layer". The backend becomes the data, and the data knows how to think.
That's a small idea. It re-shapes everything around it.