mirror of
https://github.com/evroon/bracket.git
synced 2026-03-04 07:11:00 -05:00
Improve docs (#76)
This commit is contained in:
52
README.md
52
README.md
@@ -4,40 +4,52 @@
|
||||
[](https://github.com/evroon/bracket/actions/workflows/frontend.yml)
|
||||
|
||||
Ladder tournament system meant to be easy to use.
|
||||
Bracket written in async Python (with FastAPI) and Next.js as frontend using the [Mantine](https://mantine.dev/) library.
|
||||
|
||||

|
||||
|
||||
# Setup
|
||||
### Frontend
|
||||
```
|
||||
yarn
|
||||
npm run dev
|
||||
```
|
||||
|
||||
### Backend
|
||||
```
|
||||
./run.sh
|
||||
```
|
||||
|
||||
|
||||
#### Database
|
||||
Create a new `bracket` database in a `bracket` cluster:
|
||||
|
||||
## Database
|
||||
First create a `bracket` cluster:
|
||||
```shell
|
||||
sudo pg_createcluster -u postgres -p 5532 13 bracket
|
||||
pg_ctlcluster 13 bracket start
|
||||
|
||||
```
|
||||
|
||||
Subsequently, create a new `bracket_dev` database (and `bracket_ci` for tests):
|
||||
```shell
|
||||
sudo -Hu postgres psql -p 5532
|
||||
CREATE USER bracket_ci WITH PASSWORD 'bracket_ci';
|
||||
CREATE DATABASE bracket_ci OWNER bracket_ci;
|
||||
```
|
||||
|
||||
```shell
|
||||
sudo -Hu postgres psql -p 5532
|
||||
CREATE USER bracket_dev WITH PASSWORD 'bracket_dev';
|
||||
CREATE DATABASE bracket_dev OWNER bracket_dev;
|
||||
You can do the same but replace the user and database name with:
|
||||
- `bracket_ci`: for running tests
|
||||
- `bracket_prod`: for a production database
|
||||
|
||||
The database URL can be specified per environment in the `.env` files (see [config](#config)).
|
||||
|
||||
## Config
|
||||
Copy [ci.env](backend/ci.env) to `prod.env` and fill in the values:
|
||||
- `PG_DSN`: The URL of the PostgreSQL database
|
||||
- `JWT_SECRET`: Create a random secret using `openssl rand -hex 32`
|
||||
- `CORS_ORIGINS` and `CORS_ORIGIN_REGEX`: Specify allowed frontend domain names for CORS (see the [FastAPI docs](https://fastapi.tiangolo.com/tutorial/cors/))
|
||||
- `ADMIN_EMAIL` and `ADMIN_PASSWORD`: The credentials of the admin user, which is created when initializing the database
|
||||
|
||||
|
||||
## Running the frontend and backend
|
||||
The following starts the frontend and backend for local development:
|
||||
### Frontend
|
||||
```
|
||||
cd frontend
|
||||
yarn
|
||||
npm run dev
|
||||
```
|
||||
|
||||
### Config
|
||||
Put JWT_SECRET in prod.env using `openssl rand -hex 32`
|
||||
### Backend
|
||||
```
|
||||
cd backend
|
||||
./run.sh
|
||||
```
|
||||
|
||||
BIN
misc/img/preview.png
Normal file
BIN
misc/img/preview.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 155 KiB |
Reference in New Issue
Block a user