#API

9 items tagged “API

TILBackend4 min read

Serving Premium Downloads Without Exposing the File's Real Storage URL

TIL how to replace a guessable direct-download link with a permission-checked, time-limited presigned URL, so the object storage path a purchased asset actually lives at is never sent to the client.

#Security
TILBackend4 min read

Live Poll Results Without WebSockets: Server-Sent Events in a Node.js API

TIL that once vote writes were race-free, the results screen still felt dead until a manual refresh — switching from client polling to Server-Sent Events made results update instantly without the bidirectional complexity WebSockets would have added for a channel that only ever sends in one direction.

#Node.js
TILBackend4 min read

Preventing Duplicate Votes in a Polling API Under Concurrent Requests

TIL that a 'check if the user already voted, then write' guard is racy under concurrent requests — the fix was a unique compound index plus an atomic $inc, so MongoDB rejects the duplicate instead of the app trying to catch it first.

#MongoDB
TILArchitecture3 min read

Designing a Complete Delivery-Management System as a Solo Developer

TIL that a system spanning a browser extension, a React Native app, an API, and a database only stayed maintainable solo because I treated the API as the one real product and everything else as a thin client of it.

#Architecture
TILArchitecture3 min read

Building a POS Integration Without Controlling the POS

TIL that integrating with a system you don't own means designing for its changes, not just its current behavior — the architecture that survived was the one that assumed the POS would break the integration eventually.

#Architecture
TILChrome Extensions3 min read

Connecting a Chrome Extension to a Node.js API

TIL that a fetch call from a content script that worked fine in the console failed silently from the actual extension, because content scripts run in an isolated world with their own CORS and CSP rules.

#Chrome Extension
TILFrontend2 min read

Converting API Timestamps to the User's Local Time Instead of Hardcoding Dubai Time

TIL that hardcoding a UTC+4 offset for timestamps because most orders happened to be local worked right up until a driver or a server ended up in a different timezone.

#JavaScript
TILArchitecture2 min read

Designing One API for Both a Web Dashboard and a Mobile App

TIL that a REST API originally shaped around the web dashboard's screens needed real redesign, not just new endpoints, once a React Native app started consuming it too.

#Node.js
TILReact2 min read

Using RTK Query for API Communication Instead of Hand-Rolled Fetching

TIL that most of my hand-written loading/error/cache state was solving a problem RTK Query already solves, and the switch removed more bugs than it added dependencies.

#React