tauri optional build

Date: 2025 11-November 10

Here’s a clean way to organize your project so Tauri is optional, the web frontend is always usable, and your core logic is separate. This will support Termux, desktop, and Dockerized builds.


Proposed Folder Structure

tauri_multimodal_app/
│
├── core/                  # Your core logic (Python CLI, Rust, or shared library)
│   ├── __init__.py        # if Python
│   ├── cli.py             # Typer CLI or command handlers
│   └── api_clients/       # REST/EDS clients
│
├── frontend/              # Your web frontend source
│   ├── index.html         # entrypoint
│   ├── main.js / main.ts  # frontend JS/TS logic
│   ├── styles/            # CSS / SCSS
│   └── components/        # modular UI components
│
├── dist/                  # Compiled frontend output
│   └── index.html         # generated via Vite build
│
├── src-tauri/             # Optional Tauri native wrapper
│   ├── Cargo.toml
│   ├── tauri.conf.json
│   └── src/
│       ├── main.rs        # launches tauri::Builder
│       └── lib.rs         # app setup, logging, etc.
│
├── node_modules/          # NPM dependencies
├── package.json           # NPM scripts for frontend & Tauri
├── Cargo.lock             # Rust dependency lock for Tauri
└── Dockerfile             # Optional containerized deployment

How it works

  1. Web-native mode

    • Simply run the frontend from dist/:

      # Serve locally
      python -m http.server -d dist 8000
      # Or via Nginx / Docker
      
    • Your core logic can be called via HTTP REST or WebSockets if needed.

  2. Tauri mode (native)

    • Tauri reads dist/index.html as frontendDist.

    • Build and run via:

      cd src-tauri
      cargo tauri dev   # for dev
      cargo tauri build # for production binary
      
    • The Tauri binary wraps the same frontend—no changes needed.

  3. Dockerized deployment

    • Web-only container: Serve dist/ via Nginx or Python, no Rust required.

    • Tauri container: Build inside container with Rust & Node, output self-contained binary.


Key Points


If you want, I can also draft the Dockerfile(s) for both Tauri and web-only modes, so you could build and run containers without worrying about Rust or Node versions on the host.

Do you want me to do that next?