Our great sponsors
-
FastAPI
Easily create robust, standardized API endpoints using lightning-fast database queries (by thestorefront)
-
SurveyJS
Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
Interestingly I published a Ruby framework called FastAPI before Python’s FastAPI existed ;) — been thinking about this stuff for a long time.
https://github.com/thestorefront/FastAPI
We tried for years to do things like this, and in the end an approach using typescript is way, way better than anything else I've seen attempted.
In my latest project[1], we set up the types for the API. The server and client are both bound by those types, meaning that one cannot change without the other. This fixes an entire class of bugs where backend code gets updated without the corresponding front-end code changing or vice-versa. It also has the nice side-effect that all of the possible return values (including errors) are nicely documented in one file, and that the errors are very consistent. On the frontend we have a "typed fetch" which returns typed results from the API.
We are also using this for typed access to localStorage, another source of many bugs in past projects, where random keys end up being scattered and causing nondeterministic behavior on different devices.
You can see how our API type system is implemented here:
common types for both client and server: https://github.com/stoarca/presupplied/blob/master/images/ps...
client's typed fetch: https://github.com/stoarca/presupplied/blob/master/images/ps...
server's typed endpoint definitions: https://github.com/stoarca/presupplied/blob/master/images/ps...
[1]: We are working on https://app.presupplied.com, a digital home-schooling curriculum to teach 3-year-olds to read. Planning to expand to math, writing, and programming.
And if you like Zod, you might as well use this: https://github.com/asteasolutions/zod-to-openapi
It converts Zod types to OpenAPI specification.