How 00-team/heydari works
Project type and purpose
• This is a full-stack web application named “Heydari”
• Two UIs:
– Admin portal (React/TSX SPA built with Vite)
– Public website (TypeScript + SCSS site built with Webpack)
• Backend in Rust (single binary) exposing RESTful APIs, rendering templates, handling business logic, and talking to an SQLite database
File structure
• Top-level directories:
– admin/ (React components, layout, shared utilities, SCSS styles, Vite config via vite.config.ts)
– web/ (public site scripts and styles, Webpack configuration via webpack.config.js)
– src/ (Rust code: main.rs, web.rs, api modules, admin modules, models, migrations, templates)
– templates/ (server-side HTML templates for public pages)
– config/ (deployment scripts, systemd service file, nginx.conf)
– migrations/ (SQL schema)
– CI/CD: .github/workflows/deploy.yml
Extract architecture hints from README
• Some admin-privilege tooling via direct SQL
Main components
a. Client browsers:
– Admin SPA (served from static assets after Vite build)
– Public website SPA and server-rendered pages (Webpack build + server templates)
b. Reverse proxy / web server (NGINX) – serves static assets, proxies API calls to the Rust backend
c. Rust backend service – single process hosting:
– HTTP API endpoints (src/api/*.rs)
– Admin module logic (src/admin/*.rs)
– Template rendering (templates/) and static file serving (static/)
– Utility modules (utils.rs, config.rs)
d. SQLite database (main.db managed via migrations/)
e. CI/CD pipeline (GitHub Actions) – builds front-ends, compiles Rust, deploys via deploy.sh
Relationships & data flows
• Client → NGINX:
– “GET /admin” & assets → serves built SPA files
– “GET /” & other routes → serves templated pages or web SPA bundles
– “GET /static/*” → static resources (fonts, images, rapidoc.js)
– “POST/GET /api/*” → proxy to Rust backend
• NGINX → Rust backend: handles all dynamic API request routing
• Rust backend ↔ SQLite: read/write user, product, order, tag, material, blog data
• Rust backend → template engine → HTML views (for pages not entirely SPA-driven)
• GitHub Actions → on push to main:
– Build & test Rust code
– Build admin (Vite) & public (Webpack) bundles
– Run deploy.sh on target server
– Reload NGINX & systemd service (heydari.service)
Architectural patterns & design principles
• Clear separation of concerns:
– UI layer (admin SPA vs. public site)
– API layer (Rust modules in src/api)
– Business logic & models (src/models, src/admin, src/general)
– Data access via SQLite + migrations
• SPAs for rich interactions in admin, static + light templating for public site
• Reverse proxy for SSL termination, static-file caching, and API forwarding
• Infrastructure-as-code: nginx.conf, systemd service, deploy scripts
Technologies & frameworks
• Rust (backend): tokio/async runtime, web framework (e.g., Rocket or Actix)
• SQLite (database)
• TypeScript + React (admin SPA) with Vite
• TypeScript + Vanilla JS (public site) with Webpack
• SCSS for styling
• NGINX for HTTP server & reverse proxy
• GitHub Actions for CI/CD
Putting it all together
– Static asset bucket (static/)
– SPA bundles (admin/, web/)
– API endpoints (Rust service)
• Off to the side, illustrate CI/CD flow: GitHub Actions → build artifacts → deploy.sh → target server → NGINX & Rust service reload
– Blue for front-end
– Green for backend logic
– Orange for data stores
– Gray for infra/dev-ops