Link aggregation and post comments on ATProto!
1<!--
2SPDX-FileCopyrightText: 2025 footnotes.social contributors
3
4SPDX-License-Identifier: MIT
5-->
6
7<picture>
8 <source srcset="https://raw.githubusercontent.com/leptos-rs/leptos/main/docs/logos/Leptos_logo_Solid_White.svg" media="(prefers-color-scheme: dark)">
9 <img src="https://raw.githubusercontent.com/leptos-rs/leptos/main/docs/logos/Leptos_logo_RGB.svg" alt="Leptos Logo">
10</picture>
11
12# Leptos Axum Starter Template
13
14This is a template for use with the [Leptos](https://github.com/leptos-rs/leptos) web framework and the [cargo-leptos](https://github.com/akesson/cargo-leptos) tool using [Axum](https://github.com/tokio-rs/axum).
15
16## Creating your template repo
17
18If you don't have `cargo-leptos` installed you can install it with
19
20```bash
21cargo install cargo-leptos --locked
22```
23
24Then run
25```bash
26cargo leptos new --git https://github.com/leptos-rs/start-axum
27```
28
29to generate a new project template.
30
31```bash
32cd footnotes_appview
33```
34
35to go to your newly created project.
36Feel free to explore the project structure, but the best place to start with your application code is in `src/app.rs`.
37Additionally, Cargo.toml may need updating as new versions of the dependencies are released, especially if things are not working after a `cargo update`.
38
39## Running your project
40
41```bash
42cargo leptos watch
43```
44
45## Installing Additional Tools
46
47By default, `cargo-leptos` uses `nightly` Rust, `cargo-generate`, and `sass`. If you run into any trouble, you may need to install one or more of these tools.
48
491. `rustup toolchain install nightly --allow-downgrade` - make sure you have Rust nightly
502. `rustup target add wasm32-unknown-unknown` - add the ability to compile Rust to WebAssembly
513. `cargo install cargo-generate` - install `cargo-generate` binary (should be installed automatically in future)
524. `npm install -g sass` - install `dart-sass` (should be optional in future
535. Run `npm install` in end2end subdirectory before test
54
55## Compiling for Release
56```bash
57cargo leptos build --release
58```
59
60Will generate your server binary in target/release and your site package in target/site
61
62## Testing Your Project
63```bash
64cargo leptos end-to-end
65```
66
67```bash
68cargo leptos end-to-end --release
69```
70
71Cargo-leptos uses Playwright as the end-to-end test tool.
72Tests are located in end2end/tests directory.
73
74## Executing a Server on a Remote Machine Without the Toolchain
75After running a `cargo leptos build --release` the minimum files needed are:
76
771. The server binary located in `target/server/release`
782. The `site` directory and all files within located in `target/site`
79
80Copy these files to your remote server. The directory structure should be:
81```text
82footnotes_appview
83site/
84```
85Set the following environment variables (updating for your project as needed):
86```sh
87export LEPTOS_OUTPUT_NAME="footnotes_appview"
88export LEPTOS_SITE_ROOT="site"
89export LEPTOS_SITE_PKG_DIR="pkg"
90export LEPTOS_SITE_ADDR="127.0.0.1:3000"
91export LEPTOS_RELOAD_PORT="3001"
92```
93Finally, run the server binary.
94
95## Licensing
96
97This template itself is released under the Unlicense. You should replace the LICENSE for your own application with an appropriate license if you plan to release it publicly.