A lightweight, feature-rich forum application built with Go and SQLite. This project follows a clean, modular architecture (DDD-lite) to ensure scalability and maintainability.
- Authentication & Security:
- Secure registration and login using Bcrypt for password hashing.
- Session management using UUID and HttpOnly cookies.
- Posts & Content:
- Create and view posts with titles and descriptions.
- Categorize posts (supports multiple categories per post).
- Filter posts by category, user, or liked posts.
- Interactions:
- Like or dislike posts and comments.
- Nested comment system for discussions.
- Design:
- Responsive UI built with Vanilla CSS and HTML templates.
- Dynamic updates using the internal JSON API.
- Backend: Go (Golang)
- Database: SQLite3
- Frontend: HTML5, Vanilla CSS, Vanilla JavaScript
- Security: Bcrypt, UUID v4
The project is structured into three distinct layers to decouple business logic from data access and the web interface:
- Handler Layer: Manages HTTP requests/responses, JSON encoding, and template rendering.
- Service Layer: The "Brain" of the application. Handles validation, business rules, and coordinates between repositories.
- Repository Layer: Handles raw SQL queries and interacts directly with the SQLite database.
- Go 1.25+ installed on your system.
- GCC (required for the SQLite driver).
-
Clone the repository:
git clone https://learn.zone01kisumu.ke/git/sjarso/forum.git cd forum -
Run the application:
go run cmd/app/main.go
The server will start at
http://localhost:8080. The database will be automatically initialized on the first run.
- Build and run the container:
docker build -t forum-app . docker run -p 8080:8080 forum-app
The database is managed via automatic migrations. Core tables include:
users: User profiles and credentials.posts: Core forum content.categories: Available topics.post_categories: Links posts to their respective categories.comments: Discussion threads.reactions: Like/Dislike tracking.sessions: Active user sessions.
- Create a feature branch (
feat/your-feature). - Commit changes using descriptive messages.
- Open a Pull Request for review.