Developing
First of all, thanks for considering contributing on Pinepods! Pinepods is a rust project frontend that uses the Yew framework to build a wasm application. On the backend we use fastapi to call data needed from the database of the users choice.
This article outlines how to get Pinepods running in a development environment, and outlines the basics of the architecture.
Setting up the Dev Environment
Prerequisites
You will need either the latest version of Rust. You'll also need the latest version of Trunk to build and serve the application. Finally Git to easily fetch the code, and push any changes. If you plan on running or deploying the container, you'll also need Docker.
With all this installed you also need the compilation target for wasm
rustup target add wasm32-unknown-unknown
Running the Project
- Get Code:
git clone https://github.com/madeofpendletonwool/PinePods.git
- Navigate into the directory:
cd web
- Start dev server:
RUSTFLAGS="--cfg=web_sys_unstable_apis" trunk serve --features server_build --release
Pinepods should now be being served on Localhost Port 8080. Hot reload is enabled, so making changes to any of the files and saving will trigger them to be rebuilt and the page refreshed.
Now, what you've just done is run the web frontend of the project. The backend is not running currently, meaning, unless you connect to an external Pinepods server you will not be able to sign in. To sign in you need the backend running. To run the backend you can either just pull the Pinepods docker image form docker hub or you can build it yourself. You can build it with this command after navigating to the base repo directory:
cd Pinepods/
sudo docker build -t madeofpendletonwool/pinepods:latest .
Then once built you can run the container with Docker Compose. Once you have the backend running you can connect to the server and sign in with your development frontend. Go to the development server url: http://localhost:8080 by default. Click the connect to different server button:
And then enter the server url in the server name: http://localhost:8040 by default with the compose file linked above. You're now signed into a dev Pinepods server using a local backend!
Notes
- You'll notice above we're using the server_build feature. This is because when compiling without that feature it builds the project for the client version which builds on Tauri.
Git Strategy
Git Flow
Like most Git repos, we are following the Github Flow standard.
- Create a fork
- Make any changes you want 🧑💻
- Add, commit and push your changes to your branch/ fork
- Head over to GitHub and create a Pull Request
- Hit submit
- Follow up with any reviews on your code
- Merge 🎉
Please limit PRs to one feature/bug fix per PR. This will make it less complicated to merge your code if there's a problem with one thing but not the other.
Git Branch Naming
The format of your branch name should be something similar to: [TYPE]/[PR] [TITLE]
For example, FEATURE/Awesome feature
or FIX/login server error
PR Guidelines
Once you've made your changes, and pushed them to your fork or branch, you're ready to open a pull request!
For a pull request to be merged, it must:
- Must be backwards compatible
- The build and tests (run by GH actions) must pass
- There must not be any merge conflicts
When you submit your PR, include some required info. Including:
- A brief description of your changes
- The issue or discussion number (if applicable)
- For UI related updates include a screenshot
- If any dependencies were added, explain why it was needed, state the cost associated, and confirm it does not introduce any security issues
- Finally hit submit!
Resources for Beginners
New to Rust Web Development or Python Backend? Glad you're here! The following articles should point you in the right direction for getting up to speed with the technologies used in this project:
- Open Source for Beginners
- Tutorial for Yew
- FastAPI Walkthrough
- Complete beginners guide to Docker
- Docker Classroom - Interactive Tutorials
- Git cheat sheet
As well as Rust, Yew, Git and Docker- you'll also need an IDE (e.g. VS Code or Vim) and a terminal (Windows users may find WSL more convenient).