A comprehensive backend API for construction project management built with Laravel. This system provides multi-company support, project management, task tracking, inspections, snag reporting, document management, photo galleries, and real-time notifications.
- Multi-company support with role-based access control
- Project management with progress tracking and team assignment
- Task management with photo uploads, comments, and status tracking
- Inspection system with categories and quality control
- Snag/issue reporting with status workflow and photo evidence
- Document management with versioning and categorization
- Photo gallery with albums and metadata
- Real-time notifications with multiple channels
- Comprehensive analytics and dashboard endpoints
- Laravel Sanctum for API authentication
- Multi-step user registration (User → Company → Team)
- Role-based permissions and middleware
- Company-based data isolation
- Backend: Laravel 10.x
- Authentication: Laravel Sanctum
- Database: MySQL/PostgreSQL
- File Storage: Laravel Storage (local/public/S3)
- Queue: Laravel Queues for notifications
- API: RESTful JSON API
- PHP 8.1 or higher
- Composer
- MySQL/PostgreSQL
- Node.js & NPM (for frontend development)
-
Clone the repository
git clone [repository-url] cd biltix-construction-api
-
Install dependencies
composer install npm install
-
Environment configuration
cp .env.example .env php artisan key:generate
-
Database setup
php artisan migrate php artisan db:seed
-
Storage setup
php artisan storage:link
-
Start development server
php artisan serve
http://localhost:8000/api/v1
Authorization: Bearer {your-token-here}
Content-Type: application/json
Accept: application/json
POST /auth/register/step1
- User registration step 1POST /auth/register/step2
- Company registration step 2POST /auth/register/step3
- Team member invitation step 3POST /auth/login
- User loginPOST /auth/logout
- User logoutGET /profile
- Get user profilePUT /profile
- Update user profile
GET /companies
- List user's companiesPOST /companies
- Create new companyGET /companies/{id}
- Get company detailsPUT /companies/{id}
- Update companyDELETE /companies/{id}
- Delete companyPOST /companies/{id}/invite
- Invite user to companyGET /companies/{id}/members
- Get company members
GET /projects
- List projectsPOST /projects
- Create new projectGET /projects/{id}
- Get project detailsPUT /projects/{id}
- Update projectDELETE /projects/{id}
- Delete projectGET /projects/{id}/analytics
- Get project analyticsGET /projects/{id}/timeline
- Get project timeline
GET /tasks
- List tasksPOST /tasks
- Create new taskGET /tasks/{id}
- Get task detailsPUT /tasks/{id}
- Update taskDELETE /tasks/{id}
- Delete taskPUT /tasks/{id}/status
- Update task statusPUT /tasks/{id}/progress
- Update task progressPOST /tasks/{id}/assign
- Assign task to userPOST /tasks/{id}/photos
- Upload task photosGET /tasks/{id}/photos
- Get task photosPOST /tasks/{id}/comments
- Add task commentGET /tasks/{id}/comments
- Get task comments
GET /inspections
- List inspectionsPOST /inspections
- Create new inspectionGET /inspections/{id}
- Get inspection detailsPUT /inspections/{id}
- Update inspectionDELETE /inspections/{id}
- Delete inspectionPUT /inspections/{id}/conduct
- Mark inspection as conductedPOST /inspections/{id}/complete
- Complete inspection
GET /snags
- List snag reportsPOST /snags
- Create new snag reportGET /snags/{id}
- Get snag report detailsPUT /snags/{id}
- Update snag reportDELETE /snags/{id}
- Delete snag reportPOST /snags/{id}/assign
- Assign snag to userPUT /snags/{id}/status
- Update snag statusPOST /snags/{id}/photos
- Upload snag photos
GET /documents
- List documentsPOST /documents
- Upload new documentGET /documents/{id}
- Get document detailsPUT /documents/{id}
- Update documentDELETE /documents/{id}
- Delete documentGET /documents/{id}/download
- Download documentGET /documents/{id}/versions
- Get document versionsPOST /documents/{id}/version
- Upload new version
GET /albums
- List photo albumsPOST /albums
- Create new albumGET /albums/{id}
- Get album detailsPUT /albums/{id}
- Update albumDELETE /albums/{id}
- Delete albumPOST /albums/{id}/photos
- Upload photos to albumPOST /albums/{id}/cover
- Set album cover photo
GET /notifications
- List notificationsPOST /notifications
- Create notificationGET /notifications/{id}
- Get notification detailsPUT /notifications/{id}/read
- Mark as readPUT /notifications/read-all
- Mark all as readGET /notifications/unread-count
- Get unread countDELETE /notifications/{id}
- Delete notification
GET /dashboard
- Main dashboard overviewGET /dashboard/analytics
- Global analyticsGET /dashboard/tasks-summary
- Tasks summaryGET /dashboard/snags-summary
- Snags summary
- Basic user information
- Company membership
- Role assignments
- Company details
- Team management
- Project assignment
- Project details
- Progress tracking
- Team assignment
- Timeline management
- Task details
- Status tracking
- Photo uploads
- Comments
- User assignments
- Inspection details
- Categories
- Status tracking
- Photo evidence
- Inspector assignment
- Issue reporting
- Severity levels
- Status workflow
- Photo evidence
- User assignments
- File management
- Versioning
- Categorization
- Project association
- Album organization
- Photo metadata
- Cover photos
- Project association
- Real-time alerts
- Multiple channels
- Read/unread status
- User targeting
{
"success": false,
"message": "Error description",
"errors": {
"field": ["error1", "error2"]
}
}
200
- Success201
- Created400
- Bad Request401
- Unauthorized403
- Forbidden404
- Not Found422
- Validation Error500
- Server Error
# Run all tests
php artisan test
# Run specific test suite
php artisan test --filter UserTest
# Run with coverage
php artisan test --coverage
Import the provided Postman collection: docs/postman-collection.json
- User registration (all 3 steps)
- User login/logout
- Company creation and management
- Project creation and updates
- Task creation with photos
- Inspection scheduling and completion
- Snag report creation and updates
- Document upload and versioning
- Photo album management
- Notification delivery
- Dashboard analytics
storage/app/public/
├── documents/
│ ├── {company-id}/
│ │ ├── {project-id}/
│ │ │ ├── {document-category}/
│ │ │ └── versions/
├── photos/
│ ├── {company-id}/
│ │ ├── {project-id}/
│ │ │ ├── tasks/
│ │ │ ├── inspections/
│ │ │ ├── snags/
│ │ │ └── albums/
└── thumbnails/
└── {same-structure-as-photos}
- Maximum file size: 10MB
- Allowed document types: PDF, DOC, DOCX, XLS, XLSX, TXT
- Allowed image types: JPG, JPEG, PNG, GIF, WebP
- Maximum photos per upload: 20
- JWT tokens with Laravel Sanctum
- Token expiration: 1 week
- Refresh token support
- Role-based access control
- Company-based data isolation
- Resource-level permissions
- Password hashing with bcrypt
- File upload validation
- SQL injection prevention
- XSS protection
- Rate limiting
- Database query caching
- File metadata caching
- User session caching
- Database indexing
- Image optimization
- Lazy loading
- Pagination (default: 15 items per page)
APP_NAME="Construction Management API"
APP_ENV=production
APP_KEY=
APP_DEBUG=false
APP_URL=https://your-domain.com
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=construction_api
DB_USERNAME=root
DB_PASSWORD=
FILESYSTEM_DISK=public
QUEUE_CONNECTION=database
- Set APP_ENV=production
- Set APP_DEBUG=false
- Configure proper database
- Set up SSL certificate
- Configure file storage (S3 recommended)
- Set up queue workers
- Configure backup system
- Set up monitoring
- Storage link not working: Run
php artisan storage:link
- File upload errors: Check PHP upload limits
- Database connection: Verify .env configuration
- Queue not processing: Start queue worker with
php artisan queue:work
- Check logs:
storage/logs/laravel.log
- Run diagnostics:
php artisan route:list
- Clear cache:
php artisan cache:clear
- Optimize:
php artisan optimize
- Fork the repository
- Create feature branch
- Write tests for new features
- Run tests:
php artisan test
- Submit pull request
This project is licensed under the MIT License - see the LICENSE file for details.