Skip to content

doorhanoff/light_memory

Repository files navigation

Светлая Память — Grave Care Platform

A full-stack platform connecting clients with professionals who provide grave care services — cleaning, planting flowers, painting fences — with real-time chat, photo reports, and a rating system.


Tech Stack

Backend

Frontend

Infrastructure

  • Docker + Docker Compose
  • WebSocket with exponential backoff reconnect

Features

  • Auth — JWT access/refresh tokens, stored in HTTP-only cookies, refresh token revocation via Redis
  • Services — executors create service listings with city, cemetery, and pricing info
  • Orders — full order lifecycle: SENT → ACCEPTED → IN_PROCESS → COMPLETED / REJECTED
  • Chats — real-time WebSocket messaging, photo sharing via S3, one chat per order
  • Ratings — clients rate services after order completion, average rating auto-updated
  • Photo reports — executors upload a completion photo when finishing an order
  • Search — filter services by city, text, and price range

Project Structure

light_memory/
├── src/
│   ├── auth/          # JWT auth, users
│   ├── services/      # Service listings, ratings
│   ├── orders/        # Order management
│   ├── chats/         # WebSocket chat, messages
│   ├── s3/            # Yandex S3 integration
│   ├── redis/         # Redis client
│   └── db/            # SQLAlchemy engine, session
├── alembic/           # Database migrations
├── frontend/          # React + TypeScript SPA
│   └── src/
│       ├── api/       # API client functions
│       ├── components/# Navbar, ServiceCard
│       ├── pages/     # Home, Services, Chat, Orders, ...
│       └── context/   # Auth context
├── main.py            # FastAPI app entrypoint
├── docker-compose.yaml
└── Dockerfile

Getting Started

Prerequisites

  • Docker & Docker Compose
  • Node.js 18+ (for frontend dev)

Environment Variables

Create a .env file in the project root:

# Database
DB_USER=postgres
DB_PASS=postgres
DB_NAME=light_memory
DB_HOST=localhost
DB_PORT=5432

# Redis
REDIS_HOST=localhost
REDIS_PORT=6379

# JWT
JWT_SECRET=your-secret-key
JWT_ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
REFRESH_TOKEN_EXPIRE_DAYS=30

# S3 (Yandex Object Storage)
S3_ENDPOINT=https://storage.yandexcloud.net
S3_REGION=ru-central1
S3_BUCKET=your-bucket-name
S3_ACCESS_KEY=your-access-key
S3_SECRET_KEY=your-secret-key

Run with Docker

docker compose up --build

The API will be available at http://localhost:8000.
API docs (Swagger) at http://localhost:8000/docs.

Run Frontend (dev)

cd frontend
npm install
npm run dev

Frontend dev server: http://localhost:5173


API Overview

Method Endpoint Description
POST /auth/register Register a new user
POST /auth/login Login, get tokens
POST /auth/refresh Refresh access token
POST /auth/logout Revoke refresh token
GET /services/ List services (with filters)
POST /services/create Create a service listing
GET /services/{id} Get service details
GET /services/{id}/rates Get service reviews
POST /services/rate/{id} Rate a service
POST /orders/create Create an order
GET /orders/ Get my orders
GET /orders/pending Get incoming orders (executor)
PUT /orders/accept/{id} Accept an order
PUT /orders/reject/{id} Reject an order
PUT /orders/start/{id} Start working on an order
PUT /orders/complete/{id} Complete with photo
GET /chats/ Get all my chats
GET /chats/{id} Get chat details
GET /chats/{id}/messages Get message history
POST /chats/{id}/upload Upload photo to chat
WS /chats/ws/{id} WebSocket connection

Database Migrations

# Apply all migrations
uv run alembic upgrade head

# Create a new migration
uv run alembic revision --autogenerate -m "description"

# Rollback one step
uv run alembic downgrade -1

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors