Skip to content

dpr-0/csp0

Repository files navigation

csp0

GitHub release (with filter) Docker build codecov Test

This is my chat side project type-0: A Random Chat Room implemented by FastAPI.

Implemented features:

  1. JWT authentication
  2. User registration
  3. User match a random user and unmatch (Redis set)
  4. User send and recieve message (Redis stream)
  5. User recieve notification (Redis stream)

This project are implemented base on:

  1. Clean architecture and Domain-Drvien Design concept
  2. Message bus

Demo

demo.mov

Setup Devlopment Environment

Docker Compose

make dc

Create .env file

Gen RSA Key pair

openssl genrsa -out private.pem 2048
openssl rsa -in private.pem -pubout -out public.pem

paste them to .env

DATABASE_DSN=postgres://postgres:Sfj39w@127.0.0.1:5432/postgres
REDIS_DSN=redis://localhost:6379?decode_responses=True
PUBLIC_KEY="here"
PRIVATE_KEY="here"

Poetry

poetry install

Local Run Server

Create DB schema (first time)

aerich upgrade

Run Server

make run

Test

make test

Test Coverage

codecov codecov

If use Minimal container vm

Colima and Testcontainer docker sock problem