Skip to content

Prajwal-Adhikari/personal-site-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

personal_site_backend

Axum-based backend for a personal website, with a real-time chat system and SQLite persistence.

Chat feature (highlight)

Real-time visitor/admin chat over WebSockets, with message history persisted in SQLite and broadcast updates to all connected admins.

Visitor flow

  • Connect to GET /ws (WebSocket).
  • Send Hello with client_id and optional chat_id.
  • Receive Welcome with the resolved chat_id, then History (last 200 messages).
  • Send SendMessage to persist and broadcast to the chat and all admins.

Admin flow

  • Connect to GET /admin/ws (WebSocket).
  • Send AdminHello with token (from ADMIN_TOKEN).
  • Receive ChatList ordered by last activity.
  • Send AdminJoinChat to load History.
  • Send AdminSendMessage to persist and broadcast to the chat and all admins.

Persistence and broadcasts

  • SQLite database at ./data/chat.db by default.
  • chats and messages tables are auto-created on boot.
  • New messages are broadcast to all subscribers in the chat, plus all admins.

Endpoints

  • GET /health
  • GET /ws (visitor WebSocket)
  • GET /admin/ws (admin WebSocket)

Configuration

  • HOST (default 127.0.0.1)
  • PORT (default 3000)
  • FRONTEND_ORIGIN (default http://localhost:5173)
  • ADMIN_TOKEN (optional; required for admin WebSocket auth)
  • DATABASE_URL (default sqlite://./data/chat.db)

Run locally

export ADMIN_TOKEN="your-token"
cargo run

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages