2022-03-31 09:22:39 -04:00
# Contributing
## Directory structure
```
frontend/
public/ ; Static files
src/ ; React/Typescript sourcecode
backend/
compilers/ ; Compiler binaries and configuration
coreapp/ ; API Django app
migrations/ ; Database migrations (generated by Django)
decompme/ ; Main Django app
2023-09-30 07:54:40 +02:00
libraries/ ; Library headers
2022-03-31 09:22:39 -04:00
.env ; Default configuration
.env.local ; Local configuration overrides (not checked-in)
```
## Setup
2025-12-09 09:34:39 +00:00
We use [Docker ](https://docker.com ) for both development and production environments — it’ s the simplest way to get everything up and running. See [DOCKER.md ](DOCKER.md ) for detailed setup instructions.
We officially support running decomp.me on Linux (we use Ubuntu 24.04 LTS) on the `amd64` architecture. Running decomp.me natively on Windows or macOS is not supported and may result in unpredictable behavior or missing functionality. The instructions below assume you are using a Linux system on `x86_64` hardware.
### Prerequisites
2022-03-31 09:22:39 -04:00
Dependencies:
2025-12-09 09:34:39 +00:00
- Python >=3.10 (Production uses 3.12)
- Node.js >=14 <=24 (Production uses 24)
2022-03-31 09:22:39 -04:00
- [Yarn ](https://yarnpkg.com/getting-started/install )
2025-09-22 19:23:55 +09:00
- [uv ](https://docs.astral.sh/uv/getting-started/installation/ )
2022-03-31 09:22:39 -04:00
---
Create a file to hold environment variables:
``` shell
touch .env.local
```
### Backend
``` shell
cd backend
```
2025-09-22 19:23:55 +09:00
* Install Python dependencies with [uv ](https://docs.astral.sh/uv/getting-started/installation/ )
2022-03-31 09:22:39 -04:00
``` shell
2025-09-22 19:23:55 +09:00
uv sync
2022-03-31 09:22:39 -04:00
```
- Install compilers
``` shell
2025-09-22 19:23:55 +09:00
uv run python compilers/download.py
2022-03-31 09:22:39 -04:00
```
2023-09-30 07:54:40 +02:00
- Install libraries
``` shell
2025-09-22 19:23:55 +09:00
uv run python libraries/download.py
2023-09-30 07:54:40 +02:00
```
2022-03-31 09:22:39 -04:00
- Set up the database
``` shell
2025-09-22 19:23:55 +09:00
uv run python manage.py migrate
2022-03-31 09:22:39 -04:00
```
- Start the API server
``` shell
2025-09-22 19:23:55 +09:00
uv run python manage.py runserver
2022-03-31 09:22:39 -04:00
```
---
### Frontend
``` shell
cd frontend
```
- Install dependencies
``` shell
yarn
```
- Start the development webserver
``` shell
yarn dev
```
- Access the site via [http://localhost:8080 ](http://localhost:8080 )
### Optional steps
2022-09-14 20:53:50 +09:00
- [Configure vscode for development ](VSCODE.md )
2022-07-29 11:41:20 -04:00
- [Configure wine for Windows compiler on Linux ](WINE.md )
2022-03-31 09:22:39 -04:00
- [Set up GitHub authentication ](GITHUB.md )
- [Install nsjail to run the compiler sandbox ](SANDBOX.md )
- [Configure an nginx reverse proxy ](NGINX.md )
2022-08-09 06:46:19 +09:00
- Download [wibo ](https://github.com/decompals/WiBo/releases/latest ) and add it to your system path (for running Windows compilers from Linux)
2022-03-31 09:22:39 -04:00
## Notes
### Updating the database
If you modify any database models (`models.py` ), you'll need to run the following to update the database:
``` shell
2025-09-22 19:23:55 +09:00
uv run python manage.py makemigrations
uv run python manage.py migrate
2022-03-31 09:22:39 -04:00
```
2024-05-20 12:29:58 +02:00
### Running tests
To ensure everything is working properly, you can run the unit tests in the backend folder.
``` shell
2025-09-22 19:23:55 +09:00
uv run python manage.py test
2024-05-20 12:29:58 +02:00
```
2024-03-26 07:57:16 +01:00
### Frontend styling
2023-01-03 12:41:05 +00:00
We use Tailwind CSS with Radix UI colors. Each color is on a scale from 1 to 12 (inclusive), each with [a well-defined meaning ](https://www.radix-ui.com/docs/colors/palette-composition/understanding-the-scale ).
2022-03-31 09:22:39 -04:00
## Linting
- Check frontend
``` shell
cd frontend
yarn lint
```
- Autofix frontend
``` shell
cd frontend
yarn lint --fix
```
- Check backend
``` shell
cd backend
2025-09-22 19:23:55 +09:00
uv run mypy
uv run ruff check .
uv run ruff format .
2022-03-31 09:22:39 -04:00
```