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

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](https://github.com/rajathjn/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**](https://www.linkedin.com/search/results/all/?keywords=%23golang&origin=HASH_TAG_FROM_FEED) [**#CloudNative**](https://www.linkedin.com/search/results/all/?keywords=%23cloudnative&origin=HASH_TAG_FROM_FEED) [**#BackendDevelopment**](https://www.linkedin.com/search/results/all/?keywords=%23backenddevelopment&origin=HASH_TAG_FROM_FEED) [**#GoProgramming**](https://www.linkedin.com/search/results/all/?keywords=%23goprogramming&origin=HASH_TAG_FROM_FEED) [**#SoftwareEngineering**](https://www.linkedin.com/search/results/all/?keywords=%23softwareengineering&origin=HASH_TAG_FROM_FEED) [**#Docker**](https://www.linkedin.com/search/results/all/?keywords=%23docker&origin=HASH_TAG_FROM_FEED) [**#API**](https://www.linkedin.com/search/results/all/?keywords=%23api&origin=HASH_TAG_FROM_FEED) [**#SoftwareArchitecture**](https://www.linkedin.com/search/results/all/?keywords=%23softwarearchitecture&origin=HASH_TAG_FROM_FEED) [**#LearningInPublic**](https://www.linkedin.com/search/results/all/?keywords=%23learninginpublic&origin=HASH_TAG_FROM_FEED)
