Leptos Axum Prisma starter with Admin dashboard and SSR/SPA website

Overview
LAPA Logo

LAPA - Leptos Axum Prisma starter with Admin dashboard and SSR/SPA website

LAPA Admin screenshot 2023-07-10

Motivation

I want to have practical full-stack setup to build websites and services.
Utilising type safety and performance of Rust opens the door for new era of web dev, that is taking off.
Ecosystem and standardized approach is helpful to develop scalable and future-proof apps.
Some benefits:

  • strict types
  • enforced error and value management (Result and Option)
  • predictable performance (no garbage collector)
  • native performance
  • single bundler (cargo)
  • straight path to WebAssembly

3 pillars

Leptos

https://leptos.dev
https://github.com/leptos-rs/leptos
A cutting-edge, high-performance frontend framework SSR+SPA. Using reactive signals.

Axum

https://github.com/tokio-rs/axum
Backend framework built with Tokio, Tower, and Hyper. Focuses on ergonomics and modularity.

Prisma

https://www.prisma.io
https://prisma.brendonovich.dev
https://github.com/Brendonovich/prisma-client-rust
Type-safe database access.

Includes

Run

Requires prisma client to be generated

cargo prisma db push # generate client and push schema to db
# or
cargo prisma generate # only generate client

Dev

cargo leptos watch -p lapa_admin
cargo leptos watch -p lapa_site

Prod

See relevant tutorial and demo project. https://github.com/alexichepura/leptos_axum_prisma_sozu https://www.youtube.com/watch?v=KLg8Hcd3K_U

cargo leptos build --release

Notes on CSS nesting and custom media

For now requires fork of cargo-leptos with relevant flags for lightningcss https://github.com/leptos-rs/cargo-leptos/commit/da6c7aeec7b062335e6592ca379c175fb82d3c16

cargo install --git https://github.com/alexichepura/cargo-leptos --branch lightningcss-parsing-flags --locked cargo-leptos

CSS nesting

https://caniuse.com/css-nesting

nav {
    /* nav styles */
	&>a {
        /* nav>a styles */
    }
}

Custom media

@custom-media --md-n-above (width >=768px);
@media (--md-n-above) {}

Container query

https://caniuse.com/css-container-queries

main form {
    container-type: inline-size;
}
@container (width >=480px) {
    form footer {
		grid-template-columns: auto auto;
	}
}

Container query + custom media

NOTE Container query doesn't work with custom media yet

@container (--sm-n-above) {} /* doesn't work */
@container (width >=480px) {} /* works */

Notes on prisma

How initial migration created https://www.prisma.io/docs/guides/migrate/developing-with-prisma-migrate/add-prisma-migrate-to-a-project

mkdir -p prisma/migrations/0_init
cargo prisma migrate diff --from-empty --to-schema-datamodel prisma/schema.prisma --script > prisma/migrations/0_init/migration.sql
cargo prisma migrate resolve --applied 0_init

License

This project is licensed under the terms of the MIT license.

You might also like...
🥠 Sessions as a `tower` and `axum` middleware.

tower-sessions 🥠 Sessions as a `tower` and `axum` middleware. 🎨 Overview This crate provides sessions, key-value pairs associated with a site visito

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

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

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

🪪 Session-based user authentication for Axum.

axum-login 🪪 Session-based user authentication for Axum. 🎨 Overview axum-login is a Tower middleware providing session-based user authentication for

🔎 Prometheus metrics middleware for Axum

Axum-Prometheus A Prometheus middleware to collect HTTP metrics for Axum applications. axum-prometheus relies on metrics_exporter_prometheus as a back

Provides json/csv/protobuf streaming support for axum

axum streams for Rust Library provides HTTP response streaming support for axum web framework: JSON array stream format JSON lines stream format CSV s

A crate built on top of `axum-sessions`, implementing the CSRF Synchronizer Token Pattern

Axum Synchronizer Token Pattern CSRF prevention This crate provides a Cross-Site Request Forgery protection layer and middleware for use with the axum

Comments
  • Images management continue

    Images management continue

    Main functionality for images is done. Settings , uploading, converts, reconverts. This is tracking issue for the rest:

    • [x] delete
    • [x] edit alts
    • [x] resize in threads
    opened by alexichepura 0
Owner
Alexi Chepura
rs, looking for team to join
Alexi Chepura
Heavy Metal Leptos Stack with Tailwind, Axum, Sqlite, and Cargo Leptos

Heavy Metal Stack Leptos stack with Axum, TailwindCSS, and Sqlite This example creates a basic todo app with an Axum backend that uses Leptos' server

Ben Wishovich 7 Dec 31, 2022
Rust/Axum server implementation with PCR(Prisma Client Rust)

Realworld Rust Axum Prisma This project utilizes Rust with the Axum v0.7 framework along with the Prisma Client Rust to build a realworld application.

Neo 3 Dec 9, 2023
Extremely simple Axum + SolidJS starter for a fullstack web application.

royce Extremely simple Axum + SolidJS starter for a fullstack web application. Deploy immediately with a ready-to-use preconfigured Docker deployment.

null 39 Oct 16, 2024
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
A static website that allows a user to tap along with a beat, displaying the song's calculated tempo in beats per minute (BPM).

BPM Is A static website that allows a user to tap along with a beat, displaying the song's calculated tempo in beats per minute (BPM). Hosted at https

Blake Johnson 11 Nov 5, 2021
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
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

null 2 Nov 12, 2022
Rust server with Axum, GraphQL and SurrealDb

??️ Article on my web Axum server, Async-GraphQl, SurrealDB template Run without any prior setup, DB is in memory: cargo run To use routes other than

null 15 Jun 26, 2023
Htmx extractors and request guards for axum.

axum-htmx axum-htmx is a small extension library providing extractors and request guards for the various htmx headers within axum. Additionally, the l

Rob 5 Aug 14, 2023