# alasti2/bijan architecture

> Architecture diagram of the GitHub repository alasti2/bijan, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/alasti2/bijan
- Repository: https://github.com/alasti2/bijan

## Overview

#### Purpose and Runtime
A Laravel 12 server-rendered workflow-management system for Persian/RTL organizational processes. It manages departments, multi-step workflows, tasks, task assignees/comments, dashboards, and role-based access. It runs on PHP 8.2+ with SQLite or MySQL; Laravel’s configurable cache, session, mail, filesystem, logging, and queue subsystems are available through `config/`.

Entry points are the HTTP front controller at `public/index.php`, framework bootstrap at `bootstrap/app.php`, web route definitions at `routes/web.php`, and CLI operations through `artisan`.

#### HTTP Routing and Presentation
`routes/web.php` maps browser requests to controllers and applies authentication and role middleware. Controllers render Blade pages rather than exposing a separate API layer:
- `app/Http/Controllers/HomeController.php`
- `app/Http/Controllers/DashboardController.php`
- `resources/views/layouts/app.blade.php`

Feature pages are partitioned by domain under `resources/views/departments/`, `resources/views/workflows/`, and `resources/views/tasks/`. Frontend assets are built through Vite from `resources/js/app.js` and `resources/css/app.css`.

#### Authentication, Localization, and Authorization
Laravel authentication lifecycle—login, registration, password reset/confirmation, and email verification—is implemented by dedicated controllers in `app/Http/Controllers/Auth/`. User identity and role/department affiliation are persisted in `app/Models/User.php`.

Authorization is an explicit HTTP boundary: `app/Http/Middleware/CheckRole.php` enforces role access, while framework `auth` middleware establishes authenticated identity. Department management is restricted to manager/admin; workflow and task mutation to supervisor/manager/admin. `app/Http/Middleware/SetLocale.php` supports localized presentation.

#### Organizational and Workflow Model
Departments organize users and processes; workflows contain ordered steps. Core persistence/domain entities are:
- `app/Models/Department.php`
- `app/Models/Workflow.php`
- `app/Models/WorkflowStep.php`

Their schema is defined by `database/migrations/2025_08_24_115127_create_departments_table.php`, `database/migrations/2025_08_24_115130_create_workflows_table.php`, and `database/migrations/2025_08_24_115133_create_workflow_steps_table.php`. `DepartmentController` and `WorkflowController` own CRUD-oriented HTTP flows for these aggregates.

#### Task Execution and Collaboration
Tasks are operational instances associated with the workflow domain and support assignment and discussion:
- `app/Models/Task.php`
- `app/Models/TaskAssignment.php`
- `app/Models/TaskComment.php`

`app/Http/Controllers/TaskController.php` handles task creation, editing, display, and assignment-facing flows. The expected control path is authenticated/authorized request → controller validation/orchestration → Eloquent model persistence → redirect or Blade render. Task-related schema lives in `database/migrations/2025_08_24_115135_create_tasks_table.php`, `database/migrations/2025_08_24_115137_create_task_assignments_table.php`, and `database/migrations/2025_08_24_115141_create_task_comments_table.php`.

#### Dashboard and Reporting Boundary
The dashboard is the cross-domain read surface for authenticated users, implemented by `app/Http/Controllers/DashboardController.php` and `resources/views/dashboard/index.blade.php`. It should remain a query/composition layer over departments, workflows, and tasks rather than becoming the owner of mutation logic.

#### Database Provisioning and External Boundaries
Laravel Eloquent accesses SQLite/MySQL using `config/database.php`; migrations establish application and framework tables, including users, cache, and jobs. Seeders establish demo roles and representative domain data:
- `database/seeders/UserSeeder.php`
- `database/seeders/WorkflowSeeder.php`
- `database/seeders/TaskSeeder.php`

External/infrastructure integrations are configuration-driven rather than repository-specific: mail (`config/mail.php`), queues (`config/queue.php`), file storage (`config/filesystems.php`), and session/cache backends. Runtime-generated sessions, caches, compiled views, logs, and private/public files reside under `storage/`.

Main entry points: [`app/Http/Middleware/CheckRole.php`](https://github.com/alasti2/bijan/blob/main/app/Http/Middleware/CheckRole.php) (Auth, Role & Locale), [`config/database.php`](https://github.com/alasti2/bijan/blob/main/config/database.php) (SQLite / MySQL), [`app/Http/Controllers/DashboardController.php`](https://github.com/alasti2/bijan/blob/main/app/Http/Controllers/DashboardController.php) (Dashboard Controller), [`resources/views/layouts/app.blade.php`](https://github.com/alasti2/bijan/blob/main/resources/views/layouts/app.blade.php) (Blade Pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Laravel Runtime"]
  node_front_controller["HTTP Front Controller<br/>PHP entry point<br/>[index.php]"]
  node_bootstrap["Application Bootstrap<br/>Laravel bootstrap<br/>[app.php]"]
  node_artisan["Artisan CLI<br/>CLI entry point"]
  node_laravel_services["Configured Laravel Services<br/>infrastructure services<br/>[queue.php]"]
  node_storage["Runtime Storage<br/>generated data"]
end

subgraph group_http["HTTP &amp; Presentation"]
  node_web_routes["Web Routes<br/>route definitions<br/>[web.php]"]
  node_access_middleware["Auth, Role &amp; Locale<br/>HTTP middleware<br/>[CheckRole.php]"]
  node_auth_controllers["Authentication Lifecycle<br/>auth controllers"]
  node_management_controllers["Department &amp; Workflow Controllers<br/>HTTP controllers"]
  node_task_controller["Task Controller<br/>HTTP controller<br/>[TaskController.php]"]
  node_dashboard_controller["Dashboard Controller<br/>read composition"]
  node_blade_views["Blade Pages<br/>server-rendered views<br/>[app.blade.php]"]
  node_frontend_assets["Vite Assets<br/>frontend bundle entry<br/>[app.js]"]
end

subgraph group_domain["Workflow Domain"]
  node_organization_workflow["Departments &amp; Workflows<br/>Eloquent aggregates<br/>[Workflow.php]"]
  node_task_collaboration["Tasks &amp; Collaboration<br/>Eloquent aggregates<br/>[Task.php]"]
  node_user_identity["Users &amp; Roles<br/>Eloquent identity<br/>[User.php]"]
end

subgraph group_persistence["Persistence"]
  node_database[("SQLite / MySQL<br/>application database<br/>[database.php]")]
  node_migrations["Schema Migrations<br/>database schema"]
  node_seeders["Demo Seeders<br/>database provisioning<br/>[TaskSeeder.php]"]
end

node_browser(("Browser<br/>client"))

node_browser -->|"HTTP request"| node_front_controller
node_front_controller -->|"boots"| node_bootstrap
node_bootstrap -->|"loads"| node_web_routes
node_web_routes -->|"applies"| node_access_middleware
node_access_middleware -->|"guards auth flows"| node_auth_controllers
node_access_middleware -->|"authorizes"| node_management_controllers
node_access_middleware -->|"authorizes"| node_task_controller
node_access_middleware -->|"authenticates"| node_dashboard_controller
node_auth_controllers -->|"manages identity"| node_user_identity
node_management_controllers -->|"CRUD"| node_organization_workflow
node_task_controller -->|"persists"| node_task_collaboration
node_dashboard_controller -->|"queries"| node_organization_workflow
node_dashboard_controller -->|"queries"| node_task_collaboration
node_management_controllers -->|"renders"| node_blade_views
node_task_controller -->|"renders / redirects"| node_blade_views
node_dashboard_controller -->|"renders"| node_blade_views
node_organization_workflow -->|"Eloquent persistence"| node_database
node_task_collaboration -->|"Eloquent persistence"| node_database
node_user_identity -->|"Eloquent persistence"| node_database
node_artisan -->|"runs"| node_migrations
node_artisan -->|"runs"| node_seeders
node_migrations -->|"creates schema"| node_database
node_seeders -->|"loads demo data"| node_database
node_bootstrap -->|"configures"| node_laravel_services
node_laravel_services -->|"uses runtime data"| node_storage
node_frontend_assets -->|"bundled assets"| node_blade_views

click node_front_controller "https://github.com/alasti2/bijan/blob/main/public/index.php"
click node_bootstrap "https://github.com/alasti2/bijan/blob/main/bootstrap/app.php"
click node_artisan "https://github.com/alasti2/bijan/blob/main/artisan"
click node_web_routes "https://github.com/alasti2/bijan/blob/main/routes/web.php"
click node_access_middleware "https://github.com/alasti2/bijan/blob/main/app/Http/Middleware/CheckRole.php"
click node_auth_controllers "https://github.com/alasti2/bijan/blob/main/app/Http/Controllers/Auth/LoginController.php"
click node_management_controllers "https://github.com/alasti2/bijan/blob/main/app/Http/Controllers/WorkflowController.php"
click node_task_controller "https://github.com/alasti2/bijan/blob/main/app/Http/Controllers/TaskController.php"
click node_dashboard_controller "https://github.com/alasti2/bijan/blob/main/app/Http/Controllers/DashboardController.php"
click node_blade_views "https://github.com/alasti2/bijan/blob/main/resources/views/layouts/app.blade.php"
click node_frontend_assets "https://github.com/alasti2/bijan/blob/main/resources/js/app.js"
click node_organization_workflow "https://github.com/alasti2/bijan/blob/main/app/Models/Workflow.php"
click node_task_collaboration "https://github.com/alasti2/bijan/blob/main/app/Models/Task.php"
click node_user_identity "https://github.com/alasti2/bijan/blob/main/app/Models/User.php"
click node_database "https://github.com/alasti2/bijan/blob/main/config/database.php"
click node_migrations "https://github.com/alasti2/bijan/blob/main/database/migrations/2025_08_24_115135_create_tasks_table.php"
click node_seeders "https://github.com/alasti2/bijan/blob/main/database/seeders/TaskSeeder.php"
click node_laravel_services "https://github.com/alasti2/bijan/blob/main/config/queue.php"
click node_storage "https://github.com/alasti2/bijan/tree/main/storage"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_front_controller,node_bootstrap,node_artisan,node_laravel_services,node_storage toneBlue
class node_web_routes,node_access_middleware,node_auth_controllers,node_management_controllers,node_task_controller,node_dashboard_controller,node_blade_views,node_frontend_assets toneAmber
class node_organization_workflow,node_task_collaboration,node_user_identity toneMint
class node_database,node_migrations,node_seeders toneRose
class node_browser toneNeutral
```

## Components

### Laravel Runtime

- [HTTP Front Controller](https://github.com/alasti2/bijan/blob/main/public/index.php): PHP entry point · `public/index.php`
- [Application Bootstrap](https://github.com/alasti2/bijan/blob/main/bootstrap/app.php): Laravel bootstrap · `bootstrap/app.php`
- [Artisan CLI](https://github.com/alasti2/bijan/blob/main/artisan): CLI entry point · `artisan`
- [Configured Laravel Services](https://github.com/alasti2/bijan/blob/main/config/queue.php): infrastructure services · Queue, mail, filesystem, session, cache, and logging are configuration-driven. · `config/queue.php`
- [Runtime Storage](https://github.com/alasti2/bijan/tree/main/storage): generated data · Holds sessions, caches, compiled views, logs, and files. · `storage`

### HTTP & Presentation

- [Web Routes](https://github.com/alasti2/bijan/blob/main/routes/web.php): route definitions · `routes/web.php`
- [Auth, Role & Locale](https://github.com/alasti2/bijan/blob/main/app/Http/Middleware/CheckRole.php): HTTP middleware · Establishes identity, role access, and localized presentation. · `app/Http/Middleware/CheckRole.php`
- [Authentication Lifecycle](https://github.com/alasti2/bijan/blob/main/app/Http/Controllers/Auth/LoginController.php): auth controllers · Handles login, registration, recovery, and verification. · `app/Http/Controllers/Auth/LoginController.php`
- [Department & Workflow Controllers](https://github.com/alasti2/bijan/blob/main/app/Http/Controllers/WorkflowController.php): HTTP controllers · Own CRUD flows for organizational structures and workflow definitions. · `app/Http/Controllers/WorkflowController.php`
- [Task Controller](https://github.com/alasti2/bijan/blob/main/app/Http/Controllers/TaskController.php): HTTP controller · Orchestrates task creation, editing, display, and assignment flows. · `app/Http/Controllers/TaskController.php`
- [Dashboard Controller](https://github.com/alasti2/bijan/blob/main/app/Http/Controllers/DashboardController.php): read composition · Cross-domain authenticated reporting surface. · `app/Http/Controllers/DashboardController.php`
- [Blade Pages](https://github.com/alasti2/bijan/blob/main/resources/views/layouts/app.blade.php): server-rendered views · Domain pages render within the application layout. · `resources/views/layouts/app.blade.php`
- [Vite Assets](https://github.com/alasti2/bijan/blob/main/resources/js/app.js): frontend bundle entry · `resources/js/app.js`

### Workflow Domain

- [Departments & Workflows](https://github.com/alasti2/bijan/blob/main/app/Models/Workflow.php): Eloquent aggregates · Departments organize users; workflows contain ordered steps. · `app/Models/Workflow.php`
- [Tasks & Collaboration](https://github.com/alasti2/bijan/blob/main/app/Models/Task.php): Eloquent aggregates · Tasks support assignees and discussion comments. · `app/Models/Task.php`
- [Users & Roles](https://github.com/alasti2/bijan/blob/main/app/Models/User.php): Eloquent identity · Persists user identity and role/department affiliation. · `app/Models/User.php`

### Persistence

- [SQLite / MySQL](https://github.com/alasti2/bijan/blob/main/config/database.php): application database · Stores application, framework, cache, and job tables. · `config/database.php`
- [Schema Migrations](https://github.com/alasti2/bijan/blob/main/database/migrations/2025_08_24_115135_create_tasks_table.php): database schema · Defines organizational, workflow, task, and framework tables. · `database/migrations/2025_08_24_115135_create_tasks_table.php`
- [Demo Seeders](https://github.com/alasti2/bijan/blob/main/database/seeders/TaskSeeder.php): database provisioning · Seeds representative users, workflows, and tasks. · `database/seeders/TaskSeeder.php`

### Other components

- **Browser**: client

## Connections

- Browser → HTTP Front Controller: HTTP request
- HTTP Front Controller → Application Bootstrap: boots
- Application Bootstrap → Web Routes: loads
- Web Routes → Auth, Role & Locale: applies
- Auth, Role & Locale → Authentication Lifecycle: guards auth flows
- Auth, Role & Locale → Department & Workflow Controllers: authorizes
- Auth, Role & Locale → Task Controller: authorizes
- Auth, Role & Locale → Dashboard Controller: authenticates
- Authentication Lifecycle → Users & Roles: manages identity
- Department & Workflow Controllers → Departments & Workflows: CRUD
- Task Controller → Tasks & Collaboration: persists
- Dashboard Controller → Departments & Workflows: queries
- Dashboard Controller → Tasks & Collaboration: queries
- Department & Workflow Controllers → Blade Pages: renders
- Task Controller → Blade Pages: renders / redirects
- Dashboard Controller → Blade Pages: renders
- Departments & Workflows → SQLite / MySQL: Eloquent persistence
- Tasks & Collaboration → SQLite / MySQL: Eloquent persistence
- Users & Roles → SQLite / MySQL: Eloquent persistence
- Artisan CLI → Schema Migrations: runs
- Artisan CLI → Demo Seeders: runs
- Schema Migrations → SQLite / MySQL: creates schema
- Demo Seeders → SQLite / MySQL: loads demo data
- Application Bootstrap → Configured Laravel Services: configures
- Configured Laravel Services → Runtime Storage: uses runtime data
- Vite Assets → Blade Pages: bundled assets
