Skip to content

justinhschaaf/PigWebApp

Repository files navigation

Pig Web App

This is getting out of hand.

The Pig Web App is a web GUI to manage a list of pig names. Keeping them in a yml file on a server that is never online is no longer feasible, and even if it were, the plugin is not built to manage such a large list efficiently.

I'm mainly going this far to write the entire app from the ground up to make sure search queries are handled server-side, as Pocketbase doesn't support serverside functions.

This is also my entryway into Rust, and as such have documented much of what everything does and what I've learned throughout the process. If there's some horrible mistake I've made, any tips I could use, or any questions you have, please feel free to let me know.

For more screenshots, see the folder.

Roadmap

Milestone 1 - Complete 2025-04-11

  • Client and Server modules written in Rust. - Complete 2024-12-29 - Shared code and data structures should be in a Common module.
  • CRUD pig names. - Complete 2025-02-15
  • RBAC to allow different levels of access. - Complete 2025-04-11 - You should also be able to configure groups for assigning these roles to users.
  • OIDC authentication, the app should not manage authentication. - Complete 2025-03-30 - It should, however, be able to read user groups from OIDC user info and manage users' groups through it.
  • Fully declarative configuration. - Complete 2025-01-31 - Ideally, this is possible through NixOS modules that you can also use to deploy it. The config file itself can be TOML as I don't care about reading it, just processing. It should also be able to take config from environment variables (takes precedent over config) and possibly CLI options (takes precedent over env).

Milestone 2

  • Audit log showing a history of changes. Should show timestamp, pig name/id, who made the change, and what the change was.
  • MiniMessage formatting previews. This will likely require a custom interpreter, unfortunately.
  • Mass Add wizard to import en masse. - Complete 2025-05-03 - This should hold your hand through the entire import process, cleaning up formatting, automatic duplicates, manual duplication checks, etc. There should be a way to save your progress.
  • OAuth2 authentication for API endpoints. This should be used to integrate with the plugin itself.

Workspace

Additional guides are available in the /docs folder.

Setup

To simplify workspace setup and installing dependencies, most of it is managed for you with Nix and direnv.

  1. If you're not using NixOS, install the Nix package manager for your system using the Determinate Nix Installer.

  2. Install direnv for your system.

  3. Add direnv integration to your IDE. For RustRover, I recommend Direnv Integration. It doesn't work perfectly, but it still works. Be sure to follow the setup instructions for it.

  4. cd into the project dir and run direnv allow. If you need to manually enter the dev shell, use nix develop.

Important

Assume ALL commands hereafter are in the Nix shell unless otherwise stated.

Developing

Run cargo make serve to open a development server on localhost:8000, allowing you to preview changes in (almost) real time.

Since the web server blocks the thread and as such cargo-make can't stop the server when it's time to build new changes, the server itself is run in a tmux session. To view it's output, run tmux attach-session -t pigweb in a separate shell to attach to the session.

When you're done, stop the server with cargo make stop.

Building

Builds are configured using cargo-make to avoid ugly wrapper scripts.

For a production build, run cargo make -p production. You can build the client and server separately with Nix using nix build ./#pigweb_[client/server].

Resources