saschagrunert/webapp.rs
saschagrunert/webapp.rs has 2,253 GitHub stars and 218 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-06 22:53 UTC. Last push 2026-10-29.
A web application completely written in Rust. 🌍
What you can do
- User registration with Argon2 password hashing
- Login with username and password
- JWT-based session management with automatic renewal
- PostgreSQL session and user storage
Measured star growth
- in 24h
- 0
- in 7 days
- Collecting history
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
Originalwebapp.rs
A web application completely written in Rust
Target of this project is to write a complete web application including backend and frontend within Rust.
graph LR
A[Leptos / WASM<br>in browser] -->|SSR / RPC| B[Axum<br>HTTP Server]
B --> C[SQLx]
C --> D[(PostgreSQL)]
Blog Posts
- A Web Application completely in Rust.
- Lessons learned on writing web applications completely in Rust.
Architecture
| Component | Technology |
|---|---|
| Frontend | Leptos (WebAssembly with SSR + hydration) |
| Backend | Axum (via leptos_axum) |
| Database | PostgreSQL (via SQLx) |
| Auth | JWT tokens (jsonwebtoken) + Argon2 password hashing |
The application uses Leptos server functions to communicate between frontend and backend, eliminating the need for a separate REST API layer. Both server and client are compiled from a single Rust crate.
Features
- User registration with Argon2 password hashing
- Login with username and password
- JWT-based session management with automatic renewal
- PostgreSQL session and user storage
- CSRF protection via origin validation
- Health check endpoint (
/healthz) for container orchestration - Server-side rendering with client-side hydration
- Single binary deployment
Prerequisites
- Rust (stable)
- cargo-leptos:
cargo install cargo-leptos - PostgreSQL
wasm32-unknown-unknowntarget:rustup target add wasm32-unknown-unknown- wasm-bindgen-cli:
cargo install wasm-bindgen-cli
Getting Started
Start a PostgreSQL instance:
docker run -d --name postgres \
-e POSTGRES_USER=webapp \
-e POSTGRES_PASSWORD=webapp \
-e POSTGRES_DB=webapp \
-p 5432:5432 \
postgres:17
Run the application:
export DATABASE_URL=postgres://webapp:webapp@localhost/webapp
cargo leptos watch
The application will be available at http://127.0.0.1:3000.
Register a new account using the "Register" link on the login page, then log in with your credentials.
Configuration
| Environment Variable | Description | Default |
|---|---|---|
DATABASE_URL |
PostgreSQL connection string | postgres://localhost/webapp |
JWT_SECRET |
Secret key for JWT token signing | change-me-in-production |
LEPTOS_SITE_ADDR |
Server listen address | 127.0.0.1:3000 |
Container
Build and run as a container:
docker build -t webapp .
docker run -p 3000:3000 \
-e DATABASE_URL=postgres://webapp:[email protected]/webapp \
webapp
Development
cargo fmt --check # Check formatting
cargo clippy --features ssr -- -D warnings # Lint server code
cargo test --features ssr # Run tests
cargo leptos build # Build for development
cargo leptos build --release # Build for production
Contributing
You want to contribute to this project? Wow, thanks! So please just fork it and send me a pull request.
License
Explore related projects
freeCodeCamp/freeCodeCamp
freeCodeCamp.org's open-source codebase and curriculum. Learn math, programming, and computer science for free.
458,676 starsdonnemartin/system-design-primer
Learn how to design large-scale systems. Prep for the system design interview. Includes Anki flashcards.
377,152 starsreact/react
The library for web and native user interfaces.
252,265 starsvuejs/vue
This is the repo for Vue 2. For Vue 3, go to https://github.com/vuejs/core
212,625 stars