Skip to content

yeghor/SocialNetwork

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Social Network project

This is my most serious project.

It is a prototype of a social network similar to Twitter (now X).

Stack of this project includes:

  • fastAPI
  • Pydantic
  • SQLalchemy (PostgreSQL) - As a main database.
  • Redis - For storing short-lived data, like: JWTs, viewed posts excluding temporary image URLs (when using the local storage). Async
  • ChromaDB - For user posts feed related to their history.
  • AioBotocore - For AWS S3.

Features:

  • Architecture built on SOLID principles, also it is fully asynchronous and easy to develop/expand.
  • Images support user avatars and post pictures. Storage can be chosen in .env file (AWS S3 via AioBotocore, Local Storage)
  • Authorization handled with password hashing and two JWT tokens:
    • Refresh token - long termed. Used to refresh access token.
    • Access token - short termed.
  • Feed unique to every user. It works by post popularity rate and chromaDB semantic search
    • Popularity rate is a dynamic field in each post, value depends on user activity. The rate is secured from fake activity abusing.
    • ChromaDB Semantic Search provides vectorized search to find relevant posts to user view history. The feed contains mixed posts (proportions can be seted in .env file)
      • History related (Semantic Search)
      • Unrelated, but popular and fresh posts
      • Following posts from users you follow to (If no follows - returns Unrelated)
  • Real-time Chat using fastAPI (starlete's) websockets.

This project has a docker-compose.yml file, so it allows you to start the application by executing only one line.

Also the project has basic CI (Implemented with GitHub actions) that runs tests on every push.

Currently working on: Implementing frontend, scroll virtualization, auth email confirmation, backend optimization

Usage

Requirements - Docker, Python 3.12.0 or higher.

To run this application, follow these steps:

Copy the repository:

git clone https://github.com/yeghor/SocialNetwork.git

Move to repository directory:

cd SocialNetwork

Run docker-compose.yml

docker compose up

In case you managed to run the application not using docker-compose.

Change HOST variables values in .env file to localhost! Example:

REDIS_HOST = "localhost" # from redis_db
CHROMADB_HOST = "localhost" # from "chromadb_db"
DB_HOST = "localhost" # from "postgres_db"

Acces your backend application by this URL: https://0.0.0.0:8800/docs

About

SocialNetwork using Python and React. Including GitHub actions and Docker.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages