Extremely simple Axum
+ SolidJS
starter for a fullstack web application.
Deploy immediately with a ready-to-use preconfigured Docker
deployment.
Fully fledged for high-performance:
- Frontend: fine-grained reactivity framework
SolidStart
- Backend: multi-threaded asynchronous Rust backend
Axum
- Sessions: in-memory database
Redis
- Database: object-relational database
PostgreSQL
- Deployment: container virtualization
Docker
Contains everything you need:
- Authentication
- Sessions
- CORS
- Middleware
- Rate limiting
- Response compression
- Request size limiting
- Signed and encrypted cookies
The Google Lighthouse score:
Styling is done with Tailwind CSS, but you can easily switch to whatever solution you prefer.
The frontend, backend, database and session store are all run as a multi-container Docker Compose application.
- Install Git and Docker.
- Navigate to the directory where you want to clone this repository.
- Run in the terminal:
git clone https://github.com/J-Schoepplenberg/royce.git
cd royce
docker-compose up --build
- Navigate in your browser to
http://localhost:8000
.
- Install rustup, NodeJS and PostgreSQL.
- Start the PostgreSQL server on your machine.
- Clone this repository
git clone https://github.com/J-Schoepplenberg/royce.git
. - Switch for the session store from
RedisStore
toMemoryStore::default()
inroyce\backend\src\main.rs
.- Alternatively, you can install Redis on your machine and start the Redis server.
- Open a new terminal in
royce\backend
and runcargo run --release
. - Open a new terminal in
royce\frontend
and runnpm run dev
.
The frontend will now run separately from the backend with HMR enabled at http://localhost:3000/
.
The backend will be served at http://localhost:8000/api/
.
This next-generation web framework looks and feels pretty much identical to React, but there is one big difference. Unlike React, it does not uselessly re-render components in cascade on every change, but is based on signals.
To simplify, signals store and update values to represent state. But most importantly, they are reactive. Which means, they are smart enough to automatically propagate their latest value when they have changed to all places that depend on them.
In SolidJS things like components are functions that run once and never re-render again. Only signals are recomputed and updated. This is why SolidJS beats React by a mile in performance benchmarks.
You already know all the advantages of Rust: zero-cost abstractions, guaranteed memory safety, run-time speed and memory usage identical to C/C++, supreme ecosystem with Cargo, powerful type system.
Axum makes it extremely easy to write REST APIs and is backed by the Tokio team itself, which provides the de-facto standard runtime for async in Rust. Also, it is based on hyper
, which is one of the fastest HTTP implementations that exist. It is fully interopabale with the tower
ecosystem to easily plug-in any middleware you want. By adding extractors to routes (= arguments in the handler functions) you can super easily extract things (e.g. headers) from requests without any effort.