How nuttikung/share-meal works
Project type and purpose
• This is a single-page/front-end application built in Rust using the Dioxus framework.
• It uses Tailwind CSS for styling and a small Node toolchain for CSS compilation.
• The dx serve command (from Dioxus CLI) launches a development server targeting web, iOS, or desktop.
File structure
• Top-level files:
• Cargo.toml / Dioxus.toml – Rust project and Dioxus configuration
• package.json / tailwind.config.js – Tailwind CSS and NPM metadata
• Dockerfile / .dockerignore – containerization for production or CI
• src/ directory:
• main.rs – application entrypoint (initializes Dioxus app)
• lib.rs – shared library code
• components/ – UI components, grouped by feature (member, order, stats, tab)
• state/ – centralized application state modules (app_state, member, order)
• helper/ – utility functions (e.g., price formatting)
• assets/ directory: compiled CSS and other static files.
README for additional insights
• Confirms use of dx serve as the development server.
• Describes Tailwind installation and watch commands.
• No backend or database: purely client-side (WASM or native via Dioxus).
Main components and their relationships
a. Development & Build Tools
• Dioxus CLI (dx serve)
• Node/Tailwind CLI (npx tailwindcss)
• Docker build (optional production image)
b. Runtime environment
• Dioxus runtime (web renderer or native host)
• Application modules:
– UI Layer: src/components/*
– State Layer: src/state/*
– Helpers: src/helper/*
– Assets: compiled CSS in assets/
c. Data flow & interactions
• User interacts with UI components → Components dispatch actions or callbacks → State modules update data → Dioxus re-renders affected components
• Helper modules provide pure functions (e.g., price formatting) to components or state
• Tailwind CLI watches input.css → emits assets/tailwind.css → loaded by the application
Architectural patterns and design principles
• Component-based UI (small, reusable Rust components)
• Unidirectional data flow (Flux-style state management)
• Clear separation of concerns:
• Presentation (components)
• State & business logic (state modules)
• Utility logic (helper modules)
• Styling (Tailwind)
Detailed breakdown for diagramming
• Dioxus CLI (dx serve) → Rust compiler → WASM/Binary
• Tailwind CLI (input.css → assets/tailwind.css)
• Dockerfile (optional)
• Dioxus Runtime (Browser / Native Host) at top
• Under it, three columns:
• UI Components
– TabViewSwitcher, MemberList, OrderList, StatsOverview, etc.
• State Modules
– AppState, MemberState, OrderState
• Helper Modules
– Price formatting, common utilities
• Assets (tailwind.css, main.css) sits alongside UI and is loaded at startup
• Components → read/write to State modules
• Components → call Helper functions
• Dioxus Runtime → mounts UI components and injects CSS assets
• User events → UI Components → State updates → Re-render cycle