Digital - Source Tree Analysis

Generated: 2025-10-16 Repository Type: Monolith (Single codebase) Framework: Laravel 10.x


Directory Overview

digital2/
├── app/                    # Application core (Laravel MVC)
├── bmad/                   # BMAD meta-programming system
├── config/                 # Configuration files
├── database/               # Migrations, factories, seeders
├── docs/                   # Generated documentation (this folder)
├── docs-old/               # Previous manual documentation
├── public/                 # Web root, public assets
├── resources/              # Frontend assets, views, translations
├── routes/                 # Route definitions
├── storage/                # File storage, logs, cache
├── tests/                  # PHPUnit tests
└── vendor/                 # Composer dependencies

Application Code (/app)

/app - Main Application Directory

app/
├── AI/                     # AI-related logic (OpenAI, Pinecone)
├── Console/                # Artisan commands
│   ├── Commands/          # Custom CLI commands
│   └── Kernel.php         # Command scheduler
├── Enums/                  # Enum classes (RightEnum, StatusEnum, etc.)
├── Exceptions/             # Custom exception handlers
├── Exports/                # Excel export classes (maatwebsite/excel)
├── Helpers/                # Global helper functions
│   └── general.php        # Shared utility functions
├── Http/                   # HTTP layer
│   ├── Controllers/       # Request handlers
│   │   └── Api/          # 99 API controllers
│   ├── Middleware/        # Request middleware
│   └── Requests/          # Form validation classes
├── Imports/                # Excel import classes
├── Jobs/                   # Queue job classes
├── Mail/                   # Email mailable classes
├── Managers/               # Cross-cutting managers
│   ├── RightManager.php   # Permission management
│   └── ResponsibilityManager.php
├── Models/                 # Eloquent ORM models (131 models)
├── Notifications/          # Laravel notification classes
├── Policies/               # Authorization policies
├── Providers/              # Service providers
│   ├── AppServiceProvider.php
│   └── EventServiceProvider.php
├── Services/               # Business logic services
└── Traits/                 # Reusable model traits

Critical Directories

1. /app/Http/Controllers/Api - API Controllers (99 files)

Purpose: Handle HTTP requests and return JSON responses

Structure: Api/ ├── UserController.php # User management ├── DepartmentController.php # Department CRUD ├── RoleController.php # Role management ├── DealController.php # CRM deals ├── OrganizationController.php # CRM organizations ├── PersonController.php # CRM contacts ├── TaskController.php # Task management ├── ProjectController.php # Project CRUD ├── ProcedureController.php # Business procedures ├── VacationDayController.php # Vacation requests ├── AssetManagementController.php # Asset tracking ├── AIController.php # AI features └── ... (86 more controllers)

Naming Convention: {Resource}Controller.php


2. /app/Models - Eloquent Models (131 models)

Purpose: Database ORM, relationships, business logic

Key Models by Module:

HR Module: - User.php - Employee/user accounts (100+ relationships) - Department.php - Organizational units - Role.php - Job positions (NOT permissions) - Right.php - Permissions - UserFile.php - Employee documents - Evaluation.php - Performance reviews - Skill.php - Skills catalog

CRM Module: - Deal.php - Sales deals - Organization.php - Companies/clients - Person.php - Individual contacts - Pipeline.php - Sales pipelines - Stage.php - Deal stages

Projects Module: - Project.php - Projects - Task.php - Tasks - Meeting.php - Meetings - TaskTimer.php - Time tracking

Shared/Polymorphic: - Comment.php - Universal commenting - Tag.php - Tagging system - NotificationLog.php - In-app notifications - ModelHistory.php - Audit trail - CustomField.php - Dynamic fields - CustomFieldValue.php - Field values


3. /database/migrations - Database Schema (368 migrations)

Purpose: Version-controlled database schema

Organization: - Chronologically ordered (timestamp prefix) - Create tables, alter tables, add indexes - Foreign key constraints

Example: 2024_01_01_000000_create_users_table.php 2024_01_01_000001_create_departments_table.php 2024_01_02_120000_add_parent_id_to_departments_table.php


4. /app/Enums - Enum Classes

Purpose: Type-safe constants

Key Enums: - RightEnum.php - Permission constants (MASTER_ADMIN, ADMIN_CRM, etc.) - StatusEnum.php - Status values (ACTIVE, INACTIVE, etc.) - ScopeEnum.php - Permission scopes (NONE, OWN, DEPARTMENT_DOWN, ALL)


5. /app/Managers - Cross-Cutting Logic

Purpose: Shared business logic across modules

Managers: - RightManager.php - Centralized permission checks - ResponsibilityManager.php - Role responsibility management - Other domain-specific managers


6. /routes - Route Definitions

routes/
├── api.php            # API routes (~1,775 lines)
├── web.php            # Web routes (minimal, mainly for OAuth callbacks)
└── channels.php       # Broadcasting channels

api.php Structure: ```php Route::middleware([‘auth:sanctum’])->group(function () { // HR Routes Route::apiResource(‘users’, UserController::class); Route::apiResource(‘departments’, DepartmentController::class);

// CRM Routes
Route::apiResource('deals', DealController::class);
Route::apiResource('organizations', OrganizationController::class);

// ... 90+ more resource routes

}); ```


Configuration (/config)

Key Config Files:

config/
├── app.php                 # Application config
├── auth.php                # Authentication guards
├── database.php            # Database connections
├── filesystems.php         # Storage (S3, local)
├── mail.php                # Email config
├── queue.php               # Queue drivers
├── sanctum.php             # API authentication
├── scout.php               # Search config (Meilisearch)
└── websockets.php          # WebSocket server config

Frontend Assets (/resources)

resources/
├── css/                    # CSS files (compiled by Mix)
├── js/                     # JavaScript files
│   ├── app.js             # Main JS entry point
│   └── bootstrap.js       # Dependencies (Axios, Lodash)
├── lang/                   # Translations (5 languages)
│   ├── de/                # German
│   ├── en/                # English
│   ├── es/                # Spanish
│   ├── it/                # Italian
│   └── ro/                # Romanian
└── views/                  # Blade templates
    ├── emails/            # Email templates
    └── pdf/               # PDF templates (DomPDF)

Note: Minimal Blade usage - mainly for PDF generation and email templates. Frontend UI is VueJS (separate repo).


Public Assets (/public)

public/
├── index.php               # Application entry point
├── fonts/                  # Font files
├── images-pdf/             # Images for PDF generation
├── proforma/               # Proforma templates
└── ... (compiled CSS/JS from Laravel Mix)

BMAD System (/bmad)

Purpose: Meta-programming system for AI-assisted development

bmad/
├── _cfg/                   # Agent customization
├── bmb/                    # BMAD Builder module
│   ├── agents/            # Meta-agents
│   ├── workflows/         # Workflow definitions
│   └── config.yaml        # Module config
├── bmm/                    # BMAD Method Module
│   ├── workflows/         # Analysis, planning, solutioning workflows
│   ├── tasks/             # Task definitions
│   └── testarch/          # Testing knowledge base
├── core/                   # BMAD core system
│   ├── agents/            # Core agents
│   ├── tasks/             # Core task definitions
│   └── workflows/         # Core workflows
└── docs/                   # BMAD documentation

Note: This is a meta-system for generating documentation and managing development workflows.


Previous Documentation (/docs-old)

Contains: - modules/ - 8 module documentation files (~412 KB) - shared-models/ - 5 core model documentation files (~192 KB) - architecture/ - Architecture diagrams and documents - patterns/ - Design pattern documentation - technical/ - Tech stack, deployment guides

Total: 13 comprehensive markdown files (~604 KB)


Tests (/tests)

tests/
├── Feature/                # Feature/integration tests
│   ├── UserTest.php
│   ├── DealTest.php
│   └── ...
└── Unit/                   # Unit tests
    ├── Models/
    ├── Services/
    └── ...

Test Strategy: - Feature tests for API endpoints - Unit tests for models and services - Factories for test data generation


Entry Points & Critical Files

Application Entry

File Purpose
public/index.php Web server entry point
artisan CLI entry point
routes/api.php API route definitions

Configuration

File Purpose
.env Environment variables (NOT in git)
.env.example Environment template
composer.json PHP dependencies
package.json JavaScript dependencies

Bootstrap

File Purpose
bootstrap/app.php Application bootstrap
app/Providers/AppServiceProvider.php Service bindings

Key File Counts

Directory File Type Count
/app/Models PHP models 131
/app/Http/Controllers/Api API controllers 99
/database/migrations Migrations 368
/app/Enums Enum classes ~15
/app/Managers Manager classes ~5
/resources/lang/* Translation files ~25 (5 languages)

Excluded from Source Control

.gitignore Excludes: - /vendor - Composer dependencies - /node_modules - npm dependencies - /storage/** - Logs, cache, uploaded files - .env - Environment secrets - /public/hot - Laravel Mix hot reload - /public/storage - Symbolic link


Development Workflow Directories

Generated/Cached Files

storage/
├── app/                    # User uploads, generated files
├── framework/              # Framework cache, sessions
│   ├── cache/
│   ├── sessions/
│   └── views/             # Compiled Blade templates
└── logs/                   # Application logs
    └── laravel.log

Build Artifacts

public/
├── css/                    # Compiled CSS
├── js/                     # Compiled JavaScript
└── mix-manifest.json       # Laravel Mix manifest

Related Documentation


Document Generated: 2025-10-16 Total Directories: 50+ directories Key Entry Points: public/index.php, artisan, routes/api.php