Update README.md

This commit is contained in:
2025-12-17 19:46:15 +00:00
parent 506f12adc2
commit f07b1baba0

114
README.md
View File

@@ -3,89 +3,93 @@
<img src="https://raw.githubusercontent.com/leptos-rs/leptos/main/docs/logos/Leptos_logo_RGB.svg" alt="Leptos Logo"> <img src="https://raw.githubusercontent.com/leptos-rs/leptos/main/docs/logos/Leptos_logo_RGB.svg" alt="Leptos Logo">
</picture> </picture>
# Leptos Axum Starter Template # bytemalte_de - Community Chat
This 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). Dies ist ein Fullstack-Projekt für einen modernen Gruppenchat, entwickelt mit dem [Leptos](https://github.com/leptos-rs/leptos) Web-Framework, dem [cargo-leptos](https://github.com/akesson/cargo-leptos) Tool, [Axum](https://github.com/tokio-rs/axum) und [SQLite](https://sqlite.org/).
## Creating your template repo ## Projekt-Setup
If you don't have `cargo-leptos` installed you can install it with Stelle sicher, dass du die notwendige Umgebungsvariable für die Datenbank konfiguriert hast. Erstelle eine `.env` Datei im Hauptverzeichnis:
```bash ```bash
cargo install cargo-leptos --locked DATABASE_URL="sqlite:community.db"
``` Initialisiere die Datenbank und führe die Migrationen aus:
Then run Bash
```bash
cargo leptos new --git https://github.com/leptos-rs/start-axum
```
to generate a new project template. sqlx db create
sqlx migrate run
Damit werden die Tabellen für Benutzer und Nachrichten in der Datei community.db angelegt.
```bash Running your project
cd bytemalte_de Um den Entwicklungs-Server mit Hot-Reload zu starten, führe folgenden Befehl aus:
```
to go to your newly created project. Bash
Feel free to explore the project structure, but the best place to start with your application code is in `src/app.rs`.
Additionally, Cargo.toml may need updating as new versions of the dependencies are released, especially if things are not working after a `cargo update`.
## Running your project
```bash
cargo leptos watch cargo leptos watch
``` Das Projekt wird kompiliert (WASM für das Frontend und Binärdatei für das Backend) und ist unter http://127.0.0.1:3000 erreichbar.
## Installing Additional Tools Installing Additional Tools
Da dieses Projekt kryptografische Funktionen (bcrypt) und Datenbank-Abfragen nutzt, werden zusätzliche Tools und Konfigurationen benötigt:
By 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. rustup target add wasm32-unknown-unknown - Ermöglicht die Kompilierung von Rust zu WebAssembly.
1. `rustup toolchain install nightly --allow-downgrade` - make sure you have Rust nightly cargo install sqlx-cli --no-default-features --features sqlite - Tool für Datenbank-Migrationen.
2. `rustup target add wasm32-unknown-unknown` - add the ability to compile Rust to WebAssembly
3. `cargo install cargo-generate` - install `cargo-generate` binary (should be installed automatically in future) sudo dnf install dart-sass (Fedora) oder npm install -g sass - Zum Kompilieren der main.scss.
4. `npm install -g sass` - install `dart-sass` (should be optional in future
5. Run `npm install` in end2end subdirectory before test WASM-Krypto: Die Datei .cargo/config.toml muss existieren, um das wasm_js Backend für getrandom zu aktivieren:
Ini, TOML
[target.wasm32-unknown-unknown]
rustflags = ["--cfg", "getrandom_backend=\"wasm_js\""]
Compiling for Release
Bash
## Compiling for Release
```bash
cargo leptos build --release cargo leptos build --release
``` Dieser Befehl generiert die optimierte Server-Binärdatei in target/release/bytemalte_de und das Site-Paket (WASM/JS/CSS) in target/site.
Will generate your server binary in target/release and your site package in target/site Testing Your Project
Bash
## Testing Your Project
```bash
cargo leptos end-to-end cargo leptos end-to-end
``` Cargo-leptos nutzt Playwright für End-to-End-Tests. Die Tests befinden sich im Verzeichnis end2end/tests.
```bash Executing a Server on a Remote Machine (Ubuntu 24.04 VPS)
cargo leptos end-to-end --release Nach einem erfolgreichen cargo leptos build --release werden folgende Dateien auf dem Zielserver benötigt:
```
Cargo-leptos uses Playwright as the end-to-end test tool. Die Server-Binärdatei: target/release/bytemalte_de
Tests are located in end2end/tests directory.
## Executing a Server on a Remote Machine Without the Toolchain Das Site-Verzeichnis: target/site
After running a `cargo leptos build --release` the minimum files needed are:
1. The server binary located in `target/server/release` Die Datenbank: community.db
2. The `site` directory and all files within located in `target/site`
Die Umgebungsvariable: .env
Die Verzeichnisstruktur auf dem VPS sollte wie folgt aussehen:
Plaintext
Copy these files to your remote server. The directory structure should be:
```text
bytemalte_de bytemalte_de
site/ site/
``` community.db
Set the following environment variables (updating for your project as needed): .env
```sh Setze die folgenden Umgebungsvariablen für den Betrieb (z.B. in einem Systemd-Service):
Bash
export LEPTOS_OUTPUT_NAME="bytemalte_de" export LEPTOS_OUTPUT_NAME="bytemalte_de"
export LEPTOS_SITE_ROOT="site" export LEPTOS_SITE_ROOT="site"
export LEPTOS_SITE_PKG_DIR="pkg" export LEPTOS_SITE_PKG_DIR="pkg"
export LEPTOS_SITE_ADDR="127.0.0.1:3000" export LEPTOS_SITE_ADDR="0.0.0.0:3000"
export LEPTOS_RELOAD_PORT="3001" export DATABASE_URL="sqlite:community.db"
``` Starte die Anwendung durch Ausführen der Binärdatei: ./bytemalte_de
Finally, run the server binary.
## Licensing Licensing
Dieses Projekt basiert auf dem Leptos Axum Starter Template. Die spezifische Chat-Logik und das Design wurden für bytemalte_de angepasst.
This 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.
Damit ist deine Dokumentation jetzt vollständig und professionell strukturiert!
**Gibt es noch etwas, das ich an der README anpassen soll, oder bist du bereit für das erste Deployment?**