How itzap77/chathub-restructured works
ChatHub is a browser-based real-time chat platform. Users register or sign in, then join the public channel, create or join passkey-protected rooms, start disposable rooms, or request private conversations; they exchange messages and files over WebSockets and HTTP. Room membership, moderation, read tracking, and cleanup are separate domain stages. The graph follows the documented capabilities and sampled wiring; several route implementations and WebSocket message handlers were not sampled, so their internal call relationships are not expanded.
Main entry points: main.py FastAPI app · dm.py DM and ephemeral · rooms.py Room management · auth_routes.py Auth routes
Components 21
Browser client
- Chat UI
static/index.html - Client state
static/js/app.js - Authentication UI
static/js/auth.js - Chat UI logic
static/js/chat.js - Room controls
static/js/rooms.js - User directory
static/js/directory.js - Disposable rooms UI
static/js/ephemeral.js
Application entry
- FastAPI app
app/main.py
Chat features
- Auth routes
app/routes/auth_routes.py - User routes
app/routes/users.py - Room management
app/routes/rooms.py - DM and ephemeral
app/routes/dm.py - Message routes
app/routes/messages.py - Upload routes
app/routes/uploads.py - WebSocket endpoint
app/ws.py
Backend services
- Sessions and hashing
app/auth.py - Room connections
app/connection_manager.py - Message operations
app/messages_repo.py
Persistent and file state
- SQLite database
app/db.py - Uploaded files
uploads
Other components
- Web browser
Connections 33
- Web browser → FastAPI app: requests page
- FastAPI app → Chat UI: serves page
- Web browser → Auth routes: HTTP auth
- Authentication UI → Auth routes: registers and signs in
- Auth routes → Sessions and hashing: hashes and manages sessions
- Auth routes → SQLite database: reads and writes accounts
- Room controls → Room management: manages rooms
- Room management → Sessions and hashing: checks sessions
- Room management → SQLite database: reads and writes room state
- Room management → Room connections: kicks and broadcasts
- Disposable rooms UI → DM and ephemeral: creates and verifies rooms
- User directory → DM and ephemeral: requests private chats
- DM and ephemeral → Sessions and hashing: checks sessions
- DM and ephemeral → SQLite database: reads and writes requests
- DM and ephemeral → Room connections: notifies users
- Chat UI logic → WebSocket endpoint: sends chat events
- WebSocket endpoint → Room connections: handles connections
- Room connections → Message operations: loads and tracks reads
- Chat UI logic → Message routes: requests message data
- Message routes → Message operations: uses message operations
- Chat UI logic → Upload routes: uploads attachments
- Upload routes → Uploaded files: stores attachments
- FastAPI app → SQLite database: initializes and purges
- FastAPI app → WebSocket endpoint: registers endpoint
- FastAPI app → Auth routes: registers routes
- FastAPI app → Room management: registers routes
- FastAPI app → DM and ephemeral: registers routes
- FastAPI app → Message routes: registers routes
- FastAPI app → Upload routes: registers routes
- FastAPI app → User routes: registers routes
- Client state → Authentication UI: shares client state
- Client state → Chat UI logic: shares client state
- Client state → Room controls: shares client state