How trylyhak/final_dart_pos_system works
This repository implements a point-of-sale system: a Flutter client supports sign-in, product and category browsing, cart-based sales, and order handling, backed by a PHP JSON API and MySQL. The main workflow sends client requests through API route dispatch to domain controllers, which validate and perform operations through models. Order creation checks stock, records the order and its items, and deducts inventory in a transaction. The tree and excerpts do not establish the frontend's exact service-to-view calls or all category/auth internals, so those links are omitted where unverified.
Main entry points: index.php API router · OrderController.php Order processing · database.php DB connection · response.php JSON responses
Components 20
POS client
- Flutter app
pos_frontend/lib/app.dart - Admin menu
pos_frontend/lib/views/admin_menu.dart - Sales menu
pos_frontend/lib/views/sale_menu.dart - API services
pos_frontend/lib/services/api_services.dart - Auth service
pos_frontend/lib/services/auth_services.dart - Product service
pos_frontend/lib/services/product_service.dart - POS models
pos_frontend/lib/models
HTTP API
- API router
pos_backend/api/index.php - JSON responses
pos_backend/api/helpers/response.php
Domain operations
- Authentication
pos_backend/api/controllers/AuthController.php - Category management
pos_backend/api/controllers/CategoryController.php - Product management
pos_backend/api/controllers/ProductController.php - Order processing
pos_backend/api/controllers/OrderController.php
Persistence
- DB connection
pos_backend/api/config/database.php - User records
pos_backend/api/models/user.php - Category records
pos_backend/api/models/category.php - Product and stock
pos_backend/api/models/product.php - Order records
pos_backend/api/models/order.php - MySQL database
Other components
- POS operator
Connections 32
- POS operator → Flutter app: uses
- API router → Authentication: routes login
pos_backend/api/index.php - API router → Category management: routes categories
pos_backend/api/index.php - API router → Product management: routes products
pos_backend/api/index.php - API router → Order processing: routes orders
pos_backend/api/index.php - Authentication → User records: looks up user
pos_backend/api/controllers/AuthController.php - Category management → Category records: manages categories
pos_backend/api/controllers/CategoryController.php - Product management → Product and stock: manages products
pos_backend/api/controllers/ProductController.php - Order processing → Order records: reads and writes
pos_backend/api/controllers/OrderController.php - Order processing → Product and stock: checks and deducts stock
pos_backend/api/controllers/OrderController.php - Authentication → DB connection: opens connection
pos_backend/api/controllers/AuthController.php - Category management → DB connection: opens connection
pos_backend/api/controllers/CategoryController.php - Product management → DB connection: opens connection
pos_backend/api/controllers/ProductController.php - Order processing → DB connection: opens connection
pos_backend/api/controllers/OrderController.php - DB connection → MySQL database: connects
pos_backend/api/config/database.php - User records → MySQL database: queries
- Category records → MySQL database: queries
- Product and stock → MySQL database: queries
- Order records → MySQL database: queries
- API router → JSON responses: sends errors
pos_backend/api/index.php - Authentication → JSON responses: returns result
pos_backend/api/controllers/AuthController.php - Category management → JSON responses: returns result
pos_backend/api/controllers/CategoryController.php - Product management → JSON responses: returns result
pos_backend/api/controllers/ProductController.php - Order processing → JSON responses: returns result
pos_backend/api/controllers/OrderController.php - Flutter app → Admin menu: shows
- Flutter app → Sales menu: shows
- Admin menu → Product service: uses
- Sales menu → Product service: uses
- Sales menu → POS models: uses cart and order data
- Auth service → API services: uses
- Product service → API services: uses
- API services → API router: calls API