How mariaegorenko/chat_project works
Chat Project is a FastAPI web chat with authenticated pages, contact management, and real-time messaging. A user visits the app, authenticates, then uses chat and contact pages; WebSocket handlers process chat and contact events, persist domain data, and deliver messages to connected users or queue them for later. The graph includes the documented browser capabilities and the sampled persistence and session layers. Some templates are mentioned in the README and main.py but are absent from the supplied tree; unsampled details and unshown wiring are omitted.
Main entry points: main.py FastAPI app and pages · ws_hadlers_chats.py Chat handlers · ws_handlers_contacts.py Contact handlers · crud.py User repository
Components 26
Web entry and UI
- FastAPI app and pages
app/main.py - Auth client
app/static/js/auth.js - Registration client
app/static/js/register.js - Chat client
app/static/js/chat.js - Chats client
app/static/js/chats.js - Contacts client
app/static/js/contacts.js - WebSocket client
app/static/js/wsClient.js - Date formatting
app/static/js/utils/datetime.js
Identity and access
- Auth routes
app/api/v1/routers/auth.py - Access dependencies
app/api/v1/deps.py - Session state
app/core/session.py - Password and tokens
app/core/security.py
Realtime features
- WebSocket entry
app/api/v1/routers/ws_main.py - Event dispatch
app/api/v1/routers/ws_handlers.py - Chat handlers
app/api/v1/routers/ws_hadlers_chats.py - Contact handlers
app/api/v1/routers/ws_handlers_contacts.py - WebSocket utilities
app/api/v1/routers/ws_utils.py - WebSocket schemas
app/api/v1/routers/ws_schemas.py - Chat page logic
app/services/chat_utils.py - Contact API routes
app/api/v1/routers/contacts.py
Domain persistence
- User repository
app/db/repositories/users/crud.py - Chat repository
app/db/repositories/chats/crud.py - Contact repository
app/db/repositories/contacts/crud.py - Pending events
app/db/repositories/pending/crud.py - SQL database
app/db/base.py
Other components
- User browser
Connections 42
- User browser → FastAPI app and pages: opens pages
README.md - FastAPI app and pages → Auth routes: mounts routes
app/main.py - FastAPI app and pages → Contact API routes: mounts routes
app/main.py - FastAPI app and pages → WebSocket entry: registers socket
app/main.py - FastAPI app and pages → Chat page logic: builds chat page
app/main.py - FastAPI app and pages → SQL database: creates tables
app/main.py - User browser → Auth client: uses
- User browser → Registration client: uses
- User browser → Chat client: uses
- User browser → Chats client: uses
- User browser → Contacts client: uses
- Chat client → WebSocket client: uses
app/static/js/chat.js - Chats client → WebSocket client: uses
app/static/js/chats.js - Contacts client → WebSocket client: uses
app/static/js/contacts.js - Chat client → Date formatting: formats dates
app/static/js/chat.js - Chats client → Date formatting: formats dates
app/static/js/chats.js - Auth routes → User repository: authenticates users
app/api/v1/routers/auth.py - Auth routes → Password and tokens: uses tokens
app/api/v1/routers/auth.py - Auth routes → Session state: manages sessions
app/api/v1/routers/auth.py - Access dependencies → Session state: reads sessions
app/api/v1/deps.py - Access dependencies → User repository: looks up users
app/api/v1/deps.py - User repository → Password and tokens: hashes passwords
app/db/repositories/users/crud.py - WebSocket entry → Password and tokens: checks tokens
app/api/v1/routers/ws_main.py - WebSocket entry → User repository: loads user
app/api/v1/routers/ws_main.py - WebSocket entry → Event dispatch: dispatches events
app/api/v1/routers/ws_main.py - Event dispatch → Chat handlers: routes chat events
app/api/v1/routers/ws_handlers.py - Event dispatch → Contact handlers: routes contact events
app/api/v1/routers/ws_handlers.py - Chat handlers → Chat repository: reads and writes
app/api/v1/routers/ws_hadlers_chats.py - Chat handlers → Pending events: queues offline events
app/api/v1/routers/ws_hadlers_chats.py - Chat handlers → Chat page logic: uses chat logic
app/api/v1/routers/ws_hadlers_chats.py - Contact handlers → Contact repository: manages requests
app/api/v1/routers/ws_handlers_contacts.py - Contact handlers → Pending events: queues offline events
app/api/v1/routers/ws_handlers_contacts.py - Chat handlers → WebSocket utilities: uses helpers
app/api/v1/routers/ws_hadlers_chats.py - Contact handlers → WebSocket utilities: uses helpers
app/api/v1/routers/ws_handlers_contacts.py - Chat handlers → WebSocket schemas: formats events
app/api/v1/routers/ws_hadlers_chats.py - Contact handlers → WebSocket schemas: formats events
app/api/v1/routers/ws_handlers_contacts.py - Contact API routes → Contact repository: manages contacts
app/api/v1/routers/contacts.py - Chat page logic → Chat repository: loads chats
app/services/chat_utils.py - Chat page logic → User repository: loads companions
app/services/chat_utils.py - Chat repository → SQL database: queries and updates
- Contact repository → SQL database: queries and updates
- Pending events → SQL database: stores pending events