Welcome to 01 ConnectHub, a fullโstack web forum application built with Go, designed to bring people together through structured discussions and shared ideas. The platform allows users to create accounts, publish posts, participate in conversations through comments, and express feedback using likes and dislikes โ all within a secure and wellโorganized environment.
Rather than focusing only on visual presentation, 01 ConnectHub places strong emphasis on backend architecture, data integrity, and user management. The project was built as a realistic forum system, reflecting how modern community platforms handle authentication, content moderation, and user interactions while maintaining simplicity and clarity in the user experience.
01 ConnectHub brings together the essential features expected from a modern discussion platform. Each feature was implemented with a focus on security, usability, and maintainability, reflecting realโworld web application behavior rather than simplified demos.
Here are the main features that make 01 ConnectHub special:
-
User Registration and Login ๐: Users can create accounts using an email, username, and password, enabling secure access to the platform. Passwords are securely encrypted using bcrypt hashing to protect against breaches. Sessions are managed with cookies that expire, ensuring users stay logged in safely. Social login via Google or GitHub is also available using OAuth2, making it easy to join without creating a new password.
-
Creating and Managing Posts ๐: Logged-in users can write posts with titles, content, and categories. Posts can be edited or deleted by the author. Categories help organize content, like "General Discussion" or "Tech Talk".
-
Comments on Posts ๐ฌ: Add comments to posts to start discussions. Comments are threaded, so replies are easy to follow. Users can comment on posts to share opinions or ask questions.
-
Liking and Disliking ๐๐: Show what you think by liking or disliking posts and comments. The total likes and dislikes are visible to everyone, helping highlight popular content.
-
Image Uploads ๐ผ๏ธ: Attach images to your posts to make them more visual and engaging. Images are uploaded securely using Go's multipart form handling, stored in the server's file system, and served efficiently.
Supported formats include common image types like JPEG and PNG, with size limits to prevent abuse.
-
Moderation Tools ๐ก๏ธ: Admins and moderators have special powers to manage the forum. They can delete inappropriate posts or comments, ban users, and report content. Moderation helps keep the community safe and respectful. Roles are assigned based on user permissions in the database.
-
Filtering Posts ๐: Find posts easily by category, your own posts, liked posts, or posts you've commented on. This helps you discover relevant content quickly without scrolling through everything.
-
Notifications ๐: Get notified about new comments on your posts or other interactions. Notifications appear on the user's profile page.
-
Security Measures ๐: The site protects against common web threats like CSRF attacks using tokens, input validation to prevent SQL injection, and secure password handling.
-
Social Login ๐: Quick login with Google or GitHub without needing a separate password, using OAuth2 protocol for secure authentication.
These features work together to create a complete forum experience.
01 ConnectHub is built using these tools and languages:
-
Go ๐น: The main programming language for the server, handling requests, and running the application. Uses goroutines for concurrent user handling.
-
HTML ๐: For creating the structure of web pages, like forms and layouts.
-
CSS ๐จ: For styling the pages to look good and work on different devices.
-
JavaScript โก: For adding interactive elements, like menus that drop down.
-
SQLite ๐๏ธ: A simple database to store all the user data, posts, and comments.
-
Docker ๐ณ: For packaging the app so it runs the same way everywhere.
-
Gorilla Sessions ๐ช: A Go library for managing user sessions securely with cookies.
-
OAuth2 ๐: Protocol for secure social logins with Google and GitHub.
-
UUID ๐: For generating unique identifiers for sessions and users.
-
Bcrypt ๐: For hashing passwords securely during authentication.
-
Multipart Forms ๐: Go's built-in support for handling file uploads, used for image uploads.
These technologies ensure the app is secure, fast, and user-friendly.
01 ConnectHub follows a serverโrendered web architecture, combining Go HTTP handlers, HTML templates, and a relational database to manage users, content, and interactions securely and efficiently.
The purpose of 01 ConnectHub goes beyond building a simple forum. The project aims to model how real discussion platforms manage users, content, and interactions while remaining understandable, maintainable, and extensible for future improvements.
Our goal with 01 ConnectHub is to provide a simple yet powerful forum where people can connect and share ideas. The app handles user accounts, posts, comments, and interactions smoothly.
The forum works with these key parts:
-
Users ๐ค: People who register and log in to use the site.
-
Posts ๐: Main content shared by users, grouped by categories.
-
Comments ๐ฌ: Responses to posts for discussions.
-
Interactions ๐: Likes and dislikes to show agreement or disagreement.
We use a database to keep everything organized.
The database is set up like this to store information:
-
Users Table: Holds user details like email, username, and encrypted password.
-
Posts Table: Stores post info, linked to the user who made it and a category.
-
Comments Table: Keeps comments, connected to posts and users.
-
Categories Table: Lists categories for organizing posts.
-
Likes Table: Records likes and dislikes from users.
Here's a simple view:
Users: id, email, username, password_hash, created_at
Posts: id, user_id, title, content, category_id, created_at
Comments: id, post_id, user_id, content, created_at
Categories: id, name
Likes: id, user_id, post_id/comment_id, type (like/dislike)
| Table | Key Fields | What It Stores |
|---|---|---|
| Users | id, email, username | User accounts and login info |
| Posts | id, user_id, title | Forum posts with text and images |
| Comments | id, post_id, content | Comments under posts |
| Categories | id, name | Groups for posts |
| Likes | user_id, post_id | User opinions on posts and comments |
Users move through the site like this:
Registration/Login ---- Create Post ---- Add Comment ---- Like/Dislike
-
Steps: Start by signing up, then post, comment, and interact.
-
Connections: Each action leads to the next, building discussions.
This flow makes the site easy to use.
The following flowchart illustrates the overall logic flow of the 01 ConnectHub application, including user interactions, server handling, authentication, and database operations:
flowchart TD
A[User Browser] --> B[HTTP Request to Go Server]
B --> C{URL Path & Method Check}
C -->|Invalid| D[Error Handler - 404/405]
C -->|Valid| E{Authentication Required?}
E -->|No| F[Public Pages: Login/Signup]
E -->|Yes| G[Auth Middleware]
G --> H{Session Cookie Present?}
H -->|No| I[Redirect to Login]
H -->|Yes| J[Validate Session in DB]
J -->|Invalid| I
J -->|Valid| K[Proceed to Handler]
F --> L[Login Handler]
L --> M{POST Request?}
M -->|No| N[Render Login Form]
M -->|Yes| O[Validate Credentials]
O -->|Invalid| P[Show Error on Login Page]
O -->|Valid| Q[Create/Update Session in DB]
Q --> R[Set Session Cookie]
R --> S[Redirect to Home]
F --> T[Signup Handler]
T --> U{POST Request?}
U -->|No| V[Render Signup Form]
U -->|Yes| W[Validate Input & Hash Password]
W -->|Invalid| X[Show Error on Signup Page]
W -->|Valid| Y[Insert User into DB]
Y --> Q
K --> Z[Home Page Handler]
Z --> AA[Query Posts, Categories from DB]
AA --> BB[Render Home Template with Data]
K --> CC[Post Creation Handler]
CC --> DD[Validate Input & Upload Image]
DD -->|Invalid| EE[Show Error]
DD -->|Valid| FF[Insert Post into DB]
FF --> GG[Redirect to Home]
K --> HH[Comment Handler]
HH --> II[Insert Comment into DB]
II --> JJ[Redirect to Post Page]
K --> KK[Like/Dislike Handler]
KK --> LL[Insert/Update Like/Dislike in DB]
LL --> MM[Update Counts]
K --> NN[Admin/Moderator Handlers]
NN --> OO[Query Users/Posts/Reports from DB]
OO --> PP[Render Admin/Moderator Template]
PP --> QQ[Actions: Delete, Ban, etc.]
QQ --> RR[Update DB]
B --> SS[OAuth2 Login: Google/GitHub]
SS --> TT[Redirect to Provider]
TT --> UU[Provider Auth]
UU --> VV[Callback Handler]
VV --> WW[Exchange Code for Token]
WW --> XX[Fetch User Info]
XX --> YY[Create/Update User in DB]
YY --> Q
D --> ZZ[Render Error Template]
P --> ZZ
X --> ZZ
EE --> ZZ
This flowchart provides a high-level overview of the application's logic flow, from user requests through server processing, authentication checks, database interactions, and response rendering.
-
Go 1.23.2 or higher installed on your machine.
-
Docker and Docker Compose (optional).
- Clone the repo:
git clone https://github.com/sahmedhusain/01connecthub.git
- Go to the project folder:
cd 01connecthub - Install dependencies:
go mod tidy
- Build the application:
go build -o 01connecthub
- Run the server:
./01connecthub
Once the server is running, here's how to use 01 ConnectHub:
-
Sign Up or Log In: Create an account with your email and password, or use Google/GitHub.
-
Make a Post: Click to create a new post, add a title, content, category, and maybe an image.
-
Comment: On any post, add your thoughts in the comments section.
-
Interact: Like or dislike posts and comments to share your views.
-
Filter: Use the filter options to see posts by category or your activity.
-
Moderate: If you're an admin, manage users and content from the admin page.
The site guides you through each step.
Behind the scenes, the app does these database tasks:
-
Create: Add new posts, comments, or users.
-
Read: Fetch posts to display.
-
Update: Change post content or user info.
-
Delete: Remove posts or comments.
๐ง Core Concepts: Serverโside rendering โข Authentication & sessions โข SQL persistence โข Roleโbased access control
ConnectHub uses web development patterns to handle requests. The main steps are:
-
Handle Requests: Parse HTTP requests with Go handlers.
-
Authenticate Users: Validate sessions and credentials.
-
Process Data: Query database for posts, comments.
-
Render Pages: Use HTML templates to display content.
-
Manage Security: Implement CSRF and secure cookies.
The ERD shows relationships between User, Post, Comment, Category, and Like entities, including their attributes.
For login:
-
You enter your details on the login page.
-
The app hashes your password with bcrypt and compares it to the stored hash in the database.
-
If correct, a session is created using Gorilla Sessions, storing a unique UUID in a secure cookie.
-
For social login, OAuth2 redirects to Google/GitHub, which returns user info to create or log in the user.
-
Sessions expire after a set time for security.
Uploading images:
-
Users select a file on the post creation page.
-
The form uses multipart encoding to send the file.
-
Go's http package parses the multipart form, validates the file type and size.
-
The image is saved to the server's static/uploads folder with a unique name.
-
The file path is stored in the database linked to the post.
-
Images are served via the /static/ route.
Moderating the forum:
-
Admins have a special role checked in the database.
-
From the admin page, they can view all users and posts.
-
Deleting a post or comment removes it from the database and updates related counts.
-
Banning a user sets a flag in their profile, preventing login.
-
Reports are handled by admins reviewing flagged content.
Managing posts and comments:
| Action | What Happens | Example SQL |
|---|---|---|
| Add Post | Save to database | INSERT INTO posts VALUES (...) |
| Show Posts | Get from database | SELECT * FROM posts |
| Add Comment | Link to post and save | INSERT INTO comments VALUES(...) |
This keeps everything organized.
When you like something:
-
The like count goes up.
-
The page updates to show the change.
$ go build -o 01connecthub
$ ls -la 01connecthub
-rwxr-xr-x 1 user group 12345678 Dec 24 12:00 01connecthub$ ./01connecthub
Server running on http://localhost:8080
To stop the server press Ctrl+C$ docker-compose up --build
Building 01connecthub
...
01connecthub_1 | Server running on http://localhost:8080The app turns user inputs into database entries:
-
User Data: Email, name, password.
-
Post Data: Title, text, category.
-
Comment Data: Text linked to posts.
It checks inputs to prevent errors.
The code is organized like this:
-
main.go: Starts the server.
-
database/: Connects to and queries the database.
-
src/server/: Handles web requests.
-
src/authentication/: Manages logins.
-
templates/: HTML pages.
-
static/: Styles and scripts.
If something goes wrong, like wrong login or missing data, the app shows a clear message and stops. Common issues include invalid emails or database problems.
The app runs efficiently for many users at once.
We'd love your help! Fork the repo, make changes, and send a pull request. Please follow Go standards and add tests where possible.
Licensed under MIT - check LICENSE.md for more.
This project was created during a Go web development learning journey, emphasizing full-stack implementation and community building. Inspired by modern forum platforms.
-
Sayed Ahmed Husain - [email protected]
-
Qasim Aljaffer
-
Mohammed AlAlawi
-
Abdulla Alasmawi
Building this taught me:
-
Web application development with Go.
-
Database design and SQL queries.
-
User authentication and security.
-
Frontend integration with HTML/CSS/JS.
-
Containerization with Docker.
-
No real-time updates (requires page refresh).
-
Limited scalability for very large user bases.
-
Basic moderation features.
-
No advanced search functionality.
-
Add real-time notifications with WebSockets.
-
Implement advanced search and filtering.
-
Enhance moderation with AI content detection.
-
Add user roles and permissions.
-
Integrate more social authentication providers.







