Skip to content

openanalytics/leptodon-starter

Repository files navigation

Leptodon starter

This is a template repository to get started with leptos + leptodon inside an axum SSR environment.

Getting Started

  1. Click the green Use this template button and create a repository using this template.
  2. Clone your repository.
  3. Rename the project to your liking: rg -l starter ./ | xargs sed -i 's/starter/yourprojectname/g' (may need to install ripgrep).
  4. Install cargo-leptos: cargo install --locked cargo-leptos.
  5. Optional steps.
  6. Run with: cargo leptos serve.

The starter should now be available on http://localhost:3000.

Optional Steps

  1. Run npm install.
  2. Run Tailwind's CSS generator: npx tailwindcss -i input.css -o style/output.css --watch.
    • Tailwind is configured via tailwind.config.js and any additional CSS can be added at the end of input.css.
  3. Setup pre-commit hooks: pre-commit install (may need to install pre-commit first).
  4. Run direnv allow to enable direnv in case you use NixOS with flakes.
    • direnv is configured via .envrc, flake.nix and flake.lock.
  5. Run cd end2end; direnv allow to enable the Playwright devenv, you may need to install devenv.
    • Run npm install (since you also need to install Playwright here).
  6. Run playwright test to execute the tests.
  7. Run cargo install --locked cargo-make to enable Makefile.toml support, some useful commands include:
    • Run cargo make mimic-ci for a suite of checks your CI would run.
    • Run cargo make build-starter to build the project in release mode for production deployment.

Versions

What is build.rs ?

  • Runs cargo run codegen to generate .tailwind for Tailwind's class generation.
  • Generates src/generated_demolist.rs containing a list of all demos to construct routes and sidebar entries programmatically.
    • Allows for easy alphabetical sorting and reduces maintenance burden of adding/removing entries.