ParsChat is a full-stack real-time chat application with a Go backend and a React frontend.
- Backend: Go (
net/http) + SQLite + JWT auth + SSE realtime stream - Frontend: React + TypeScript + Zustand + Axios + Vite
- Realtime: Server-Sent Events for incoming messages, typing signals, and online/offline updates
- Storage: SQLite database (
chat.db) and local upload storage (uploads/)
- User authentication (register/login with JWT)
- One-to-one chat
- Group chat (create group, add/remove members, leave group)
- Typing indicators
- Online/offline presence
- Block / unblock users
- Media and file sharing (image, video, audio, generic files)
- Voice message recording from browser microphone
- Location sharing (latitude/longitude with map link)
- Emoji picker in composer
- Profile modal (view/edit username, full name, bio, avatar)
- Message reactions API support
ParsChat/
βββ backend/
β βββ cmd/server/main.go
β βββ internal/
β β βββ config/
β β βββ controllers/
β β βββ middleware/
β β βββ models/
β β βββ routes/
β β βββ server/
β β βββ services/
β β βββ utils/
β βββ public/
β βββ uploads/
β βββ Dockerfile
β βββ docker-compose.yml
β βββ go.mod
βββ frontend/
β βββ src/
β β βββ components/
β β βββ features/
β β βββ hooks/
β β βββ lib/
β β βββ services/
β β βββ types.ts
β βββ Dockerfile
β βββ docker-compose.yml
β βββ package.json
β βββ vite.config.ts
βββ API_AUDIT.md
βββ LOCATION_SHARING.md
βββ docker-compose.yml
- Go 1.21
- SQLite (
github.com/mattn/go-sqlite3) - JWT (
github.com/golang-jwt/jwt/v5) - SSE over HTTP (
/events)
- React 18
- TypeScript
- Zustand (state management)
- Axios (HTTP client)
- Vite (dev server and bundler)
- Go 1.21+
- Node.js 20+
- npm 9+
- Docker + Docker Compose (optional)
Backend reads these variables:
PORT(default:8080)DB_PATH(default:./chat.db)JWT_SECRET(default is development-only fallback)
Frontend (Vite) can use:
VITE_PROXY_TARGET(default:http://localhost:8080)
cd backend
go mod tidy
go run ./cmd/serverBackend URL: http://localhost:8080
Open a second terminal:
cd frontend
npm install
npm run devFrontend URL: http://localhost:5173
Vite proxies /api, /events, and /uploads to the backend.
If you build the frontend, backend can serve frontend/dist automatically.
cd frontend
npm install
npm run buildThen run backend as usual:
cd backend
go run ./cmd/serverdocker compose up --buildServices:
- Backend:
http://localhost:8080 - Frontend:
http://localhost:5173
cd backend
docker compose up --buildcd frontend
docker compose up --buildFrom whichever directory you started compose:
docker compose downPOST /api/registerPOST /api/login
GET /api/usersGET /api/profile?userId=...POST /api/profile
GET /api/messagesPOST /api/sendPOST /api/typingGET /events
POST /api/uploadGET /api/online
POST /api/blockPOST /api/unblockGET /api/blocked
GET /api/groupsPOST /api/groupsPOST /api/group/addPOST /api/group/removePOST /api/group/leaveGET /api/group/members
POST /api/messages/readPOST /api/reactions/addPOST /api/reactions/removeGET /api/reactions
POST /api/keys/saveGET /api/keys/get
For detailed request/response shapes, check API_AUDIT.md.
Database schema is initialized automatically on startup.
Current tables include:
usersgroupsgroup_membersmessagesmessage_readsmessage_reactionsblocked_usersuser_keys
The service also performs lightweight migration attempts for profile fields (bio, avatar_url) on startup.
Install frontend dependencies first:
cd frontend
npm install
npm run devcd frontend
rm -rf node_modules package-lock.json
npm install
npm run dev- Change backend
PORT - Or stop the process currently using
8080/5173
- Ensure backend is running
- Ensure
uploads/exists and is writable - Access files via
/uploads/<filename>
- Default
JWT_SECRETfallback is for development only. - Set a strong
JWT_SECRETin production. - Consider running behind HTTPS and adding stricter auth checks for profile update ownership.
API_AUDIT.md: API contracts and endpoint detailsLOCATION_SHARING.md: location-sharing behavior
No license file is currently included in this repository.