CONTRIBUTING.md 2.79 KB
Newer Older
Ole Martin Ruud's avatar
Ole Martin Ruud committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
# Contributing

## Project structure

```
pizzabadger
├── assets                          # Some extra files used for reference
│   └── ...
├── Cargo.lock                      # Exact project dependencies
├── Cargo.toml                      # Project metadata and dependencies
├── diesel.toml                     # Configuration for diesel (database ORM)
├── docker                          # Folder with Dockerfiles for CI pipeline
│   └── ...
├── docker-compose.yml              # Service definition for local environment 
├── Dockerfile                      # Dockerfile used in local environment
├── migrations                      # Folder with database migrations
│   └── 1970-01-01-000000_some_name # Specific migration
│       ├── down.sql                # SQL query to remove migration
│       └── up.sql                  # SQL query to setup migration
├── Rocket.toml                     # Configuration file for Rocket (mainly used locally)
├── src                             # Source code of project
│   ├── bin                         # Source code of binary files (actual executables)
│   │   ├── server                  # The sourcecode for the server (MAIN SOURCE REPOSITORY)
│   │   └── ...
│   ├── lib.rs                      # Main entrypoint of database bindings
│   └── model                       # Database models (ORM result)
│       └── ...
└── templates                       # Source code of HTML templates (tera templates)
    └── ...
```

## Some useful places to start

### Editing the webpages (HTML, CSS, JavaScript)

All the HTML templates are located in the `templates` directory. When the server
responds to a request it will render a template using the current context. The
context is different based on the user that sent the request, the pizzas present
etc. The templates are written using [tera](https://tera.netlify.com/docs/).
The website uses [tailwind](https://tailwindcss.com/) as a CSS framework.

### Editing the source code

The server is written using [Rust](https://www.rust-lang.org/). This can be a
complex language to learn, however there is a great [getting
started](https://www.rust-lang.org/learn/get-started) which will teach you all
you need to know about the language.

The project uses [rocket](https://rocket.rs/), which is a web framework, as it's
main component. The main file of the server can be found under
`src/bin/server/main.rs`. Rocket also has a great [getting
started](https://rocket.rs/v0.4/guide/) guide which will get you up to speed
quickly.

----

If anything is unclear, feel free to create an issue, ping @barskern on
Discord or ask during TekKom meetings.

**Happy coding!**