-
Notifications
You must be signed in to change notification settings - Fork 2
project tree
Azizul Hakim edited this page Jan 3, 2026
·
3 revisions
This document provides a comprehensive overview of the IMS Laravel API Starter project structure, explaining the purpose and organization of each directory and key files.
ims-laravel-api-starter/
βββ π app/ # Application core code
βββ π bootstrap/ # Application bootstrapping
βββ π config/ # Configuration files
βββ π database/ # Database migrations and seeders
βββ π docs/ # Project documentation
βββ π public/ # Public assets and index.php
βββ π resources/ # Views, lang, and frontend assets
βββ π routes/ # Application routes
βββ π storage/ # Logs, cache, and app files
βββ π tests/ # Application tests
βββ π vendor/ # Composer dependencies
βββ π³ Dockerfile # Production container definition
βββ π README.md # Main project documentation
Contains the application-specific code organized by domain.
app/
βββ Console/ # Artisan commands
βββ DTOs/ # Data Transfer Objects
βββ Enums/ # Application enums
βββ Exceptions/ # Custom exceptions
βββ Http/
β βββ Controllers/ # HTTP controllers
β βββ Middleware/ # HTTP middleware
β βββ Requests/ # Form requests
βββ Models/ # Eloquent models
βββ Policies/ # Authorization policies
βββ Providers/ # Service providers
βββ Repositories/ # Repository pattern implementations
βββ Services/ # Business logic services
βββ Traits/ # Reusable traits
Key Files:
-
Console/Commands/: Custom Artisan commands (CRUD generators, DTO generators) -
DTOs/: Data Transfer Objects with readonly properties -
Http/Controllers/Api/V1/: API controllers with resource responses -
Models/: Eloquent models with relationships and scopes -
Repositories/: Repository interfaces and implementations -
Services/: Business logic services following single responsibility
config/
βββ app.php # Application settings
βββ auth.php # Authentication configuration
βββ database.php # Database connections
βββ permission.php # Laravel Permission settings
βββ scribe.php # API documentation config
βββ telescope.php # Laravel Telescope config
βββ health.php # Health check configuration
Key Features:
- Multi-database support (MySQL, PostgreSQL, SQLite)
- Laravel Sanctum API authentication
- Telescope monitoring with built-in auth
- Health check endpoints configuration
- API documentation generation settings
database/
βββ factories/ # Model factories
βββ migrations/ # Database migrations
βββ seeders/ # Database seeders
Migration Categories:
- Core: Users, roles, permissions, personal access tokens
- System: Failed jobs, password resets, migrations
- Monitoring: Telescope, Pulse, Health tables
tests/
βββ Feature/ # Feature tests
βββ Unit/ # Unit tests
βββ Mock/ # Mock data classes
βββ TestCase.php # Base test case
Test Structure:
- Feature Tests: API endpoint testing with Pest PHP
- Unit Tests: Service and repository testing
- Mock Classes: Reusable test data generators
- Database Testing: Uses RefreshDatabase trait
routes/
βββ api.php # API routes (v1)
βββ console.php # Artisan commands
βββ web.php # Web routes (health, docs)
API Versioning:
-
v1 Prefix: All API routes under
/api/v1/ - Resource Routes: RESTful resource controllers
- Auth Routes: Login, logout, refresh, profile
- Admin Routes: User, role, permission management
storage/
βββ app/ # Application files
β βββ backups/ # Laravel Backup files
β βββ media/ # Media library files
β βββ public/ # Publicly accessible files
βββ framework/ # Framework cache and sessions
βββ logs/ # Application logs
βββ telescope/ # Telescope monitoring data
resources/
βββ lang/ # Language files
β βββ bn/ # Bangla translations
β βββ en/ # English translations
βββ views/ # Blade templates
βββ docs/ # Documentation templates
βββ health/ # Health check templates
Internationalization:
- Bangla Support: Complete Bangla language pack
- English Support: Default English translations
- Custom Translations: Easy to add new languages
βββ .env.example # Environment variables template
βββ composer.json # PHP dependencies and scripts
βββ package.json # Node.js dependencies
βββ phpunit.xml # PHPUnit configuration
βββ pint.json # Laravel Pint code style
βββ Dockerfile # Docker development setup
Development Setup:
- App Container: PHP 8.2 with required extensions
- Database: MySQL 8.0 with health checks
- Queue Worker: Separate queue processing container
- Scheduler: Cron job scheduling container
Services:
- Web Server: Nginx with PHP-FPM
- Database: MySQL with optimized settings
- Cache: Redis for session and cache storage
- Queue: Redis queue driver
Repository Pattern:
- Interface definitions in
app/Repositories/Interfaces/ - Implementations in
app/Repositories/ - Dependency injection via service providers
Service Layer:
- Business logic in
app/Services/ - Single responsibility principle
- Repository integration
DTO Pattern:
- Data transfer objects in
app/DTOs/ - Readonly properties for immutability
- Type-safe data transformation
RESTful Resources:
- Resource controllers for CRUD operations
- Resource collections for data transformation
- Form request validation
Authentication:
- Laravel Sanctum for API authentication
- Personal access tokens
- Token-based session management
Response Standards:
- Consistent JSON response format
- Error handling with proper HTTP codes
- Pagination support
# Generate CRUD components
php artisan make:crud Product
# Generate DTO
php artisan make:dto ProductDTO
# Generate Service
php artisan make:service Product/ProductService# Run code style fixer
php artisan pint
# Run tests
php artisan test
# Clear caches
php artisan optimize:clear# Run migrations
php artisan migrate
# Seed database
php artisan db:seed
# Generate migration
php artisan make:migration create_products_tableFor detailed documentation, see the Features Guide.
Copyright 2026, @AHS12 All Right Reserved
- Home - Documentation Overview
- Quick Start - Installation and setup
- Project Structure - Directory organization
- Features Overview - Summary of capabilities
- Backup System - Database backups
- Extra Information - Additional tools
- Observability - Dashboard & Telemetry
- Health Checks - System status
- Running Tests - Testing guide
- API Documentation - API specs & UI
- Docker Guide - Container setup