How bkdesignhub/stockiq works
Purpose and Runtime
StockIQ is a server-rendered inventory and purchasing ERP for SMB distributors and retailers. It is a Laravel/PHP application using MySQL persistence, Blade HTML views, Bootstrap/JavaScript assets, and Laravel’s standard web session/auth runtime. The HTTP entry point is public/index.php; CLI, migrations, and scheduled/queue commands enter through artisan.
Application Composition
The web route layer in routes/web.php maps browser requests to controller modules under app/Http/Controllers. Controllers render Blade screens or perform state-changing form actions; shared authenticated page structure is in resources/views/layouts/app.blade.php. The repository contains no API route tree or separate frontend service, so the primary boundary is browser → Laravel MVC → MySQL.
Identity and Admin Access
Authentication is handled by app/Http/Controllers/AuthController.php, backed by Laravel auth configuration in config/auth.php and the app/Models/User.php model. Admin profile/settings management is separated in app/Http/Controllers/AdminProfileController.php and resources/views/admin/profile.blade.php. Database seeding establishes an initial administrator through database/seeders/AdminUserSeeder.php.
Product Catalog and Supplier Pricing
Catalog master data consists of products, categories, brands, vendors, and vendor-specific product prices. Their persistence models are app/Models/Product.php, app/Models/Category.php, and app/Models/VendorProductPrice.php; UI/controller boundaries are represented by app/Http/Controllers/ProductController.php, app/Http/Controllers/VendorController.php, and app/Http/Controllers/VendorProductPriceController.php. Product forms and product detail views support catalog maintenance via resources/views/products/_form.blade.php and resources/views/products/show.blade.php.
Purchase-to-Inventory Flow
Purchases are the principal inventory-in transaction: app/Http/Controllers/PurchaseController.php manages purchase headers and item lines represented by app/Models/Purchase.php and app/Models/PurchaseItem.php. Stock changes are tracked separately through app/Models/StockMovement.php and exposed by app/Http/Controllers/StockController.php. This separates commercial purchase records from inventory ledger/history, with user-facing purchase workflows in resources/views/purchases/create.blade.php and resources/views/purchases/show.blade.php.
Operational Views and Reporting
app/Http/Controllers/DashboardController.php aggregates business state for the overview at resources/views/dashboard/index.blade.php. app/Http/Controllers/ReportController.php supplies stock-worth and monthly-profit reports, rendered by resources/views/reports/stock-worth.blade.php and resources/views/reports/monthly-profit.blade.php. These are read/aggregation boundaries over catalog, purchase, and stock data rather than a dedicated analytics service.
Persistence and Infrastructure
Schema ownership is concentrated in database/migrations/2026_05_16_000000_create_stockiq_tables.php and database/migrations/2026_05_16_010000_create_categories_and_brands_tables.php, alongside Laravel user/cache/job tables. Database connectivity is configured through environment values and config/database.php; Laravel queue, cache, filesystem, mail, logging, and session subsystems are available via their respective config/ files. No external business API integration is evidenced in the tree.
Main entry points: web.php Web routes · DashboardController.php Dashboard & reports · database.php MySQL · PurchaseController.php Purchase workflow
Components 20
Browser UI
- Browser
- Authenticated layout
resources/views/layouts/app.blade.php - Catalog screens
resources/views/products/_form.blade.php - Purchase screens
resources/views/purchases/create.blade.php - Dashboard & report screens
resources/views/dashboard/index.blade.php
Laravel Web Application
- Web routes
routes/web.php - Authentication
app/Http/Controllers/AuthController.php - Admin profile
app/Http/Controllers/AdminProfileController.php - Catalog & supplier pricing
app/Http/Controllers/ProductController.php - Purchase workflow
app/Http/Controllers/PurchaseController.php - Stock ledger
app/Http/Controllers/StockController.php - Dashboard & reports · Aggregates operational data for read-only views.
app/Http/Controllers/DashboardController.php
Persistence & Operations
- Users
app/Models/User.php - Catalog data · Products, categories, brands, vendors, and supplier prices.
app/Models/Product.php - Purchases & items
app/Models/Purchase.php - Stock movements · Inventory ledger and history.
app/Models/StockMovement.php - MySQL
config/database.php - Schema migrations
database/migrations/2026_05_16_000000_create_stockiq_tables.php - Artisan · Runs migrations, seeders, schedules, and queue commands.
artisan - Initial admin seeder
database/seeders/AdminUserSeeder.php
Connections 30
- Browser → Web routes: HTTP requests
- Web routes → Authentication
- Web routes → Admin profile
- Web routes → Catalog & supplier pricing
- Web routes → Purchase workflow
- Web routes → Stock ledger
- Web routes → Dashboard & reports
- Authentication → Users: authenticates
- Admin profile → Users: manages
- Catalog & supplier pricing → Catalog data: maintains
- Purchase workflow → Purchases & items: creates purchases
- Purchase workflow → Stock movements: records inventory in
- Stock ledger → Stock movements: shows history
- Dashboard & reports → Catalog data: reads
- Dashboard & reports → Purchases & items: aggregates
- Dashboard & reports → Stock movements: aggregates
- Catalog & supplier pricing → Catalog screens: renders
- Purchase workflow → Purchase screens: renders
- Dashboard & reports → Dashboard & report screens: renders
- Catalog screens → Authenticated layout: uses
- Purchase screens → Authenticated layout: uses
- Dashboard & report screens → Authenticated layout: uses
- Users → MySQL: persists
- Catalog data → MySQL: persists
- Purchases & items → MySQL: persists
- Stock movements → MySQL: persists
- Artisan → Schema migrations: runs
- Schema migrations → MySQL: creates tables
- Artisan → Initial admin seeder: runs
- Initial admin seeder → Users: creates administrator