Adding sqlc for end-to-end type safety from database to backend

The next thing I worked on for improving DX was making the database-to-backend flow feel more type-safe…

In this commit, I added sqlc because I did not want the backend to drift away from the current database schema. I still want to keep using raw SQL queries, but I also want stronger guarantees that what I write in the backend actually matches the schema and query results correctly.

That is why sqlc felt like a good fit here.

The idea is pretty simple. I create a sqlc.yaml file, configure what I need there, then write SQL queries inside the queries directory based on that config. After that, I just run make sqlc, and sqlc generates Go structs and query code from those SQL files.

The generated output goes into db/sqlcgen, following the config I set. From there, the backend can use those generated structs and methods instead of relying on more manual query handling. So I still get the control and clarity of raw SQL, but now with better type safety on the Go side.

What I like about this change is that it keeps the project in a middle ground that feels right for me. I do not have to move to a full ORM just to get safer query handling, and I also reduce the chance of mismatches between SQL output and backend expectations.

It is another DX improvement, but also a maintainability improvement. The more this project grows, the more I want the boundaries to be clear… schema, queries, generated code, and backend usage should all line up cleanly, and sqlc helps a lot with that.

© 2026 Wahyu Syahputra. All rights reserved.