How favoursui/scan_info_tech works
Purpose and Runtime Topology
Scan Info Tech is a containerized product catalog, cart, ordering, and IT-services platform. A static Vanilla JS frontend calls a FastAPI REST API; the API persists operational data in MySQL and integrates Cloudinary for product images and Gmail SMTP for account email. Docker Compose orchestrates frontend Nginx, backend Gunicorn/Uvicorn, MySQL, and phpMyAdmin.
Paths: docker-compose.yml, Dockerfile, nginx.conf
Entry Points and Delivery
The backend application entry point is FastAPI initialization and router registration in backend/app/main.py, served through Gunicorn configuration in backend/gunicorn.conf.py. Container startup is mediated by entrypoint.sh, including automatic Alembic migration execution. The browser entry surface is prebuilt HTML under frontend/build/, served by Nginx.
Paths: backend/app/main.py, entrypoint.sh, frontend/build/index.html
API Layer and Request Boundaries
Route modules expose resource-oriented API boundaries for authentication, products, carts, orders, admin operations, inventory, and services. Routes validate/request-shape through schema modules and delegate domain work to service modules rather than directly defining application workflows.
Paths: backend/app/routes/auth.py, backend/app/routes/orders.py, backend/app/routes/inventory.py
Identity, Authorization, and Account Lifecycle
JWT plus bcrypt security supports registration, login, verified-email flow, password-reset OTPs, lockout behavior, suspension, and role-based administration. Dependency injection centralizes authentication and admin checks before protected cart, order, inventory, and admin operations. User state is persisted alongside account-related records.
Paths: backend/app/core/security.py, backend/app/core/dependencies.py, backend/app/services/auth_service.py
Commerce Domain Flow
Public consumers browse paginated products and details. Authenticated users add/update/clear cart items; checkout transforms cart activity into order/transaction records, while order history exposes user-scoped results. Admin paths read platform-wide users/orders/products and manage product inventory.
Paths: backend/app/services/cart_service.py, backend/app/services/order_service.py, backend/app/models/order.py
Persistence and Schema Evolution
SQLAlchemy models represent users, products, carts, orders, transactions, accounts, guests, and services against MySQL. Database session/engine setup is isolated from route logic. Alembic owns the evolving relational schema, with sequential migrations covering the initial model, suspension, lockout, verification, reset OTP, and services.
Paths: backend/app/database.py, backend/app/models/product.py, backend/alembic/versions/0006_add_services.py
Frontend Integration
The frontend is a static multi-page application, not a frontend runtime/server-rendered app. Shared API/auth client code and page-focused scripts manage browser interactions for login, products, cart, orders, admin, and services; the API/JWT boundary is in browser JavaScript.
Paths: frontend/build/js/api.js, frontend/build/js/auth.js, frontend/build/js/cart.js
External Service Boundaries
Inventory image create/update/delete operations cross into Cloudinary; account verification, resets, and lockout notifications cross into configured Gmail SMTP via fastapi-mail. Environment-driven credentials and connection strings are centralized in backend configuration and supplied through container environment.
Paths: backend/app/utils/cloudinary.py, backend/app/utils/email.py, backend/app/config.py
Main entry points: orders.py Route Boundaries · database.py SQLAlchemy Database · auth_service.py Account Lifecycle · config.py Backend Configuration
Components 18
Container Runtime
- Docker Compose · Runs frontend, backend, MySQL, and phpMyAdmin containers.
docker-compose.yml - Nginx
nginx.conf - Container Entrypoint · Runs migrations before starting the backend server.
entrypoint.sh
Browser Frontend
- Static Pages
frontend/build/index.html - API & Auth Client · Carries API requests and JWT state in browser JavaScript.
frontend/build/js/api.js - Cart UI
frontend/build/js/cart.js
FastAPI Backend
- FastAPI Application · Registers resource routers and serves backend API requests.
backend/app/main.py - Route Boundaries · Authentication, orders, inventory, and other resource endpoints.
backend/app/routes/orders.py - JWT & Access Checks · Centralizes authentication and admin authorization for protected operations.
backend/app/core/dependencies.py - Account Lifecycle · Handles registration, login, verification, reset OTPs, lockouts, and suspension.
backend/app/services/auth_service.py - Cart Service
backend/app/services/cart_service.py - Order Service · Converts checkout cart activity into orders and transactions.
backend/app/services/order_service.py - Backend Configuration · Centralizes connection strings and external-service credentials.
backend/app/config.py
Data & Integrations
- SQLAlchemy Database · Isolates MySQL sessions and engine setup from route logic.
backend/app/database.py - Commerce Models · Represents products, carts, orders, transactions, users, and related records.
backend/app/models/product.py - Alembic Migrations · Maintains sequential relational schema changes.
backend/alembic/versions/0006_add_services.py - Cloudinary · Stores product inventory images.
backend/app/utils/cloudinary.py - Gmail SMTP · Sends account verification, reset, and lockout messages.
backend/app/utils/email.py
Connections 24
- Docker Compose → Nginx: runs
- Docker Compose → Container Entrypoint: starts backend
- Nginx → Static Pages: serves
- Static Pages → API & Auth Client: uses
- Cart UI → API & Auth Client: calls through
- API & Auth Client → FastAPI Application: REST requests with JWT
- Container Entrypoint → Alembic Migrations: runs
- Container Entrypoint → FastAPI Application: launches
- FastAPI Application → Route Boundaries: registers
- Route Boundaries → JWT & Access Checks: protects requests
- Route Boundaries → Account Lifecycle: delegates account flows
- Route Boundaries → Cart Service: delegates cart flows
- Route Boundaries → Order Service: delegates checkout and history
- JWT & Access Checks → Account Lifecycle: uses identity state
- Account Lifecycle → SQLAlchemy Database: persists accounts
- Cart Service → SQLAlchemy Database: persists carts
- Order Service → SQLAlchemy Database: persists orders
- SQLAlchemy Database → Commerce Models: maps
- Alembic Migrations → SQLAlchemy Database: evolves schema
- Route Boundaries → Cloudinary: inventory image operations
- Account Lifecycle → Gmail SMTP: account notifications
- Backend Configuration → SQLAlchemy Database: connection settings
- Backend Configuration → Cloudinary: credentials
- Backend Configuration → Gmail SMTP: credentials