Files
bytemalte_de/README.md
2025-12-18 15:06:30 +01:00

100 lines
2.5 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

bytemalte_de Community Chat
Dies ist ein Fullstack-Projekt für einen modernen Gruppenchat, entwickelt mit:
- Leptos Web-Framework aus Rust
- cargo-leptos Fullstack-Build-Tool
- Axum Webserver-Framework
- SQLite Leichte Embedded-Datenbank
Projekt-Setup
1. Datenbank konfigurieren
Erstelle im Hauptverzeichnis eine .env Datei mit folgendem Inhalt:
DATABASE_URL="sqlite:community.db"
Initialisiere anschließend die Datenbank und führe Migrationen aus:
sqlx db create
sqlx migrate run
Damit werden die Tabellen für Benutzer und Nachrichten in der Datei community.db angelegt.
2. Entwicklungsserver starten
Starte das Projekt mit Hot-Reload:
cargo leptos watch
Nach erfolgreicher Kompilierung (WASM für das Frontend und Binärdatei für das Backend) ist die Anwendung unter
http://127.0.0.1:3000 erreichbar.
Zusätzliche Tools und Konfiguration
Dieses Projekt nutzt kryptografische Funktionen (bcrypt) und Datenbankzugriffe. Stelle sicher, dass folgende Tools installiert sind:
rustup target add wasm32-unknown-unknown
cargo install sqlx-cli --no-default-features --features sqlite
SASS Compiler:
Fedora:
sudo dnf install dart-sass
oder mit npm:
npm install -g sass
Füge folgende Konfiguration in .cargo/config.toml hinzu, um das WASM-Krypto-Backend zu aktivieren:
[target.wasm32-unknown-unknown]
rustflags = ["--cfg", "getrandom_backend=\"wasm_js\""]
Produktion / Release Build
Erzeuge eine optimierte Release-Version:
cargo leptos build --release
Dieser Befehl erstellt:
- Die Server-Binärdatei unter target/release/bytemalte_de
- Das Frontend-Paket (WASM/JS/CSS) unter target/site
Tests ausführen
Führe End-to-End-Tests mit Playwright aus:
cargo leptos end-to-end
Die Tests befinden sich im Verzeichnis end2end/tests.
Deployment auf einem entfernten Server (Ubuntu 24.04 VPS)
Nach cargo leptos build --release benötigst du auf dem Zielserver folgende Dateien:
- target/release/bytemalte_de
- target/site/
- community.db
- .env
Beispielhafte Verzeichnisstruktur:
bytemalte_de/
├── site/
├── community.db
└── .env
Exportiere die Umgebungsvariablen (z.B. in einem Systemd-Service):
export LEPTOS_OUTPUT_NAME="bytemalte_de"
export LEPTOS_SITE_ROOT="site"
export LEPTOS_SITE_PKG_DIR="pkg"
export LEPTOS_SITE_ADDR="0.0.0.0:3000"
export DATABASE_URL="sqlite:community.db"
Starte die Anwendung:
./bytemalte_de
Lizenz & Urheberrecht
Dieses Projekt basiert auf dem Leptos Axum Starter Template.
Die spezifische Chat-Logik, das Styling und UI-Design wurden individuell für bytemalte_de entwickelt.
Entwickelt mit ❤️ von bytemalte