Skip to content

A fullstack web application written in Rust and JavaScript

Notifications You must be signed in to change notification settings

matthewboman/prrr_demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PrrrStack Demo

PRRR stack (Postgres, Rust, Rocket, React) is a functionalish1 approach for writing modern web applications.

Why PrrrStack?

  1. Marketing. Stacks are a good introduction to concepts, but more importantly, they're a marketing technique that allows one to gloss over the decision-making process on a technology-by-technology basis in favor of a one-size-fits-all solution.
  2. Cats. Though Diesel does a lot of the heavy lifting as an ORM, it doesn't get to be part of the acronym because we lose the pun, but feel free to start marketing the PRRR-D (pronounced purdy) Stack. Web development definitely needs more bandwagons.
  3. Rust is a fast and reliable systems language, and Rocket makes writing a server extremely approachable for someone with no low-level experience.
  4. Two-way data binding is awful and adds unnecessary complexity with no benefit, so Angular and Vue were out of the picture. Also, see reason 2.

Getting Started

If you'd like a step-by-step guide, check out the introductory articles for the backend and frontend.

Rocket requires the nightly version of Rust to run, so make sure you have it installed. You'll also want to ensure you're using it in this project's directory.

curl -s https://static.rust-lang.org/rustup.sh | sh -s -- --channel=nightly
cd prrr_demo
rustup override add nightly
cargo run

You'll need Node and NPM/Yarn and a global installation of Webpack.

npm i -G webpack
cd frontend
npm i
npm run dev

Details

The server runs at localhost:8000 and the SPA runs at localhost:3000.

Endpoints

  • GET /api/cats - returns all the cats
  • POST /api/cats - creates a new cat in the database
  • PUT /api/cats/:id - updates the cat with the given :id
  • DELETE /api/cats/:id - deletes the cat with the given :id (RIP little buddy)

1: Though neither are strictly functional, Rust has written into the language a bias against mutation, and React's unidirectional flow and stateless functional components bias a more functional programming style.

About

A fullstack web application written in Rust and JavaScript

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published