api
presupplied
api | presupplied | |
---|---|---|
2 | 1 | |
246 | 0 | |
1.6% | - | |
8.6 | 8.4 | |
9 days ago | 5 months ago | |
JavaScript | TypeScript | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
api
presupplied
-
Show HN: Build type-safe web APIs with JavaScript, instantly
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.
What are some alternatives?
learn-nodejs-hard-way - Learn and master NodeJS and backend development by creating a backend framework with 0 dependencies.
zod-to-openapi - A library that generates OpenAPI (Swagger) docs from Zod schemas
instant - JavaScript API framework with ORM, migrations and vectors
FastAPI - Easily create robust, standardized API endpoints using lightning-fast database queries
zod - TypeScript-first schema validation with static type inference
backend-server - 📠 The backend of the Fairfield Programming Association website.
SheetJS js-xlsx - 📗 SheetJS Spreadsheet Data Toolkit -- New home https://git.sheetjs.com/SheetJS/sheetjs