https://github.com/d-led/self_contained_rust_app
https://github.com/d-led/self_contained_rust_app
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/d-led/self_contained_rust_app
- Owner: d-led
- License: other
- Created: 2026-01-25T21:37:19.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2026-01-25T23:42:33.000Z (5 months ago)
- Last Synced: 2026-01-26T13:52:17.704Z (5 months ago)
- Language: Rust
- Size: 85.9 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Self-contained Rust + Vite counter
- Backend: Rust + Actix Web + Actix actors (WebSockets supported)
- Frontend: Vite (uses esbuild in dev pipeline; fast builds)
- Static assets:
- embedded into the Rust binary (production / Docker)
- served from the filesystem (fast dev loop)
## Architecture (very brief)
```mermaid
flowchart TD
UI_SRC["Frontend source code (Vite app)"] -->|"Build frontend files"| UI_DIST["Built frontend files (dist folder)"]
SRV_SRC["Backend source code (Rust server)"] -->|"Compile backend executable"| SRV_BIN["Backend executable (server binary)"]
UI_DIST -. "Embedded into" .-> SRV_BIN
UI_DIST ==>|"HTTP requests"| SRV_BIN
UI_DIST ==>|"WebSocket connection"| SRV_BIN
```
## Run locally (dev mode: serve UI from filesystem)
```bash
bash scripts/watch-ui.sh
```
In another terminal:
```bash
bash scripts/run.sh
```
Open `http://localhost:8080`.
## Run locally (embedded UI)
```bash
bash scripts/run.sh embedded
```
If the frontend wasn’t built yet, you’ll see a helpful placeholder page.
## Docker (non-root runtime)
```bash
docker compose up --build
```
Stop:
```bash
docker compose down
```
Note: the Docker build produces a **statically linked** Linux binary (`musl`) so the runtime image can be fully minimal.
## License
This project is licensed under **CC BY 4.0**. See `LICENSE`.