[FEATURE] Add Bun server with API using TanStack and tRPC
Problem
Currently, the project doesn’t have a dedicated state management solution or an independent API layer. This makes it harder to manage shared state and handle data fetching in a scalable, consistent way. By introducing a separate API server and integrating modern state management tools, we can keep concerns clearly separated, improve maintainability, and make it easier for contributors to build new features without tightly coupling frontend and backend logic
Solution
Adding a Bun-powered API server would bring significant benefits to the project. Bun’s modern JavaScript runtime delivers excellent speed and up-to-date tooling, which can help us achieve better performance out of the box. By using tRPC, we gain fully type-safe, end-to-end API calls without the overhead of maintaining OpenAPI or GraphQL schemas. Combined with TanStack tools like TanStack Query, this setup enables efficient data fetching and caching on the frontend. Overall, having a dedicated, modern API layer improves separation of concerns and makes the project more maintainable and scalable in the long run.
My idea is to spin up a Bun server to handle all API routes, with tRPC managing the API procedures to ensure type safety across the stack. On the frontend, we can connect to this API layer using TanStack Query (or other TanStack libraries already in use) for seamless data fetching. The implementation should be kept modular so that contributors can easily add or extend endpoints in the future without friction.
Alternative
...
Anything else?
No response
this will come in neat later but we currently have one api route and soon none after we remove the waitlist so doing this later would make sense
Another consideration is using a database with sync capabilities, something like Convex. It would reduce the efforts with dealing with routes, managing states and syncing with the db in React Layer.
Although it may require some heavy changes to how the application handles state management, in the long run, the benefits would outweigh the setup. @mazeincoding