Filog is a production-ready backend for a modern blogging platform. This repository contains a complete custom backend powering authentication, posts, comments, likes, follows, avatar generation, and dynamic Open Graph (OG) image generation. The frontend (React) is present as a demo; this repository is presented as a backend engineering case study.
- JWT-based authentication with best-practice token handling.
- Google OAuth 2.0 integration for social login.
- Password hashing and input validation middleware.
- Create / Edit / Delete posts with ownership-enforced authorization.
- Commenting system and like/unlike semantics.
- Follow / unfollow user relationships.
- Atomic MongoDB updates (
$addToSet,$pull) and conflict-safe patterns to prevent race conditions.
- Server-side dynamic Open Graph image generation (Vercel functions / SSR approach documented).
- DiceBear avatar generation integrated and handled asynchronously during profile creation.
- Dockerfile for containerized builds and simple deployment.
- Environment-driven configuration (separate dev/prod flow).
- Centralized error handling and request validation.
Filog/
├── Backend/ # Backend source (primary showcase)
│ ├── src/
│ │ ├── config/
│ │ ├── controllers/
│ │ ├── middleware/
│ │ ├── models/
│ │ ├── routes/
│ │ └── utils/ # OG generator, avatar helpers, email, etc.
│ ├── Dockerfile
│ ├── package.json
│ └── tsconfig.json
├── Frontend/ # Demo React UI (marked experimental in this README)
└── README.md
Note: The Frontend is a demo UI (React, GSAP animations mentioned). The backend is the production-quality portion of this project and is the primary focus.
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| POST | /api/auth/register |
Register user | ❌ |
| POST | /api/auth/login |
Login and receive JWT | ❌ |
| GET | /api/users/:id |
Get user profile | ✅ |
| POST | /api/posts |
Create post | ✅ |
| GET | /api/posts/:id |
View post | ❌ |
| PATCH | /api/posts/:id |
Edit post (owner only) | ✅ |
| DELETE | /api/posts/:id |
Delete post (owner only) | ✅ |
| POST | /api/posts/:id/comments |
Add comment | ✅ |
| POST | /api/posts/:id/like |
Like / unlike | ✅ |
| POST | /api/users/:id/follow |
Follow / unfollow | ✅ |
(Add precise request/response schemas or link an OpenAPI/Swagger file if you add one.)
- Clone & install
git clone https://github.com/dev-raghvendra/Filog.git
cd Filog/Backend
npm install- Create
.env(example)
MONGO_URI=<your_mongo_uri>
JWT_SECRET=<your_jwt_secret>
GOOGLE_CLIENT_ID=<id>
GOOGLE_CLIENT_SECRET=<secret>
PORT=4000
- Run in development
npm run dev
# or
npm run build
npm startServer defaults to http://localhost:4000 (update PORT in .env as needed).
docker build -t filog-backend .
docker run --env-file .env -p 4000:4000 filog-backend# Register
curl -X POST http://localhost:4000/api/auth/register \
-H 'Content-Type: application/json' \
-d '{"name":"Raghvendra","email":"user@example.com","password":"P@ssw0rd"}'
# Login (returns JWT)
curl -X POST http://localhost:4000/api/auth/login \
-H 'Content-Type: application/json' \
-d '{"email":"user@example.com","password":"P@ssw0rd"}'
# Create post (replace <JWT>)
curl -X POST http://localhost:4000/api/posts \
-H "Authorization: Bearer <JWT>" \
-H 'Content-Type: application/json' \
-d '{"title":"Hello","content":"This is Filog backend."}'- Stateless JWT for horizontal scaling and simpler session handling.
- MongoDB atomic operations to maintain consistent follower/like counts under concurrency.
- OG generation server-side to provide reliable social previews (documented use of Vercel functions).
- Async avatar creation (DiceBear) to keep user flows snappy.
- Dockerized for CI/CD-friendly deployment.
- Custom Node.js + TypeScript backend (core logic implemented).
- Google OAuth & JWT authentication flows.
- DiceBear avatar integration.
- Server-side Open Graph generation (Vercel functions / SSR approach referenced).
- Frontend demo implemented with React + GSAP (kept as demo; not the focus).
- Add
Backend/README.md(this file) and move original README content intoFrontend/README.mdorREADME-OLD.md. - Add an
openapi.json(small skeleton) and link it from this README. - Export a Postman collection and link it for reviewers to try the API.
- Add a short 60–90s demo GIF showing
curl→ post creation → DB entry. - Mark Frontend as Experimental / Demo at the top to guide reviewers.
- Add Jest + Supertest integration tests for auth and post flows.
- Redis caching for hot resources and rate-limiting.
- Notifications via WebSocket / real-time updates.
- CI GitHub Action which lints, runs tests and builds Docker image.
Raghvendra Misra — I built Filog’s backend from scratch to control auth, data integrity, and link previews. This repo showcases backend design, authentication flows, and production-minded patterns.
Repository: https://github.com/dev-raghvendra/Filog
🌟 If you find this project useful or interesting, give it a star — it helps me showcase my backend work!