Connecthub RT
A real-time forum + chat built with Go, WebSocket, and SQLite.
Posts โข Comments โข Categories โข Private chat โข Live updates
Highlights โข Get Started โข API โข Database โข Screenshots
Welcome to Connecthub RT, a real-time forum and messaging app built in Go. It combines a classic discussion feed (posts, comments, categories) with live features like instant updates and private chat.
The goal of the project is simple: build a clean, reliable community platform where conversations donโt feel delayed โ while practicing real-world backend patterns like sessions, database design, and WebSocket-driven updates.
git clone https://github.com/sahmedhusain/connecthub-rt.git
cd connecthub-rt
go mod download
./run.sh
Then open: http://localhost:8080
Main forum interface โ clean layout, easy navigation
- โจ What Makes This Special
- ๐ ๏ธ What We Built It With
- ๐๏ธ How It All Works Together
- ๐ป What You Need to Run It
- ๐ Getting Started (Super Easy)
- ๐ How to Use It
- ๐ For Developers (API Stuff)
- ๐๏ธ The Database Behind It All
- โก The Real-Time Magic
- ๐ง For People Who Want to Contribute
- ๐ Legal Stuff
- ๐ Credits
- ๐ฅ Who Built This
- Forum + chat in one app: posts, comments, categories, and private messaging.
- Real-time UX: live comments, online status, and instant message delivery via WebSocket.
- Go backend + SQLite persistence: simple architecture with solid fundamentals.
- Practical security basics: bcrypt password hashing, validated inputs, and session tokens.
- Easy to run: works locally and via Docker.
Browser (HTML/CSS/JS)
โ HTTP (auth, posts, comments)
Go Server (Mux + Handlers) โโโ SQLite (persistence)
โ WebSocket (live updates + chat)
Real-time Hub (connections + broadcast)
Registration โ quick form, straightforward fields
Login โ sign in using username or email
- No complicated setup - Just pick a username, add your email, and you're in
- Flexible login - Can't remember if you used your username or email? No problem, both work
- Secure and private - Your password is safely encrypted, and we use smart session management
- Personal touch - Choose your avatar and add your personal details
Post creation โ title, content, and categories
Category filtering โ browse posts by topic
- Write posts - Share your ideas, ask questions, or start discussions
- Organize by topics - Choose categories like "Go", "JavaScript", "Git", etc.
- See everything at a glance - Posts show in a clean feed, newest first
- Join the conversation - Comment on posts and keep discussions going
Private messaging โ real-time chat between users
- Private conversations - Chat one-on-one with anyone
- See who's online - Know when your friends are available to chat
- Never miss a message - Get notified instantly when someone replies
- Chat history - Scroll back through your conversations
Post details โ comments update live
Comments โ updates appear in real time
- Live updates - New posts and comments show up without refreshing the page
- Typing indicators - See when someone is typing a response
- Online status - Know who's active right now
- Instant messaging - Messages appear immediately, like a real chat app
| What People Usually Deal With | What Connecthub RT Does | Why It's Better |
|---|---|---|
| "I have to refresh to see new posts" | Updates appear automatically | โก No more manual refreshing |
| "I don't know who's online" | See who's active in real-time | ๐ฅ Feel connected |
| "Discussions feel slow" | Instant messaging and comments | ๐ฌ Conversations flow naturally |
| "Setup is complicated" | One command to start | ๐ ๏ธ Ready in minutes |
| "Can't use on mobile" | Works great on phones and tablets | ๐ฑ Truly responsive |
This isn't just another forum. It's built for people who want real conversations. Whether you're learning to code, sharing project ideas, or just want to connect with like-minded people, Connecthub RT makes it feel natural and immediate.
- Go 1.23.2 - A fast, reliable programming language that's great for web servers
- SQLite - A lightweight database that stores everything in one file
- Gorilla WebSocket - Makes real-time communication possible
- Gorilla Mux - Helps organize all the different web routes
- bcrypt - Keeps passwords safe and secure
- Plain JavaScript - No fancy frameworks, just reliable code that works
- HTML5 & CSS3 - Modern web standards for a clean, responsive design
- WebSocket - The technology that makes everything feel instant
- UUID tokens - Unique session IDs that keep you logged in securely
- Password encryption - Your password is never stored as plain text
- Input checking - Everything you enter gets validated for safety
Imagine you're at a busy coffee shop. People are talking, sharing ideas, and having conversations. That's basically what Connecthub RT does, but online.
Your Browser (What you see) โ Web Server (Go) โ Database (SQLite)
โ
WebSocket Connection (Real-time updates)
The web server handles all the logic - checking logins, saving posts, managing chats. The database remembers everything. And WebSocket keeps everything synchronized so everyone sees updates instantly.
connecthub-rt/
โโโ main.go # The starting point of everything
โโโ database/ # Where all your data lives
โ โโโ database.go # Database setup and connections
โ โโโ queries.go # All the data operations
โ โโโ seed_data.sql # Sample data for testing
โโโ repository/ # Clean data access layer
โโโ server/ # Web server and API endpoints
โโโ websocket/ # Real-time communication
โโโ src/ # Web pages and styling
- Computer: Windows, Mac, or Linux
- Go: Version 1.19 or newer (we recommend 1.23.2)
- Web Browser: Chrome, Firefox, Safari, or Edge (recent versions)
- Internet: For downloading dependencies
- Storage: About 100MB of free space
- Go 1.23.2 - Latest stable version
- 1GB RAM - For smooth performance
- Modern browser - For the best experience
Ready to try it out? Here's how to get Connecthub RT running on your computer.
# 1. Download the project
git clone https://github.com/sahmedhusain/connecthub-rt.git
cd connecthub-rt
# 2. Install everything automatically
go mod download
# 3. Start the server
./run.shThat's it! Open http://localhost:8080 in your browser and you're ready to go.
Tip:
./run.shruns locally../run.sh dockerruns the same setup using Docker.
# Get the code
git clone https://github.com/sahmedhusain/connecthub-rt.git
cd connecthub-rt
# Download dependencies
go mod tidy
# Add some sample data (optional)
go run main.go --reset --test-data
# Start on a specific port
go run main.go --port=3000Don't want to install Go or deal with dependencies? Docker makes it super simple!
Prerequisites for Docker:
- Docker Desktop (for Windows/Mac)
- Or Docker Engine on Linux
- About 500MB free space
Quick Docker Start:
# Clone the project
git clone https://github.com/sahmedhusain/connecthub-rt.git
cd connecthub-rt
# Run with Docker (includes everything!)
./run.sh dockerWhat happens when you run Docker:
- Downloads the Docker image (only needed first time)
- Builds the application automatically
- Starts the server on
http://localhost:8080 - Sets up the database with sample data
Manual Docker Commands:
# Build the Docker image
docker build -t connecthub-rt .
# Run the container
docker run -p 8080:8080 -v $(pwd)/database:/app/database connecthub-rt
# Or use Docker Compose (if available)
docker-compose up --buildDocker Benefits:
- โ No Go installation needed
- โ All dependencies included
- โ Same experience on any computer
- โ Easy cleanup - just stop the container
- โ Perfect for testing different environments
# Install hot reload for development
go install github.com/air-verse/air@latest
air- Sign Up - Create your account with a username and email
- Check Your Profile - Add your name, choose an avatar
- Start Exploring - Look at existing posts and categories
- Join In - Comment on posts or start your own
- Browse the feed - See all posts, newest first
- Filter by category - Click "Go", "JavaScript", etc. to focus on topics you care about
- Read comments - Click on any post to see the full discussion
- Click "New Post" in the top navigation
- Give your post a clear title
- Write your content (up to 500 characters)
- Pick relevant categories
- Hit "Post" - it's live immediately!
- Find someone - Look at user profiles or the online list
- Start chatting - Click to begin a conversation
- Type and send - Messages appear instantly for both people
- Stay connected - See when people are online
- Categories help - Use them to find posts about specific technologies
- Check online status - Green dot means someone's available to chat
- Read before posting - See if your question was already asked
- Be respectful - This is a community, treat others well
Want to explore without signing up? Use these test accounts:
Password for all: Aa123456
alexchen- Tech professionalmarcusr- Developerpriyap- Cloud engineerjamest- Startup founder
๐ Developer Notes (API examples)
POST /api/register
{
"username": "johndoe",
"email": "john@example.com",
"password": "securepass123",
"firstName": "John",
"lastName": "Doe",
"gender": "male"
}POST /api/login
{
"identifier": "johndoe",
"password": "securepass123"
}POST /api/posts
Cookie: session_token=your_token
{
"title": "My Awesome Post",
"content": "This is what I want to share...",
"categories": ["general", "discussion"]
}GET /api/posts?category=general&limit=10POST /api/posts/123/comments
Cookie: session_token=your_token
{
"content": "Great post! I think..."
}POST /api/messages
Cookie: session_token=your_token
{
"recipientId": 456,
"content": "Hey, how's it going?"
}GET /api/conversations
Cookie: session_token=your_token// Connect to real-time updates
const ws = new WebSocket("ws://localhost:8080/ws");
// Authenticate
ws.send(
JSON.stringify({
type: "auth",
token: "your_session_token",
})
);
// Send a message
ws.send(
JSON.stringify({
type: "message",
recipientId: 123,
content: "Hello!",
})
);
// Listen for updates
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
console.log("New update:", data);
};๐๏ธ Database (schema + Mermaid ERD)
Connecthub RT uses SQLite - think of it as a single file that holds all your data, like a super-organized spreadsheet.
Stores everyone's profile information:
- Names, usernames, emails
- Passwords (safely encrypted)
- Profile pictures and personal details
Your main content:
- Post titles and content
- Who wrote it and when
- Categories it belongs to
Discussions on posts:
- Who commented and what they said
- Links back to the original post
Private conversations:
- Who sent what to whom
- When it was sent
- Read/unread status
Topic organization:
- Names like "Go", "JavaScript", "Git"
- Helps people find relevant content
Users create Posts and Comments
Posts belong to Categories
Users send Messages to each other
Everything is tracked with timestamps
erDiagram
users ||--o{ posts : creates
users ||--o{ comments : writes
users ||--o{ messages : sends
posts ||--o{ comments : has
posts ||--o{ post_has_categories : categorized_as
categories ||--o{ post_has_categories : contains
conversations ||--o{ messages : contains
users ||--o{ conversation_participants : participates_in
conversations ||--o{ conversation_participants : has_members
users {
INTEGER userid PK
TEXT username UK
TEXT email UK
TEXT password
TEXT avatar
TEXT gender
DATE date_of_birth
}
posts {
INTEGER postid PK
TEXT title
TEXT content
DATETIME post_at
INTEGER user_userid FK
}
comments {
INTEGER commentid PK
TEXT content
DATETIME comment_at
INTEGER post_postid FK
INTEGER user_userid FK
}
categories {
INTEGER idcategories PK
TEXT name
}
messages {
INTEGER message_id PK
INTEGER conversation_id FK
INTEGER sender_id FK
TEXT content
DATETIME sent_at
BOOLEAN is_read
}
WebSocket technology creates a direct connection between your browser and the server. Instead of constantly asking "any updates?", the server tells you immediately when something happens.
- Live comments - See new replies as they're posted
- Instant messages - Chat feels like texting
- Online indicators - See who's active right now
- Typing notifications - Know when someone is composing a message
// Your browser connects once
const connection = new WebSocket("ws://localhost:8080/ws");
// Server sends updates automatically
// No need to refresh or poll for changes- Report bugs - Found something not working? Let us know
- Suggest features - Have ideas for improvements? Share them
- Write code - Fix bugs or add new features
- Improve documentation - Help make things clearer
- Test things - Try different scenarios and report issues
- Fork the project on GitHub
- Clone your fork:
git clone https://github.com/your-username/connecthub-rt.git - Create a branch:
git checkout -b my-improvement - Make changes and test them
- Submit a pull request with a clear description
- Clear code - Easy to understand and maintain
- Good tests - Make sure new features work and don't break existing ones
- Documentation - Explain how new features work
- Consistent style - Follow the existing code patterns
Found a bug? Please include:
- What you were doing when it happened
- What you expected to happen
- What actually happened
- Steps to reproduce the issue
- Your browser and operating system
This project uses the MIT License. Basically, you can use, modify, and share this code freely. We just ask that you give credit where it's due.
This project was built as part of a learning journey into Go web development. It combines modern web technologies with real-time communication to create something useful and educational.
- Sayed Ahmed Husain - sayedahmed97.sad@gmail.com
- Qasim Aljaffer
- Mohammed AlAlawi
- Abdulla Alasmawi
Q: Do I need programming experience to use this? A: Not at all! It's designed to be user-friendly for everyone.
Q: Can I use it on my phone? A: Yes! It works great on phones, tablets, and computers.
Q: Is my data safe? A: Yes - passwords are encrypted, and we follow web security best practices.
Q: How many people can use it at once? A: Itโs built with concurrency in mind (Go + WebSocket). Practical limits depend on your machine, network, and workload, so itโs best validated with load testing for your target environment.
Q: Does it work offline? A: The basic interface loads, but real-time features need an internet connection.
Q: I'm new to coding - can I still help? A: Absolutely! You can help with documentation, testing, or suggesting improvements.
Q: How do I report a bug? A: Use the GitHub Issues page with clear steps to reproduce the problem.
This project taught me:
- Real-time web application development with Go and WebSocket.
- Database design and efficient querying with SQLite.
- Secure user authentication and session management.
- Frontend integration with modern HTML, CSS, and JavaScript.
- Containerization and deployment best practices.
- No advanced search functionality.
- Basic moderation features.
- Limited scalability for extremely high traffic.
- Implement advanced search and filtering.
- Add comprehensive moderation tools.
- Enhance scalability with microservices.
- Integrate additional authentication providers.
- Add push notifications for mobile devices.
Connecthub RT exists to make online discussions feel more natural and immediate. Instead of waiting for page refreshes or dealing with slow forums, you get real-time updates that make conversations flow like they would in person.
Whether you're here to learn, teach, or just connect with interesting people, we hope you enjoy using it as much as we enjoyed building it!
Built with Go and WebSocket, with a focus on real-time interaction and clean fundamentals.