Extremely simple Axum + SolidJS starter for a fullstack web application.

Overview

royce

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

About

The Google Lighthouse score:

Lighthouse

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.

Usage

  1. Install Git and Docker.
  2. Navigate to the directory where you want to clone this repository.
  3. Run in the terminal:
git clone https://github.com/J-Schoepplenberg/royce.git
cd royce
docker-compose up --build
  1. Navigate in your browser to http://localhost:8000.

Development without Docker

  1. Install rustup, NodeJS and PostgreSQL.
  2. Start the PostgreSQL server on your machine.
  3. Clone this repository git clone https://github.com/J-Schoepplenberg/royce.git.
  4. Switch for the session store from RedisStore to MemoryStore::default() in royce\backend\src\main.rs.
    • Alternatively, you can install Redis on your machine and start the Redis server.
  5. Open a new terminal in royce\backend and run cargo run --release.
  6. Open a new terminal in royce\frontend and run npm 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/.

Why SolidJS?

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.

Why Axum?

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.

You might also like...
Axum + Connect-Web = ♥️

Axum Connect-Web ⚠️ This project isn't even Alpha state yet. Don't use it. Brings the protobuf-based Connect-Web RPC framework to Rust via idiomatic A

Simple example of axum, sqlx with sqlite and utoipa (swagger) - without auth

axum_crud_api Simple example to learn creating CRUD rest apis in Rust with axum, sqlx with sqlite and utoipa (swagger) - without auth Also shows how t

This is a simple Api template for Rust ( Axum framework )

Axum-Rust-Rest-Api-Template This project is an open source Rest Api Template built with Rust's Axum framework. Why this project? I have been learning

a port of yaxpeax-dis that runs as a web application

this a rough translation of yaxpeax-dis, the CLI tool, to instead accept architectures and data to disassemble as an HTTP request. the package is then deployed to dis.yaxpeax.net as a compute@edge application.

A web application to configuration Caddy based on MoonZoon.

Cream A web application to configuration Caddy based on MoonZoon. MoonZoon is a Rust Fullstack Framework. Live demo Run on a local machine Check you'v

Build, bundle & ship your Rust WASM application to the web.

Trunk Build, bundle & ship your Rust WASM application to the web. ”Pack your things, we’re going on an adventure!” ~ Ferris Trunk is a WASM web applic

Web Application with using Rust(Actix, Diesel and etc)
Web Application with using Rust(Actix, Diesel and etc)

Santa Service App Used technology stack Web Server with using Rust (Actix, Actix-web, Diesel) Data base (Postgres) Console Application (Tokio) Tasks o

Yew + Axum + blog = Yab

Yew + Axum + blog = Yab

Rust Axum+SQLx Sample

rust-axum-sqlx-sample Install git clone https://github.com/web3ten0/rust-axum-sqlx-1.git cd rust-axum-sqlx-1/local docker-compose up -d sh scripts/exe

Comments
  • missing cargo lock

    missing cargo lock

    Hi, The documentation on how to start the project have a small error, if I try to clone the repository and run docker-compose up --build, I get this:

    ❯ docker-compose up --build
    
    [+] Running 23/23
     ✔ redis Pulled                                                                                                                  6.0s
       ✔ efc2b5ad9eec Already exists                                                                                                 0.0s
       ✔ 82797145fff6 Pull complete                                                                                                  0.8s
       ✔ 405e1ffae71e Pull complete                                                                                                  0.8s
       ✔ 0beb16fe974a Pull complete                                                                                                  1.0s
       ✔ 73eb92ddeed3 Pull complete                                                                                                  3.1s
       ✔ 87e613039f4a Pull complete                                                                                                  3.1s
       ✔ 4f4fb700ef54 Pull complete                                                                                                  3.1s
       ✔ 9579b898bbe4 Pull complete                                                                                                  3.2s
     ✔ db Pulled                                                                                                                    22.6s
       ✔ b33c47d38f22 Pull complete                                                                                                  2.9s
       ✔ 87cb89a22d1e Pull complete                                                                                                  4.2s
       ✔ fd66d978bf1a Pull complete                                                                                                  4.2s
       ✔ d1723030f70f Pull complete                                                                                                  5.1s
       ✔ 4ed8886da429 Pull complete                                                                                                  5.2s
       ✔ 2c0a96a00eeb Pull complete                                                                                                  5.2s
       ✔ 224e967d7685 Pull complete                                                                                                  5.5s
       ✔ 4774bf58af6a Pull complete                                                                                                 19.5s
       ✔ 5f45270309c1 Pull complete                                                                                                 19.6s
       ✔ 60cb0fc6dcac Pull complete                                                                                                 19.6s
       ✔ abcf585d57b0 Pull complete                                                                                                 19.6s
       ✔ 87cb29313a81 Pull complete                                                                                                 19.6s
       ✔ 2e7f0c5387bd Pull complete                                                                                                 19.7s
    [+] Building 2.7s (10/26)                                                                                             docker:orbstack
     => [backend internal] load build definition from Dockerfile                                                                     0.1s
     => => transferring dockerfile: 1.72kB                                                                                           0.0s
     => [backend internal] load metadata for docker.io/library/rust:1.75-slim-bullseye                                               2.4s
     => [backend internal] load metadata for docker.io/library/debian:bullseye-slim                                                  2.4s
     => [backend internal] load .dockerignore                                                                                        0.0s
     => => transferring context: 299B                                                                                                0.0s
     => CANCELED [backend builder  1/14] FROM docker.io/library/rust:1.75-slim-bullseye@sha256:598cba4e570656789d54c7776356af65b526  0.1s
     => => resolve docker.io/library/rust:1.75-slim-bullseye@sha256:598cba4e570656789d54c7776356af65b526261f64be8e0436b735d3d3bb156  0.0s
     => => sha256:598cba4e570656789d54c7776356af65b526261f64be8e0436b735d3d3bb156b 6.00kB / 6.00kB                                   0.0s
     => => sha256:466bd7fb2bc6b8aa9c36654421b6d560b1a5f04e47f51834eebc369bb24e3eec 1.31kB / 1.31kB                                   0.0s
     => => sha256:e1ddd21c4dc11ee6f5423c49851a9e67505df86e0cdb38c381dbf0736585cdaf 2.67kB / 2.67kB                                   0.0s
     => CANCELED [backend stage-1 1/7] FROM docker.io/library/debian:bullseye-slim@sha256:b257e5e831aa9949737638f6d323cd563347b2a55  0.2s
     => => resolve docker.io/library/debian:bullseye-slim@sha256:b257e5e831aa9949737638f6d323cd563347b2a5571d98b9b15eef0c7cd80b68    0.0s
     => => sha256:b257e5e831aa9949737638f6d323cd563347b2a5571d98b9b15eef0c7cd80b68 1.85kB / 1.85kB                                   0.0s
     => => sha256:482aabdceb859cc9ddc2e36867ac1ff6d3477bffcd05cac015bfc442c334aff4 529B / 529B                                       0.0s
     => => sha256:1dcedcb363a3e8070f3a0438cab8174b07fd23da25f04928c5111ccf7d856465 1.46kB / 1.46kB                                   0.0s
     => [backend internal] load build context                                                                                        0.1s
     => => transferring context: 44.37kB                                                                                             0.0s
     => CACHED [backend builder  2/14] RUN apt-get update && apt-get install -y     pkg-config     libssl-dev     curl     && curl   0.0s
     => CACHED [backend builder  3/14] WORKDIR /usr/src/app                                                                          0.0s
     => ERROR [backend builder  4/14] COPY backend/Cargo.toml backend/Cargo.lock ./backend/                                          0.0s
    ------
     > [backend builder  4/14] COPY backend/Cargo.toml backend/Cargo.lock ./backend/:
    ------
    failed to solve: failed to compute cache key: failed to calculate checksum of ref aec1e5ba-82f3-4a53-b646-761684e639eb::ly5ucmdnwz1crv0y2vnvokqbm: "/backend/Cargo.lock": not found``
    

    This is because in backend the file Cargo.lock is missing, so as a workaround you have to run a build of the backend project first, while I think it is more correct that the file is included in the repository

    opened by marcocot 1
Owner
Computer Science, Cybersecurity, Rust
null
Code template for a production Web Application using Axum: The AwesomeApp Blueprint for Professional Web Development.

AwesomeApp rust-web-app More info at: https://awesomeapp.dev/rust-web-app/ rust-web-app YouTube episodes: Episode 01 - Rust Web App - Course to Produc

null 45 Sep 6, 2023
Leptos Axum Prisma starter with Admin dashboard and SSR/SPA website

LAPA - Leptos Axum Prisma starter with Admin dashboard and SSR/SPA website Motivation I want to have practical full-stack setup to build websites and

Alexi Chepura 2 Jul 10, 2023
axum-serde is a library that provides multiple serde-based extractors and responders for the Axum web framework.

axum-serde ?? Overview axum-serde is a library that provides multiple serde-based extractors / responses for the Axum web framework. It also offers a

GengTeng 3 Dec 12, 2023
Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust.

Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust.

Actix 16.2k Jan 2, 2023
Experiments with Rust CRDTs using Tokio web application framework Axum.

crdt-genome Synopsis Experiments with Rust CRDTs using Tokio web application framework Axum. Background Exploring some ideas of Martin Kleppmann, part

dougfort 3 Mar 18, 2022
A highly customizable, full scale web backend for web-rwkv, built on axum with websocket protocol.

web-rwkv-axum A axum web backend for web-rwkv, built on websocket. Supports BNF-constrained grammar, CFG sampling, etc., all streamed over network. St

Li Junyu 12 Sep 25, 2023
Axum + JWT authentication Middleware that allows you to start building your application fast

axum_jwt_ware Integration Guide Simple Axum + JWT authentication middleware with implemented Login and refresh token. Goal I aim to simplify the proce

Eze Sunday 3 Dec 2, 2023
Axum web framework tutorial for beginners.

Axum Tutorial For Beginners Hello web developers! This tutorial will cover how to write simple web applications in rust with axum framework. If you ar

Eray Karatay 46 Jan 5, 2023
Demo of Rust and axum web framework

Demo of Rust and axum web framework Demonstration of: Rust: programming language that focuses on reliability and stability. axum: web framework that f

Joel Parker Henderson 115 Dec 29, 2022
Layers, extractors and template engine wrappers for axum based Web MVC applications

axum-template Layers, extractors and template engine wrappers for axum based Web MVC applications Getting started Cargo.toml [dependencies] axum-templ

Altair Bueno 11 Dec 15, 2022