Summary
Making a lot of home projects mean there are a large number of application folders. All in various states of being complete and functioning. It occurred to me that I am often doing a lot of boilerplate work to create a database, some endpoints, or connect various services that are intended for use in a home lab setting. If that is the case, why not have a single api application that would handle many of the shared services instead. That way the management of those services can be in a single place and can be easily extended and maintained.
Tech
- TS - Use typescript to code all the endpoints
- Hono - A web application framework. Like Express, but different ( read: better )
- Bun - A JS runtime. Like Node, but different ( read: better )
- Ollama - A local llm runner
- Kokoro-FastAPI - A local only text to speech model
Process
- Identify a need across multiple homelab applications
- Outline what endpoint is needed to meet the need previously identified
- combine existing endpoints or create a new one to solve the need
- Any new endpoint should get it’s own file. The api manager app (LocalAPI) is setup to use file base routing
Concerns
- This has the potential to create many one off api endpoints if not managed correctly
- Lots of opportunities to rush through things without doing proper validation or error checking
- API is technically open to anyone on the local network. Not a huge concern, but still one that exists.
Description
The LocalAPI project is a great opportunity to create, update, manage and version an api meant for use across multiple applications in a specific location. Currently the first version is run using Hono. There is a need to add a build step and create a near full-time running application from the api codebase. It would make sense to keep the dev server and the “production” server separate. This would also make it more straight forward to add some basic access controls to the project like an api key for each application ( possibility to make a new api key project ). Or make a single api key that is available for each connecting device if it is authorized.