An open API service indexing awesome lists of open source software.

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

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`.