It’s time for the weekly diary. Last week, I spent 7 hours programming my personal website during my free time after work.
Huma & OpenAPI Integration 🌐
I integrated the Huma Rest framework into the project. The idea has been around for a while, but I couldn’t seem to bring myself to start it. However, last week I finally made the switch. I tried using an LLM to speed things up, but since Huma Rest isn’t a very popular library, the LLM frequently gets confused. This was especially noticeable during the initial stages when there were no examples in my project’s code.
As a result, I now have documentation for my server in OpenAPI format. This documentation is automatically imported into the frontend code. I didn’t have this luxury before, and I had to manually write every function twice: first in Go, then in TypeScript. Now, it’s enough to write the Go code, and the compiler detects errors in TypeScript.
I checked the server performance after switching to Huma Rest and got the following results:
- Go Standard Library HTTP: 300 requests per second
- Using Huma Rest: 260 requests per second
Performance dropped, but not critically: we’re losing about 13% 📉.
Summary
Consequently, I have this question for myself: Wait, could I have done it like that all along?? 🙄 Could I have connected Huma Rest from the very beginning and not had to worry about manually writing every new API? Yes, but it’s not that simple. Besides the performance drop, there are two other drawbacks:
- The framework’s code changes periodically, while the Go Standard Library remains stable almost forever.
- I spent another week on refactoring. This time could have been spent on new features.
I won’t let these drawbacks get me down, of course. The project will continue to use Huma Rest because reducing manual work is a huge plus 💹.