Production-Ready Laravel 11 Business Management API
A comprehensive business management API built with Laravel 11, providing real-time analytics, multi-module workflows, and role-based access control for the BMJ Vue.js frontend.
β PRODUCTION READY - Successfully serving real business data with full frontend integration
- Revenue Pipeline: Rp 684.361.522 potential value
- Business Metrics: 94 quotations, 82 purchase orders, 4 back orders
- Multi-Branch Data: Jakarta and Semarang operations
- Real-time Dashboard: Executive KPI monitoring
- JWT Authentication: Secure token-based authentication
- Role-Based Access: Director, Marketing, Finance, Inventory, Service roles
- Branch Security: Location-based data access control
- Session Management: Persistent authentication with frontend
- Revenue Tracking: Real-time revenue and pipeline metrics
- Conversion Analytics: Quote-to-PO conversion rates
- Branch Analytics: Multi-location business intelligence
- KPI Monitoring: Performance metrics and trends
- Inventory Alerts: Low stock notifications
- Quotation Management: CRUD operations with customer details
- Purchase Order Workflows: Quote-to-PO conversion tracking
- Customer Data: Complete customer information management
- Spareparts Tracking: Multi-location inventory management
- Stock Alerts: Automated low stock notifications
- Purchase Management: Procurement workflow APIs
- Back Order System: Supply chain management
- Invoice System: Standard and proforma invoice generation
- Payment Tracking: DP payments, full payments, receivables
- Revenue Analytics: Branch-wise financial analysis
- Work Order Management: Service request tracking
- Delivery Orders: Shipment and logistics management
- Employee Management: User roles and branch assignments
- Data Import: Excel file processing for bulk operations
- System Settings: Configuration management (currency, VAT, discounts)
- Excel Import: .XLS file processing for price lists
- Data Validation: Structured import with error handling
- Seller Codes: MHI (1), CT (2), Aseng (3)
- Branch Codes: SMG (Semarang), JKT (Jakarta)
- PHP 8.2+
- Composer
- MySQL/PostgreSQL
- Laravel 11 compatible environment
# Clone the repository
git clone https://github.com/KevinSiek/bmj-app-backend.git
cd bmj-app-backend
# Install dependencies
composer install
# Environment setup
cp .env.example .env
# Configure database credentials in .env
# Generate application key
php artisan key:generate
# Run migrations and seeders
php artisan migrate --seed
# Start development server
php artisan serveThe API will be available at http://localhost:8000
POST /api/login # User authentication
POST /api/logout # User logout
GET /api/user # Get authenticated user
GET /api/dashboard # Executive dashboard data
GET /api/dashboard/revenue # Revenue analytics
GET /api/dashboard/operations # Operations metrics
GET /api/dashboard/inventory # Inventory alerts
# Quotations
GET /api/quotations # List quotations
POST /api/quotations # Create quotation
PUT /api/quotations/{id} # Update quotation
DELETE /api/quotations/{id} # Delete quotation
# Purchase Orders
GET /api/purchase-orders # List purchase orders
POST /api/purchase-orders # Create purchase order
PUT /api/purchase-orders/{id} # Update purchase order
# Spareparts
GET /api/spareparts # List spareparts
POST /api/spareparts # Create sparepart
PUT /api/spareparts/{id} # Update sparepart
# Invoices
GET /api/invoices # List invoices
POST /api/invoices # Create invoice
# Employees
GET /api/employees # List employees
POST /api/employees # Create employee
PUT /api/employees/{id} # Update employee
# File Upload
POST /api/upload/excel # Upload Excel files
users- User authentication and rolesquotations- Sales quotationspurchase_orders- Purchase order managementinvoices- Invoice managementspareparts- Inventory managementemployees- Staff managementbranches- Multi-location support
- Users belong to branches and have roles
- Quotations can be converted to purchase orders
- Purchase orders generate invoices
- Spareparts tracked across multiple branches
- Jakarta Branch: Independent operations and data
- Semarang Branch: Separate business unit
- Cross-Branch: Director role aggregated access
- Data Isolation: Branch-based data security
| Role | Quotations | Purchase | Inventory | Finance | Service | Admin |
|---|---|---|---|---|---|---|
| Director | CRUD | CRUD | CRUD | CRUD | CRUD | CRUD |
| Marketing | CRUD | Read | - | - | - | - |
| Finance | Read | Read | - | CRUD | - | - |
| Inventory | - | CRUD | CRUD | - | - | - |
| Service | - | Read | - | - | CRUD | - |
# Database
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=bmj_business
DB_USERNAME=your_username
DB_PASSWORD=your_password
# JWT Authentication
JWT_SECRET=your_jwt_secret
# File Upload
FILESYSTEM_DISK=local
MAX_UPLOAD_SIZE=10240
# CORS for frontend
SANCTUM_STATEFUL_DOMAINS=localhost:5173Ensure CORS is configured to allow requests from the Vue.js frontend:
// config/cors.php
'allowed_origins' => ['http://localhost:5173'],# Run unit tests
php artisan test
# Run specific test suite
php artisan test --testsuite=Feature
# Generate test coverage
php artisan test --coverage- Laravel 11 - PHP framework
- PHP 8.2 - Programming language
- MySQL - Database management
- JWT - Authentication tokens
- Eloquent ORM - Database relationships
- Laravel Sanctum - API authentication
- Excel Processing - File import/export
Current system performance (confirmed via frontend integration):
- Response Time: < 200ms for dashboard analytics
- Data Processing: Real-time business metrics
- Concurrent Users: Multi-user role support
- File Processing: Excel import with validation
β Backend Integration Confirmed
- Real-time data serving to Vue.js frontend
- Multi-branch operations active
- Role-based authentication working
- All business modules functional
- Executive dashboard with live KPIs
The system includes demo data:
- Director account:
director.jkt@bmj.com/password - Sample business data across all modules
- Multi-branch inventory and operations
- Financial transactions and analytics
- Frontend: https://github.com/KevinSiek/bmj-app-frontend
- API Base URL:
http://localhost:8000 - Authentication: JWT tokens via Axios
- Real-time Updates: WebSocket ready architecture
# Optimize for production
php artisan config:cache
php artisan route:cache
php artisan view:cache
# Run migrations
php artisan migrate --force
# Set proper permissions
chmod -R 755 storage bootstrap/cacheFor detailed API documentation with request/response examples:
- Postman Collection: Available in
/docsdirectory - OpenAPI Spec: Generated API documentation
- Frontend Integration: See bmj-app-frontend repository
- Frontend Application: https://github.com/KevinSiek/bmj-app-frontend
- Project Management: https://linear.app/b-kawan/project/bmj-project-8d0e08f45db9
- Documentation: Linear BKA-31, BKA-32, BKA-33, BKA-34
Private - BMJ Business Management System
Powered by Laravel 11 π Serving Vue.js 3 Frontend