84 lines
2.5 KiB
Markdown
84 lines
2.5 KiB
Markdown
# FrostByte Forum
|
||
|
||
A simple forum written in Rust and Typescript.
|
||
|
||
---
|
||
|
||
## Structure
|
||
|
||
- `server`: Contains the web server code
|
||
- `client-solid`: Contains the frontend client written in SolidJS
|
||
|
||
## Setup
|
||
|
||
- Install [Rust](https://www.rust-lang.org/) and [Node.js](https://nodejs.org/)
|
||
- Install [Just](https://just.systems/man/en/) and [Podman](https://podman.io/) (optional but recommended)
|
||
|
||
> [!NOTE]
|
||
> Some info
|
||
|
||
> [!IMPORTANT]
|
||
> Some important info
|
||
|
||
> [!WARNING]
|
||
> Some very important info
|
||
|
||
## Running the project
|
||
|
||
There are two ways to run this project. The simple way and the manual way.
|
||
|
||
### 1. The simple way (with aforementioned [Just](https://just.systems/man/en/) and [Podman](https://podman.io/))
|
||
|
||
To spin up a dev backend server, run:
|
||
|
||
``` bash
|
||
just dev
|
||
```
|
||
|
||
For a complete list of targets, run:
|
||
|
||
``` bash
|
||
just -l
|
||
```
|
||
|
||
Spin up a dev server with `just dev` or just `just`.
|
||
Keep in mind that this is just the development api server, served on port 8080 by default.
|
||
|
||
The client is served from the vite dev server as usual at `localhost:3000` by running `npm run dev`.
|
||
|
||
**Congrats, you're now ready to hack!**
|
||
|
||
For a project cleanup, you can run `just clean`. This will delete nore_modules and target directories etcetera. It will also stop and remove related images/containers.
|
||
|
||
For a more complete cleanup, you can run `just nuke`. This deletes everything related to this project AND **all containers and images on your system**. Use with caution.
|
||
|
||
### 2. The manual way
|
||
|
||
The client is a React application built with vite. `npm run dev` will start a dev server without a backend. ´npm run build´ will build the full application and drop it in the `client/dist` directory. This directory will then be served by the web server.
|
||
|
||
---
|
||
The server is a Rust application built with actix-web. `cargo run` will start a dev server with an in-memory database. `cargo build --release` will place a binary in `server/target/release` that can be run on a server. Note that the server binary will try to serve the client from `server/public` by default. This will be changable in the future.
|
||
|
||
```bash
|
||
# Local backend server
|
||
cd server
|
||
cargo run
|
||
|
||
# Dev client (vite)
|
||
cd client
|
||
npm run dev
|
||
```
|
||
|
||
### Production build
|
||
|
||
Essentially, you need to build the client and copy the files to the server's public directory. Then you need to build the server in release mode and run it.
|
||
|
||
This is all bundled in the Containerfile. You can build the container with:
|
||
|
||
```bash
|
||
just start-release
|
||
```
|
||
|
||
## Contributing
|
||
|
||
Contributions are welcome! Please read the [contributing guidelines](CONTRIBUTING.md) first.
|