๐ง๐๐ฟ๐ป๐ถ๐ป๐ด ๐ฎ ๐๐๐ป ๐๐ฑ๐ฒ๐ฎ ๐ถ๐ป๐๐ผ ๐ฎ ๐ฃ๐ฟ๐ผ๐ฑ๐๐ฐ๐๐ถ๐ผ๐ป-๐ฅ๐ฒ๐ฎ๐ฑ๐ ๐ฆ๐ฒ๐ฟ๐๐ถ๐ฐ๐ฒ
๐ช๐ต๐ฎ๐ ๐ ๐๐ฒ๐ฎ๐ฟ๐ป๐ฒ๐ฑ ๐๐๐ถ๐น๐ฑ๐ถ๐ป๐ด ๐ ๐ ๐๐ถ๐ฟ๐๐ ๐๐ฃ๐

Iโve recently been diving into Go, and after a few weeks of exploration, I decided to move beyond tutorials and build a functional sandbox project:
๐๐ฒ๐ป๐-๐๐-๐๐ฒ๐ณ๐ฎ๐๐น๐-๐ฎ๐-๐ฎ-๐ฆ๐ฒ๐ฟ๐๐ถ๐ฐ๐ฒ (๐๐๐๐ฎ๐ฎ๐ฆ)
๐ API: https://dbdaas.rajathjaiprakash.com/
๐ป GitHub: rajathjn/deny-by-default-as-a-service: deny-by-default-as-a-service
Inspired by the "No-as-a-Service" concept, the API returns creative and sometimes sassy reasons to say "No," with an optional "Yes" toggle for balance. While the concept is lighthearted,ย I approached the implementation with the technical rigor expected of a production system.
I strongly believe even hobby projects are opportunities to apply sound engineering principles.
Here are the key choices I focused on:
๐น๐ก๐ฒ๐๐๐ผ๐ฟ๐ธ ๐ฅ๐ฒ๐๐ถ๐น๐ถ๐ฒ๐ป๐ฐ๐ฒ & ๐๐ผ๐ป๐ป๐ฒ๐ฐ๐๐ถ๐ผ๐ป ๐๐ฎ๐ป๐ฑ๐น๐ถ๐ป๐ด
To protect against resource exhaustion and Slowloris-style attacks, I moved beyond default server settings. I had to implement specific read, write, and idle timeout values to ensure the service remains resilient under connection pressure.
๐น๐ฅ๐ฎ๐๐ฒ ๐๐ถ๐บ๐ถ๐๐ถ๐ป๐ด & ๐ฃ๐ฟ๐ผ๐ ๐ ๐๐๐ฎ๐ฟ๐ฒ๐ป๐ฒ๐๐
For a publicly accessible API, abuse prevention is essential. I had to implement a custom middleware and configure trusted proxy settings to ensure accurate client IP resolution behind load balancers, all to enforce a steady limit of 30 requests per minute per IP, ensuring fair usage while maintaining a stateless design.
๐น๐ ๐ถ๐ป๐ถ๐บ๐ฎ๐น๐ถ๐๐ & ๐ฆ๐ฒ๐ฐ๐๐ฟ๐ฒ ๐๐ผ๐ป๐๐ฎ๐ถ๐ป๐ฒ๐ฟ๐ถ๐๐ฎ๐๐ถ๐ผ๐ป
Security and efficiency were top priorities. I utilized a multi-stage Docker build to produce a final image based on scratch. This resulted in a hyper-lean container, which has a minimal runtime footprint and significantly reduces the attack surface by including only the compiled binary.
๐น๐๐บ๐ฏ๐ฒ๐ฑ๐ฑ๐ฒ๐ฑ ๐๐ฒ๐ฎ๐น๐๐ต ๐ฆ๐ถ๐ด๐ป๐ฎ๐น๐ถ๐ป๐ด
Since scratch images lack standard debugging utilities, I embedded a health flag directly into the binary. This allows the container to self-report health status via Docker health checks without external dependencies.
๐น๐๐ฟ๐ฎ๐ฐ๐ฒ๐ณ๐๐น ๐ง๐ฒ๐ฟ๐บ๐ถ๐ป๐ฎ๐๐ถ๐ผ๐ป
Implemented signal handling to enable controlled shutdowns, allowing in-flight requests to complete while preventing new ones. This is critical for reliability during deployments and scaling events.
Key Takeaway:
The most rewarding part of this exercise was realizing how naturally Go supports building reliable, concurrent, and production-ready systems.
This project reinforced the importance of treating every system, no matter the scale, as an opportunity to practice production-grade engineering.
Iโd love to hear your thoughts or feedback!
#Golang #CloudNative #BackendDevelopment #GoProgramming #SoftwareEngineering #Docker #API #SoftwareArchitecture #LearningInPublic
Comments
Join the discussionNo comments yet. Be the first to comment.