discuit is a free, open source social networking project written in TypeScript and released under AGPL-3.0. It has 551 GitHub stars, 77 forks and 69 open issues, and was last pushed 2 months ago. On this registry it ranks #41 of 44 tracked projects in Social Networking, with 5 head-to-head comparisons available.

What is discuit?

Discuit is a free and open-source community discussion platform, built on a Go backend and a React frontend, that anyone can self-host as an alternative to Reddit.

What it is

Discuit is the codebase that powers the site at discuit.org, and it is distributed under the AGPL-3.0 licence. The backend is written in Go, the frontend is written in React, MariaDB serves as the main datastore, and Redis holds transient data. Image work is handled through libvips for fast transformations, and the frontend ships as a progressive web app. The repository is maintained at github.com/discuitnet/discuit, where it has 551 stars, 77 forks, and 69 open issues. The project sits in the community and social networking space, tagged with topics such as community, go, pwa, react, reddit, and social-network.

The concrete problem it solves is ownership of a discussion community. Reddit is a hosted, proprietary service, so a community that lives there depends on decisions made by its operator, including moderation policy, API access, and advertising. Discuit replaces that arrangement with software a person or group can run on their own hardware, with their own database, their own storage, and their own rules. Moderators gain admin controls through a command-line interface, and user data stays inside the MariaDB instance the operator controls.

Key capabilities

  • Community discussion features modelled on Reddit, delivered as an installable progressive web app tagged with pwa and react.
  • Go backend paired with a React frontend, with the CLI living in the cli directory of the repository.
  • MariaDB as the main datastore and Redis for transient data, both managed by the operator.
  • Image transformations through libvips, with images persisted to a mounted discuit-images volume in the Docker setup.
  • Database migrations executed with ./discuit migrate run, and the server started with ./discuit serve.
  • Admin promotion through ./discuit admin make username, run after an account has been created.
  • Multi-architecture container builds via docker/Dockerfile.amd64 for linux/amd64 and docker/Dockerfile.arm64 for linux/arm64.

Who uses it and how

  • Self-hosters running a single container with named volumes discuit-db, discuit-redis, and discuit-images, exposing port 8080 and mounting a config.yaml for configuration persistence.
  • Nix and NixOS users who run nix develop to get a reproducible environment where MariaDB and Redis start automatically, write logs to .mysql/ and .redis/, and stop on shell exit.
  • Administrators of an existing instance who promote users to admin and manage the site from the command line.
  • Developers contributing to the project, working locally with Go 1.21 or higher, MariaDB 11.3 or higher, Redis, Node.js and NPM, and a config.yaml copied from config.default.yaml.
  • Communities looking for a self-managed home after leaving a hosted platform such as Reddit.

Getting started

The README documents three supported paths: build and run locally with ./build.sh, ./discuit migrate run, and ./discuit serve; build the image with docker build -t discuit -f docker/Dockerfile.amd64 . and run the container; or use nix develop for a reproducible development environment. A hosted instance also runs at discuit.org.

How it compares

The README names Reddit directly as the alternative Discuit replaces. Unlike Reddit, Discuit is open source under AGPL-3.0 and can be self-hosted, which means the operator owns the database, the images, and the moderation decisions rather than renting access to a proprietary platform. The trade-off is that the operator bears the infrastructure cost and labour instead of relying on a free hosted service.

When to use it — and when not to

A self-hoster must operate MariaDB, Redis, libvips, and a Node.js build toolchain, and must hand-write a config.yaml from config.default.yaml, since the configuration file is not persisted by the container automatically. The binary must be run from the repository root and should not be installed with go install or moved elsewhere, which constrains deployment layout. Anyone wanting a managed, no-maintenance community service should not choose Discuit, and teams should note the 69 open issues and the development-oriented README before committing to production.

project readme (upstream, from github) — read inline

Discuit

This is the codebase that powers Discuit, which is an open-source community platform, an alternative to Reddit.

Built with:

  • Go: The backend.
  • React: The frontend.
  • MariaDB: The main datastore.
  • Redis: For transient data.

Getting started

Running locally

To setup a development environment of Discuit on your local computer:

  1. Install Go (1.21 or higher) by following the instructions at go.dev.

  2. Install MariaDB (11.3 or higher), 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
    
  3. 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;
    
  4. 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.

  5. Clone this repository:

    git clone https://github.com/discuitnet/discuit.git && cd discuit
    
  6. Create a file named config.yaml in the root directory and copy the contents of config.default.yaml into it. And enter the required config parameters in config.yaml.

  7. Build the frontend and the backend:

    ./build.sh
    
  8. Run migrations:

    ./discuit migrate run
    
  9. 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.

Running with Docker

  1. 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 support linux/amd64 (docker/Dockerfile.amd64), and linux/arm64 (docker/Dockerfile.arm64).

    docker build -t discuit -f docker/Dockerfile.amd64 .
    
  2. 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.

Note: Discuit runs on port 8080 inside the container, so the 8080 outside the container doesn't matter, so long as it maps to 8080 on the inside.

docker run -d --name discuit -v discuit-db:/var/lib/mysql -v discuit-redis:/var/lib/redis -v discuit-images:/app/images -p 8080:8080 discuit
  1. 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.

  2. Stopping the Container: When you're done, you can stop the container by running:

    docker stop discuit
    
  3. Starting the Container Again: To start the container again, use:

    docker start discuit
    

Running with Nix Flakes

If you use Nix or NixOS, you can get a fully reproducible dev environment with all dependencies using the included flake:

nix develop

This will:

  • Install all required packages.
  • Start local MariaDB and Redis servers (with logs in .mysql/ and .redis/ respectively).
  • Create the discuit database and user automatically.

When you exit the shell, MariaDB and Redis will automatically stop.

[!IMPORTANT] You'll need Nix flakes enabled and a recent version of Nix to use this.

Source code layout

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.

Roadmap

  • 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.

Contributing

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.org.

License

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 .

Frequently asked questions

Is discuit free to use?

discuit is open source under the AGPL-3.0 licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does discuit do?

A free and open-source community discussion platform.

What is discuit written in?

discuit is primarily written in TypeScript. Its source is publicly available at https://github.com/discuitnet/discuit, and it has 551 GitHub stars.