Coder Social home page Coder Social logo

notarious2 / fastapi-chat Goto Github PK

View Code? Open in Web Editor NEW
16.0 1.0 3.0 222 KB

Real-time chat with FastAPI, Websockets and SQLAlchemy2

Home Page: http://www.ponderpal.chat

License: MIT License

Python 98.23% Dockerfile 0.40% Makefile 0.73% Mako 0.43% HTML 0.14% Procfile 0.06%
asyncpg chat-application fastapi fastapi-sqlalchemy postgresql pubsub pydantic-v2 real-time redis-cache redis-pubsub sqlalchemy2 websocket-chat websockets ruff ruff-python

fastapi-chat's Introduction

Real-time Chat App with FastAPI

Live Demo: https://www.ponderpal.chat

Swagger UI: https://api.ponderpal.chat/docs

Admin: https://api.ponderpal.chat/admin/ (login: bekzod, password: bekzod)

Frontend with Vue 3 and Vuetify 3, see repo

Tech Stack:

  • FastAPI, Websockets, Pydantic 2
  • Postgres (asyncpg), async Redis (PubSub and Cache)
  • SQLAlchemy 2
  • Database migrations with Alembic
  • Poetry for dependency management, containerization with Docker/docker-compose
  • Linting and Formatting with Ruff

High level functionality description

  • Fully asynchronous: FastAPI, Postgres, Redis
  • JWT HTTP-only cookies authentication (access, refresh tokens)
  • Horizontal Scalability with Redis PubSub
  • Rate Limiting (Throttling)
  • FastAPI background tasks:
    • uploading photos to cloud
    • updating non-essential info
  • Message status confirmation: sending, sent and read
  • Read status tracking with one field per user per chat
(last read message) instead of tracking 
individual message read status
  • User status tracking: online, inactive and offline
  • User is typing tracking
  • Google Oauth2 authentication:
    • Frontend retrieves access token
    • Backend verifies and gets user data
  • Store files in AWS S3 bucket in production and StaticFiles in local development
  • Modern Admin panel with sqladmin

Local Setup

  • Configure necessary variables in src/config.py
  • Create network: make network
  • Build and run: make build-up (runs on port: 8001)
  • Apply migrations: make upgrade
  • Follow logs: make logs
  • Run tests: make test
Screenshot 2024-02-18 at 18 37 11

fastapi-chat's People

Contributors

notarious2 avatar sh1nkey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

fastapi-chat's Issues

Inquiry about project

Hello, is this repo for a tutorial? Where can I see the tutorial and do you have plans to add a license? Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.