Skip to main content

Command Palette

Search for a command to run...

𝗧𝘂𝗿𝗻𝗶𝗻𝗴 𝗮 𝗙𝘂𝗻 𝗜𝗱𝗲𝗮 𝗶𝗻𝘁𝗼 𝗮 𝗣𝗿𝗼𝗱𝘂𝗰𝘁𝗶𝗼𝗻-𝗥𝗲𝗮𝗱𝘆 𝗦𝗲𝗿𝘃𝗶𝗰𝗲

𝗪𝗵𝗮𝘁 𝗜 𝗟𝗲𝗮𝗿𝗻𝗲𝗱 𝗕𝘂𝗶𝗹𝗱𝗶𝗻𝗴 𝗠𝘆 𝗙𝗶𝗿𝘀𝘁 𝗔𝗣𝗜

Updated
2 min read
𝗧𝘂𝗿𝗻𝗶𝗻𝗴 𝗮 𝗙𝘂𝗻 𝗜𝗱𝗲𝗮 𝗶𝗻𝘁𝗼 𝗮 𝗣𝗿𝗼𝗱𝘂𝗰𝘁𝗶𝗼𝗻-𝗥𝗲𝗮𝗱𝘆 𝗦𝗲𝗿𝘃𝗶𝗰𝗲

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