- ๐ค What is Faux Rhum ?
โถ๏ธ Demo- ๐ ๏ธ How to Install
3.1 ๐งฐ Dependencies - ๐ Run the server
4.1 ๐ณ Environment Variables
4.2 ๐ง Configure OAuth - ๐๏ธ File Architecture
- ๐ฎ Features
6.1 ๐ชช OAuth
6.2 ๐จ Forum Administration
6.3 ๐งฎ Filters
6.4 ๐จ Notifications
6.5 ๐ User Activity - ๐ Post Management
7.1 ๐ Post Lifecycle
7.2 ๐ฌ Comments
7.3 ๐ Reactions - ๐ชExtra Features
8.1 ๐ Search Bar
8.2 ๐จ Theme Changer
8.3 ๐๏ธ Markdown Rendered
8.4 โฌ๏ธ User Ranking
8.5 โ๏ธ Profile Settings
8.6 โ SQL Triggers - โจComing in the future
- ๐ Credits
- ๐ Appendix
Faux Rhum is the final school project for our 1st IT/CyberSecurity year.
The theme of the project was to make a complete community forum using Golang, HTML/CSS/JS, MySQL and Docker.
Our team decided to base the forum theme on a pun I made for joke "Faux-Rhum" which mean "Fake Rhum"
but phonetically sounds like "Forum".
The forum role is to allow a community of people who like to talk about alcohol, rum and other drinks to share their opinions, recipes, and experiences.
In this forum, you can create posts, comment on them, react to them, and manage your profile.
To install the app, you will need to have on your machine :
Other dependencies :
- ๐GCC Compiler (for Windows users)
apt install libwebp(for Linux users)
This library is necessary to handle the webp images and there conversion, the project won't run without it.
git clone https://github.com/Oiha-dev/Faux-Rhum.git
cd Faux-Rhum/โ Make sure you have environment variables set up before running the server โ
Run Faux-Rhum with the cmd using the following commands
docker compose up --build -d
This command will build the Docker image and run the container in detached mode.
It can take several seconds to build the image.
And then if you want to see the logs of the container, you can use the command
docker logs -f forum
After that, open your web browser and go to http://localhost:8080/ to go on the Home Page.
The server will be hosted on your localhost address on the port 8080
The 'Home Page' is the '/' route
To stop the server, you can use the command
docker compose down
To run the server, you will need to set up some environment variables.
You can use the '.env.public' example file to create your own '.env' file.
Here is the list of environment variables you need to set up:
# .env
DATABASE_IP=db
DATABASE_PORT=3306
DATABASE_NAME=forum
DATABASE_USER=forum
DATABASE_PASSWORD=forum
# OAuth configuration
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
GOOGLE_REDIRECT_URL=http://localhost:8080/auth/google/callback
GITHUB_CLIENT_ID=your-github-client-id
GITHUB_CLIENT_SECRET=your-github-client-secret
GITHUB_REDIRECT_URL=http://localhost:8080/auth/github/callback
# Session secret key
SESSION_SECRET_KEY=your-session-secret-keyTo configure Google OAuth, you will need to create a project on the Google Developers Console.
- Go to the Google Developers Console.
- Create a new project.
- Go to the "Credentials" tab.
- Click on "Create credentials" and select "OAuth client ID".
- Select "Web application" as the application type.
- Add the following authorized redirect URIs:
http://localhost:8080/auth/google/callback
- Click on "Create" and copy the
Client IDandClient Secretto your.envfile. - Click on "Save".
To configure GitHub OAuth, you will need to create a new OAuth application on the GitHub Developer Settings.
- Go to the GitHub Developer Settings.
- Click on "New OAuth App".
- Fill in the application name, homepage URL, and description.
- In the "Authorization callback URL" field, enter
http://localhost:8080/auth/github/callback. - Click on "Register application".
- Copy the
Client IDandClient Secretto your.envfile. - Click on "Save".
forum/
โโโ auth/
โ โโโ google_oauth.go
โ โโโ middleware.go
โ โโโ session.go
โ โโ ...
โโโ cmd/
โ โโโ main.go
โโโ db/
โ โโโ CRUD/
โ โ โโโ notificationCRUD.go
โ โ โโโ postCRUD.go
โ โ โโโ userCRUD.go
โ โ โโ ...
โ โโโ dbConnection.go
โ โโโ dbQueries.go
โโโ docker/
โ โโโ Dockerfile
โ โโโ init
โ โโโ forum.sql
โโโ post/
โ โโโ ...
โโโ render/
โ โโโ render.go
โ
โโโ handlers/
โ โโโ modifyPostHandler.go
โ โโโ LoginHandler.go
โ โโโ postCreationHandler.go
โ โโโ postDeleteHandler.go
โ โโโ ...
โโโ server/
โ โโโ routes.go
โ โโโ startServer.go
โ
โโโ structures/
โ โโโ webTemplatesStructures.go
โโโ utils/
โ โโโ environmentVariable.go
โ โโโ password.go
โ โโโ ...
โโโ web/
โ โโโ static/
โ โ โโโ ...
โ โ
โ โโโ templates/
โ โโโ layouts/
โ โ โโโ headerLayout.gohtml
โ โ โโโ ...
โ โโโ login.gohtml
โ โโโ panelAdmin.gohtml
โ โโโ ...
โโโ go.mod
โโโ .dockerignore
โโโ Dockerfile
โโโ docker-compose.ymlIn this section you will see more of the feature that our Faux-Rhum has to offer.
We implemented OAuth to allow users to log in with their Google or GitHub accounts.
This allows users to easily create an account and log in without having to remember another password.
To use OAuth, you need to set up the environment variables as explained in the "Run the server" section.
If the user has never logged in before, he will be redirected to the OAuth provider (Google or GitHub) to log in.
and then redirected back to the forum with a token that will be used to authenticate the user.
If the user has already logged in, he will be redirected to the forum directly without having to log in again.
When the user want to log in with Github OAuth even if his account has a Google Oauth linked, if the email is the same, the user will be logged in with the same account.
The forum administration is a feature that allows the administrator to manage the forum.
There is 3 type of administrators :
- Founder : The creator of the forum, he has all the rights on the forum.
- Administrator : The administrator, he has most of the rights on the forum.
- Moderator : The moderator, he can only manage posts and comments.
The administration team can access the administration panel by clicking on the "Admin Panel" button in the header.
In the administration panel, the administrator can manage :
- Users (change their roles, see their status, ban them, etc...)
- Posts (see the posts to approve, delete them, etc...)
- Categories (see the categories, add new categories, delete them, etc...)
โFor now you can't delete categories, you can only add themโ
When a post is created, it is not visible to the public until it is approved by an administrator.
The forum has a filter system that allows users to filter posts :
- By category
- By Posts Liked
- By Posts Created
Also, the Home Page has a pagination system that allows users to navigate through the posts.
The forum has a notification system that allows users to receive notifications when :
- One of their posts is liked/disliked
- One of their posts is commented
- One of their comments is liked/disliked
When the user clicks on a notification, it's marked as read
and when you click on the details of it, it will redirect to the post that concern the notification.
Good to know : When a post is deleted, comment deleted etc... The notifications related to this post/comment are also deleted.
The forum has a user activity system that allows users to see their activity on the forum.
By accessing to '/profile' route, the user can see :
- The number of posts created
- The number of comments created
And a list of the last 20 activities of the user, like :
- Posts created
- Comments created
- Posts liked/disliked
- Comments liked/disliked
You can also see the activity of other users by going to their profile page.
To create a post, the user need to be logged in.
When the user create a post he can choose min 1 category and max 3 categories, enter a title and a content.
He can also add an image to the post (max 20Mb), the image will be converted to webp format to reduce the size of the image.
When the post is created, it is not visible to the public until it is approved by an administrator.
The user can edit his post, when editing a post, the user can change the title, content, categories and image of the post.
โ When the post is deleted, all the comments, reactions, user activity and notifications related to this post are also deleted. โ
Users can comment on posts, to do so, the user need to be logged in.
When the user comment on a post, the Author get a notification and the user activity now contain his comment.
A comment author can delete his comment, when the comment is deleted, all the reactions, notifications related to this comment are also deleted.
โA staff can delete any comment, even if he is not the author of the comment. โ
Users can react (like/dislike) to posts and comments, to do so, the user need to be logged in.
When the user react to a post/comment, the author of the post/comment get a notification and the user activity now contain his reaction.
If a not logged user try to react to a post/comment, he will be redirected to the login page.
The forum has a search bar that allows users to search for posts by title or content.
When the user enters a search query, the forum will display the posts that match the query with pagination.
In the future, we will add a search bar that allows users to search for posts by author, category, etc...
The forum has a theme changer that allows users to change the theme of the forum. The user can choose between 7 themes :
- Champagne (default light theme)
- Jรคgermeister (orange dark theme)
- Vodka (blue light theme)
- Mojito (green light theme)
- Wine (red light theme)
- Rhum (brown light-dark theme)
- Beer (yellow light theme)
The theme is saved in the local host, so when the user refresh the page, the theme is still applied.
The forum has a markdown renderer that allows users to write posts markdown format.
When the user writes a post, he can use markdown syntax to format his post.
The markdown renderer will convert the markdown syntax to HTML and display it in the post.
In the post editor, there are some buttons that allow the user to format his post easily :
- Bold
- Italic
- Strikethrough
- Heading +
- Heading -
The forum has a user ranking system that allows users to see their rank on the forum.
The user rank is based on a calculation that take the number of posts created, comments created
The user rank is displayed on the user profile page and on the user activity page.
There is 5 ranks :
- Curieux
- Degustateur
- Connaisseur
- Initiรฉ
- Oenologue
The forum has a profile settings page that allows users to change their profile settings. The user can change :
- Their username
- Their password (with password confirmation)
- Their profile picture
- Their email address (only if they aren't registered by OAuth)
- Their bio
The forum has some SQL triggers that update/delete data in the database when certain actions are performed. Here's an example list of the SQL triggers implemented in the forum :
- When a post attachment is changed, the old attachment is deleted from the database.
- When a user change is profile picture, the old profile picture is deleted from the database.
Here's a list of features that we plan to implement in the future :
- ๐ฉ Verification email : When a user registers, he will receive a verification email to confirm his email address.
- ๐ค Password reset : When a user forgets his password, he can reset it by receiving a password reset email.
- ๐ฃ๏ธ Private Messages : Users can send private messages to each other.
- ๐ก REST API: A REST API that allows third-party applications to interact with the forum.
- ๐ธ๏ธDatabase MCD
- ๐ชขDatabase MLD
- ๐๏ธGithub Repository





