The Literary Lions Forum is designed to help book club enthusiasts to engage in meaningful discussions, share insights, and explore deeper literary themes. Users can create posts, leave comments, categorize discussions, like/dislike content, and filter posts. The forum utilized SQLite as the database, and is containerized using Docker.
- Users can register with an email, username, and password.
- Login is based on email and password.
- Session management is handled using cookies with expiration time.
Passwords are stored securely in the database using BCrypt encryption. Sessions are managed using UUIDs, providing secure and unique identification for user sessions.
You can find a database schema with relationships between entities of the structure in the ERD Diagram
User registration data is stored in forum.db. Interaction with the database is carried out through SQL queries SELECT, CREATE and INSERT.
consists of the following tables:
- Users: Stores user information (email, username, password hash).
- Posts: Contains posts made by users.
- Comments: Stores comments on posts.
- Categories: Defines categories for posts (Literature, Poetry, Non-fiction, Short Stories).
- Likes_dislikes: Stores likes/dislikes on posts.
- Comment_likes: Stores likes/dislikes on comments.
- Sessions: Stores unique session identifier, user_id associated with the session and the session expiration time.
Only registered users can create posts and comments. Posts can be associated with specific categories (Literature, Poetry, Non-fiction, Short Stories).
Registered users can like or dislike posts and comments. The number of likes/dislikes, posts and comments are visible to all users, providing instant feedback on the popularity of discussions.
- Backend: Go (Golang 1.20 or later)
- Database: SQLite with go-sqlite3 driver
- Frontend: HTML, CSS, Go
- Containerization: Docker
Clone the repository:
git clone https://gitea.koodsisu.fi/juliageorgieva/literary-lions
cd literary-lions
Install Go dependencies if necessary:
go mod tidy
Initialize SQLite database regarding https://pkg.go.dev/github.com/mattn/go-sqlite3
Follow the steps below to set up Docker, build the Docker image, run the container, and maintains a clean environment.
Before you begin, ensure that Docker is installed on your machine. Download Docker Desktop from the Docker website. If you use WSL: https://docs.docker.com/desktop/wsl/.
- For Windows: After installation, start Docker Desktop and ensure it is running.
- For macOS: Open the downloaded .dmg file and drag Docker to your Applications folder, launch and ensure it is running.
- For Linux: Follow the official Docker installation guide for your distribution: https://docs.docker.com/desktop/install/linux/
Start the Docker service:
sudo systemctl start docker
Ensure Docker is running:
systemctl status docker
docker build -t lions-forum-image .
or
DOCKER_BUILDKIT=0 docker build --no-cache -t lions-forum-image .
If you got "ERROR: BuildKit is enabled but the buildx component is missing or broken."
docker run -d -p 8080:8080 -v lions_volume:/literary-lions/ --name lions-forum lions-forum-image
This command runs a container named from the , mapping port 8080 on the host to port 8080 on the container. The application will be available at http://localhost:8080.
docker ps
Lists all running containers.
docker images
Shows all images. You can check the logs of the running container:
docker logs lions-forum
To stop container:
docker stop container_ID
Remove stopped containers:
docker rm -f <container_name_or_id>
Remove image:
docker rmi <image_name_or_id>
docker image prune -a -f
for all unused images.
Remove unused volumes:
docker volume prune -f
Remove unused networks:
docker network prune -f
Full system cleanup (optional):
docker system prune -a --volumes -f
This command removes all unused containers, images, volumes, and networks, providing a comprehensive cleanup.
docker-compose down --rmi all
For deleting all images related to project.
docker system df
to get a general idea of how much space images, containers, networks, and volumes are taking up.
Once the forum is up and running:
- Go to the homepage: http://localhost:8080
- Register a new account.
- Log in to create posts or comments, like or dislike.
- Browse the forum by posts and interact with other users by likes and comments.
- Filter posts by different categories on the homepage.
- Search posts on the homepage for specific content or topic.
- Explore user profile and see your posts, comments, liked content.
- A search bar allows user to search for specific posts or topics
- Users have access to profile pages.The profile allows the user to view posts and comments they have created or liked, with links to the full content of all posts listed.
Julia Georgieva Georgieva, Mariia Melnikova, Tatiana Vedishcheva. Hit us up in Discord if you have any questions!