Distributed Reddit Backend

Scalable Reddit-style backend featuring nested comments, voting, feeds, and community-driven discussions.

Distributed SystemsJan 2026 – Feb 20262 monthsCompleted
View Repository

Overview

RedditApp is a production-style Reddit-inspired backend built using a distributed microservice architecture. The system separates authentication, user management, posts, comments, voting, feed generation, and notifications into independently deployable services. Each service owns its own responsibility and communicates through REST APIs for synchronous operations and Apache Kafka for asynchronous event processing. The project focuses on scalability, loose coupling, and production-oriented backend engineering practices.

Problem Statement

Modern discussion platforms must handle authentication, post creation, comments, voting, feed generation, and notifications simultaneously. As traffic grows, managing all these responsibilities within a single monolithic application becomes increasingly difficult. This project explores how these responsibilities can be decomposed into independent microservices that communicate efficiently while remaining scalable, maintainable, and fault tolerant.

Features

  • JWT-based authentication and authorization
  • User registration and login
  • Community creation and management
  • Create, update and delete posts
  • Nested comment system
  • Post upvote and downvote
  • Personalized home feed generation
  • Role-based authorization
  • RESTful APIs
  • Apache Kafka event communication

Core Services

The system is composed of independently deployable services, each responsible for a single business capability.

01

API Gateway

Routes all incoming client requests to the appropriate microservice.

02

Auth Service

Handles user authentication, JWT generation, and authorization.

03

User Service

Manages user profiles, accounts, and user-related operations.

04

Post Service

Handles creation, editing, deletion, and retrieval of posts.

05

Comment Service

Manages nested comments and discussion threads.

06

Vote Service

Processes upvotes and downvotes for posts and comments.

07

Feed Service

Generates personalized user feeds.

08

Notification Service

Processes notification events asynchronously.

Technology Stack

Technologies, frameworks, infrastructure, and tooling used throughout the development of this project.

Backend

Java • Spring Boot • Spring Cloud • Spring Security

Database

PostgreSQL • Redis

Messaging

Apache Kafka

Infrastructure

Docker • Docker Compose

Developer Tools

Maven • Git • Postman

Engineering Decisions

Architectural choices made to improve scalability, maintainability, reliability, and long-term evolution of the system.

01

Microservice Architecture

The application is divided into independent services such as authentication, users, posts, comments, voting, feeds, and notifications. This separation improves maintainability, scalability, and allows each service to evolve independently.

02

API Gateway

Instead of exposing every service directly, all client requests pass through a centralized API Gateway that handles routing and simplifies external communication.

03

Apache Kafka

Kafka enables asynchronous communication between services, allowing operations like notifications and feed updates to execute independently without increasing request latency.

04

Redis Caching

Redis is used to cache frequently accessed data, reducing database load and improving response times for read-heavy operations.

05

Containerized Development

Every service runs inside Docker containers, ensuring a consistent development environment and simplifying local setup using Docker Compose.

Challenges

The most significant engineering challenges encountered while building the system.

01

Designing clear service boundaries across multiple microservices.

02

Managing communication between distributed services.

03

Implementing asynchronous messaging using Apache Kafka.

04

Handling authentication across multiple services.

05

Running and debugging several services simultaneously during development.

What I Learned

Key technical concepts and engineering practices gained during the implementation.

01

Designing backend systems using microservice architecture.

02

Building event-driven workflows with Apache Kafka.

03

Implementing secure authentication using JWT.

04

Applying Redis caching to improve application performance.

05

Managing multi-container applications using Docker Compose.

06

Understanding the operational complexity of distributed systems.

Future Improvements

Potential enhancements that could improve scalability, reliability, and maintainability.

01

Deploy the platform on Kubernetes.

02

Introduce distributed tracing using OpenTelemetry.

03

Improve feed ranking algorithms.

04

Add full-text search using Elasticsearch.

05

Implement comprehensive integration and end-to-end testing.

06

Introduce rate limiting and API throttling.