FeedMe
A small REST API for a live post feed: JWT auth, image uploads, paginated reads and Socket.IO broadcasts when posts change.
- Role
- Solo: backend engineering
- Year
- 2023
- Status
- Archived
- Type
- Backend & APIs
01Problem
Why it exists
An exercise in one specific question: how do you keep every open client up to date when someone else posts, without turning the whole API into a socket protocol?
02Approach
How I went about it
Keep the two concerns apart. All writes go through authenticated REST endpoints with validation. Only after a write has succeeded does the server emit an event describing what changed, and clients update from that.
03Architecture
Decisions that shaped it
Diagram aboveREST for writes, a socket for fan-out. Clients never write through the socket.
01
Writes over REST, fan-out over a socket
Create, update and delete each emit one event carrying the action and the affected post. The socket is strictly one-directional, so there is a single place where data can change.
02
Authorisation at the resource
A token gets you into the API; editing or deleting a post additionally checks that you created it and answers 403 otherwise.
03
One error path
Controllers attach a status code and pass errors forward to a single Express handler, which shapes every error response the same way.
04Build
What it does
- Signup, login and a user status endpoint
- Paginated feed, single post, create, update and delete
- Image upload with file-type filtering
- Passwords hashed with bcrypt, input validated per route
- Service
- Node.js · Express · Socket.IO
- Data
- MongoDB · Mongoose
- Supporting
- jsonwebtoken · bcryptjs · multer · express-validator
05Outcome
Where it stands
A complete, small API from 2023, left as it was. It has no tests and no deployment; it is listed because the split between REST writes and broadcast updates is the interesting part.
Checked against the repository on 11 November 2026