How zombiegenz/tank-food works
Main Components
• Frontend (Client):
• Built with React, TypeScript, and styled with Tailwind CSS combined with UI frameworks such as Ant Design, Material-UI, and Mantine UI.
• Contains “pages” for different views (e.g., account management, order pages, product pages, etc.) and reusable components (e.g., navbar, loading components, real-time token verification).
• Uses React Router for navigation and Axios for communicating with backend APIs.
• Backend (Server):
• Built on Express.js in a Node.js runtime environment with TypeScript.
• Organized into controllers, services, middlewares, and models (schemas and request models) indicating an MVC-like architecture.
• Contains separate folders for routes, controllers, and services to handle specific business functionalities like account management, orders, products, categories, vouchers, and statistical reporting.
• Database:
• Uses MongoDB (a NoSQL database) which is likely abstracted via data models and schemas in the “server/src/models/schemas” folder.
• External Services & Integrations:
• Firebase for realtime database features, authentication, and cloud messaging.
• Socket.io for realtime communication.
• Nodemailer for email notifications.
• Discord Bot and possibly integrations with Payment Gateway (Sepay) for order/payment processing.
• Node-cron for scheduling background tasks (e.g., generating statistical reports, auto-unban accounts, backing up files).
Out the Relationships and Interaction Flow
• Client-to-Server Communication:
• The client makes RESTful API calls via Axios to the server’s API endpoints.
• React Router defines the navigation paths, translating user actions (e.g., placing an order, managing accounts) into API requests to the backend.
• Server Internal Architecture:
• Routes: They act as the entry point for incoming API requests and forward these to the corresponding controllers.
• Controllers: Handle the request logic by interacting with services.
• Services: Contain business logic and interact with data sources (the database via models/schemas, external APIs like Firebase) and utilities.
• Middlewares: Handle cross-cutting concerns such as authentication (using JWT), validation, error handling, and logging.
• Jobs: Scheduled tasks such as generating statistical reports or managing background processes are maintained in the “jobs” folder.
• Utils: Provide helper functions for date manipulations, encryption, logging, JWT handling, and more.
Architectural Patterns & Design Principles
• Layered Architecture: Separation between UI (client), business logic (controllers/services), data access (models/schemas), and cross-cutting concerns (middlewares and utilities).
• MVC-like Organization on the backend: Clear division between routes, controllers, and data models.
• Real-time Communication: Use of Firebase and Socket.io to provide real-time updates and notifications.
• Modular Structure: Both the client and server are modularized; for example, the client’s “views”, “components”, and “constants” are clearly separated, while the server splits responsibilities across controllers, services, and middlewares.
Relevant Technologies and Their Roles
• Frontend: React.js, Tailwind CSS, Ant Design, Material-UI, Mantine UI, Framer Motion, Recharts, React Router, Axios.
• Backend: Express.js, Node.js, TypeScript, nodemailer, node-cron, JWT, Express Validator.
• Database: MongoDB.
• External Services: Firebase (realtime, auth, cloud messaging), Socket.io (realtime communication), Discord Bot (system notifications), and Sepay (payment gateway).