This is the codebase that powers Discuit, which is an open-source community platform, an alternative to Reddit.
Built with:
To setup a development environment of Discuit on your local computer:
-
Install Go (1.21 or higher) by following the instructions at go.dev.
-
Install MariaDB, Redis, Node.js (and NPM). On Ubuntu, for instance, you might have to run the following commands:
sudo apt update # Install and start MariaDB sudo apt install mariadb-server sudo systemctl start mariadb.service # Install and start Redis sudo apt install redis-server sudo systemctl start redis.service # Install Node.js and NPM sudo apt install nodejs npm
-
Create a MariaDB database.
# Open MariaDB CLI mariadb -u root -p --binary-as-hex # Create a database named discuit (you may use a different name) create database discuit; # Enter exit (or press Ctrl+D) to exit exit;
-
Discuit uses
libvips
for fast image transformations. Make sure it's installed on your computer. On Ubuntu you can install it with:sudo apt install libvips-dev
. -
Clone this repository:
git clone https://github.com/discuitnet/discuit.git && cd discuit
-
Create a file named
config.yaml
in the root directory and copy the contents ofconfig.default.yaml
into it. And enter the required config parameters inconfig.yaml
. -
Build the frontend and the backend:
./build.sh
-
Run migrations:
./discuit migrate run
-
Start the server:
./discuit serve
After creating an account, you can run ./discuit admin make username
to make
a user an admin of the site.
Note: Do not install the discuit binary using go install
or move it somewhere else. It uses files in this repository at runtime and so it should only be run from the root of this repository.
-
Build the Docker Image
Note: If you need to run discuit on a different architecture, simply change the Dockerfile in the
-f
flag to the appropriate Dockerfile for your architecture, currently we supportlinux/amd64
(docker/Dockerfile.amd64), andlinux/arm64
(docker/Dockerfile.arm64).docker build -t discuit -f docker/Dockerfile.amd64 .
-
Run the Docker Container
Note: The following command while having a persistent database, the included config.yaml file is not. You will need to mount the file to the container if you want to persist the configuration.
docker run -d --name discuit -v discuit-db:/var/lib/mysql -v discuit-redis:/var/lib/redis -v discuit-images:/app/images -p 8080:80 discuit
-
Accessing Discuit: After the container starts, you can access Discuit by navigating to
http://localhost:8080
on your web browser, or to the specific port if you customized the port mapping. -
Stopping the Container: When you're done, you can stop the container by running:
docker stop discuit
-
Starting the Container Again: To start the container again, use:
docker start discuit
In the root directory are these directories:
cli
: Contains the command-line interface.core
: Contains all the core functionality of the backend.internal
: Contains Go packages internal to the project.migrations
: Contains the SQL migration files.server
: Contains the REST API backend.ui
- Contains the React frontend.
- Dark mode.
- User created communities.
- UI preferences:
- Compact mode.
- Enable or disable infinite scroll.
- Choose which notifications to get.
- Change default feed sort.
- Filtering:
- Mute communities.
- Mute users.
- Filter posts by topic.
- An explore page (modeled after Youtube's home page).
- Filter link-posts by URL or domain.
- Moderation:
- Pinned posts and comments.
- Lock individual comments (so they cannot be replied to).
- A single page for handling reports for users who moderate multiple communities.
- Temporary bans.
- User and community mentions (@user and +community).
- Image posts.
- Poll posts.
- Video embeds (Youtube, Vimeo, etc).
- Image galleries.
- Server side rendering (for better SEO).
- Direct messages.
- Saved posts and comments (modeled after Youtube playlists).
- Multiple feeds (modeled after Twitter Lists).
- Search.
- Moderation log.
- RSS feeds.
- Wiki pages for communities.
- User profile pictures.
- User badges (displayed on profile page).
- Post drafts.
- History (viewed posts).
- Something like Reddit's flairs to group posts within a community.
Discuit is free and open-source software, and you're welcome to contribute to its development.
If you're thinking of working on something substantial, however, (like a major feature) please create an issue, or contact the maintainer, to discuss it before commencing work.
The documentation of the API can be found at docs.discuit.net.
Copyright (C) 2024 Previnder
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.