A self-hosted chat application for staying connected when phone calls, SMS, and internet services are blocked in Iran. Run your own server on a VPS or local network, share a room key with friends and family, and communicate freely.
During internet shutdowns and communication blackouts, traditional messaging apps become unusable. This project provides a minimal, self-contained alternative:
- You deploy it on a server you control (outside Iran or on a local network)
- Users connect via any web browser -- no app install needed
- Room keys act as invite codes -- share them privately to join a conversation
- No third-party dependencies for messaging -- just your server and SQLite
- Self-Hosted -- You own the server, no one can shut it down for you
- No App Required -- Works in any browser, even restricted ones
- Room Keys -- Share a simple key to let someone join your chat
- Device Binding -- Each device gets one account to prevent spam
- HTTPS Support -- Encrypt traffic to avoid local network inspection
- Lightweight -- Single Go binary, SQLite database, zero external services
- Persian UI -- Full Farsi interface with Vazir font
go build -o ChatTest
./ChatTestOpen http://localhost:8080 (or your server's IP).
- Get a VPS outside Iran (e.g., Germany, Finland, Netherlands)
- Build and upload the binary:
GOOS=linux GOARCH=amd64 go build -o ChatTest scp ChatTest user@your-vps:/home/user/
- SSH into the VPS and run:
./ChatTest
- Share your server IP and port with people you trust
- They open
http://YOUR-VPS-IP:8080in their browser
If you have devices on the same network but no internet:
- Run
./ChatTeston one machine - Other devices on the same network connect via
http://LOCAL-IP:8080 - Works on home routers, office networks, or any LAN setup
# Generate self-signed cert (for local/LAN use)
openssl req -x509 -newkey rsa:4096 -keyout server.key -out server.crt -days 365 -nodes
# Run on port 443
ChatPort=443 ./ChatTestFor production, use a real certificate from Let's Encrypt.
| Method | Endpoint | Description | Auth |
|---|---|---|---|
| POST | /api/auth/register |
Register a new user | No |
| POST | /api/auth/login |
Login | No |
| PUT | /api/auth/profile |
Update display name | Yes |
| GET | /api/rooms/my |
List rooms owned by user | Yes |
| POST | /api/rooms |
Create a new room | Yes |
| PUT | /api/rooms/:key |
Update a room (owner only) | Yes |
| DELETE | /api/rooms/:key |
Delete a room (owner only) | Yes |
| GET | /api/chat/:key |
Get room info and messages | No |
| POST | /api/chat/:key |
Send a message | Yes |
| PUT | /api/chat/message/:id |
Edit a message (sender only) | Yes |
| DELETE | /api/chat/message/:id |
Delete a message (sender only) | Yes |
- One person creates a room and gets a 24-character key
- Share that key privately (in person, over the phone, on paper)
- Others enter the key to join the room
- Everyone in the room can send and read messages
- Messages are stored on the server -- no external services involved
.
├── main.go # Server, routes, handlers, database
├── message.go # Message struct
├── go.mod / go.sum # Dependencies
├── server.crt/key # TLS certificate
├── templates/
│ ├── index.html # Web UI
│ ├── script.js # Frontend logic
│ ├── style.css # Styles
│ └── Vazir-FD-WOL.ttf # Persian font
└── sqliteTest.db # SQLite database (auto-created)
MIT License. See LICENSE for details.