# Prymn

[![status-badge](https://ci.nikos.gg/api/badges/nikos/prymn/status.svg)](https://ci.nikos.gg/nikos/prymn)

## Project dependencies

- Elixir 1.15
- Erlang 24 or later
- Rust (recent version)
- protoc for protobufs version 3

## Setup

Some basic steps to setup the project and its dependencies.

- Install [asdf](https://github.com/asdf-vm/asdf) (curl is also required)
    - Using git: `git clone https://github.com/asdf-vm/asdf.git ~/.asdf`
    - or, using paru, `paru -S asdf-vm`
    - Add asdf to path: `source /opt/asdf-vm/asdf.{bash,zsh,fish}`, or `~/.asdf/asdf.{bash,zsh,fish}`
- Install erlang
    - `asdf plugin add erlang`
    - `asdf install erlang 25`
- Install elixir
    - `asdf plugin add elixir`
    - `asdf install elixir 1.15`
- Install rust
    - Optionally, set `CARGO_HOME` and `RUSTUP_HOME` to a XDG directory (e.g `~/.local/share/cargo` and `~/.local/share/rustup`)
    - Arch: `pacman -S rustup` 
    - Other: `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`
    - Make sure to add `$HOME/.cargo/bin` (or `$CARGO_HOME`) to `PATH`
    - `rustup toolchain install stable`
    - `rustup default stable`
    - `rustup component add clippy`
    - `rustup component add rust-analyzer`
    - `rustup component add rustfmt`
- Install [protoc](https://grpc.io/docs/protoc-installation/) version 3
    - Arch: `pacman -S protobuf`
    - Debian: `apt install -y protobuf-compiler`
- (Optional) Install [inotify-tools](https://github.com/inotify-tools/inotify-tools/wiki)
    - Arch: `pacman -S inotify-tools`
    - Debian: `apt install -y inotify-tools`
- Setup elixir
    - Install hex: `mix local.hex`
    - `cd backend && mix escript.install hex protobuf`
    - `asdf reshim`

## Preparing for development

### Backend

- `cd backend`
- Start the database: `docker-compose up -d`
- `mix setup`
- `mix phx.server`