Skip to content

d-led/self_contained_rust_app

Repository files navigation

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)

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
Loading

Run locally (dev mode: serve UI from filesystem)

bash scripts/watch-ui.sh

In another terminal:

bash scripts/run.sh

Open http://localhost:8080.

Run locally (embedded UI)

bash scripts/run.sh embedded

If the frontend wasn’t built yet, you’ll see a helpful placeholder page.

Docker (non-root runtime)

docker compose up --build

Stop:

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.

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Packages