Yapocalypse is a microblogging platform inspired by Twitter, where users can "yap" (tweet) and follow other users.
The platform currently focuses on text-based content and does not support videos, images, or likes. Users receive "yaps" from their followers in their feed.
This project is for practicing purposes only and is not ready for production use. It is also not fully functional yet and may contain bugs or security vulnerabilities.
if you encounter any issues or have any suggestions, please feel free to open an issue or pull request.
- Install ( Go, PostgreSQL, Redis, Kafka, Docker, Docker Compose)
- Clone the repository
- Run
docker-compose up -d
to start the containers - Run
docker-compose exec postgres psql -U postgres -d postgres
to connect to the PostgreSQL database - Read the Env example to create a
.env
file - Read the Api Docs to understand the API endpoints
- API Layer: Handles HTTP requests and responses.
- Kafka Producer: Publishes "yap" events to Kafka.
- Kafka Consumers: Consumes "yap" events and processes them.
- Redis: Used for caching to improve performance.
- JWT: Used for authentication.
- PostgreSQL: The primary database for storing user data, "yaps," and relationships.
-
Topic:
yaps
-
Action: Publishes "yaps" to the
yaps
topic. -
Key: yap_id
-
Value: yap_json
Feed Consumer
-
Topic:
yaps
-
Action : Updates the user's feed with new
yaps
from followed users.
Analytics Consumer
-
Topic:
yaps
-
Action: Analysis of
yaps
to determine popular topics.(not implemented yet)
-
user :
{user_id}:feed
: Caches the user's feed. -
yap :
{yap_id}:yap
: Caches individualyaps
. -
Cache Expiry : Set to 5 minutes to balance between performance and data freshness.
-
Users :
id
,email
,username
,password
,created_at
,updated_at
-
Yaps :
id
,user_id
,content
,created_at
,updated_at
-
Followers :
follower_id
,following_id
,created_at
-
Feed :
user_id
,yap_id
-
Indexes:
index onFollowers(followee_id)
index onFeed(user_id)
index onYaps(user_id)
-
Password Hashing: BCrypt
-
JWT: JSON Web Tokens
- Created a unified logger package in
/pkg
which is shared between services for consistency, and every service has its own log file for info and errors.