Askama website template
- Shell 37.7%
- Jinja 23.4%
- Rust 19.3%
- Dockerfile 11.6%
- CSS 8%
|
Some checks failed
deploy-prod.yml / fix: Fix remaining issues, good to use (push) Failing after 0s
|
||
|---|---|---|
| .forgejo/workflows | ||
| .zed | ||
| public | ||
| scripts | ||
| src | ||
| templates | ||
| .gitignore | ||
| .prettierrc | ||
| cargo-generate.toml | ||
| Cargo.lock | ||
| Cargo.toml | ||
| docker-compose.yml | ||
| Dockerfile | ||
| LICENSE | ||
| README.md | ||
| rustfmt.toml | ||
Askama + Axum + HTMX Starter Template
A production-ready template for building websites with Askama, Axum, and HTMX.
Features
- Askama - Type-safe, compiled Jinja-like templates
- Axum - Modern, fast Rust web framework
- HTMX - Dynamic HTML without JavaScript frameworks
- TLS/HTTPS - Built-in support with
axum-serverand Let's Encrypt certs - Forgejo CI - CI workflows for clippy, tests, formatting
- Zed Editor config - Formatter integrations for TOML, HTML, CSS, YAML, JSON, Docker
Quick Start with cargo-generate
cargo generate --git ssh://git@git.ohcooltools.dev/Ohcool-Media/askama-template.git
This will create a new project from the template. Follow the prompts to name your project.
Manual Setup
- Clone this repository
- Rename the project in
Cargo.toml - Generate TLS certificates:
mkdir -p private openssl req -x509 -newkey rsa:4096 -keyout private/key.pem -out private/cert.pem -days 365 -nodes
Development
Run the server (HTTPS on 2047):
cargo run
You'll need TLS certificates in private/. Generate self-signed ones for dev:
mkdir -p private
openssl req -x509 -newkey rsa:4096 -keyout private/key.pem -out private/cert.pem -days 365 -nodes
Project Structure
.
├── Cargo.toml
├── cargo-generate.toml # cargo-generate config
├── rustfmt.toml # Rust formatting config
├── .prettierrc # Prettier config for templates
├── .gitignore
├── .forgejo/
│ └── workflows/ # CI workflows
├── .zed/
│ └── settings.json # Zed editor config
├── scripts/ # Formatting/utility scripts
├── private/ # TLS certs (gitignored)
├── public/
│ └── style.css # Your stylesheets
├── src/
│ └── main.rs # Server entry point
└── templates/
├── base.html # Base layout
├── header.html # Site header (included)
├── footer.html # Site footer (included)
├── index.html # Home page
└── about.html # About page
Deploying
- Set up TLS certificates via Let's Encrypt
- Run the binary or use Docker
Customization
- Add templates in
templates/ - Add Askama template structs in
src/main.rs - Add routes with
Router::new().route(...) - Add static assets in
public/
License
MIT