# congodevelopersclub/cdtm-api architecture

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

- Interactive diagram: https://gitdiagram.com/congodevelopersclub/cdtm-api
- Repository: https://github.com/congodevelopersclub/cdtm-api

## Overview

CDTM-API is a Laravel API for user authentication and professional profiles. The main workflow is LinkedIn sign-in, account creation or login, and one-time-code exchange for an API token; authenticated API clients can then browse or update profiles and their skills and projects. Separate endpoints manage categories, skills, and users. Profile updates are validated and delegated to a service that synchronizes related records. The graph follows the sampled controllers, services, models, and route references; unsampled endpoint behavior and persistence wiring are not expanded beyond what the evidence supports.

Main entry points: [`app/Models/Profile.php`](https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Models/Profile.php) (Profile), [`routes/api_v1.php`](https://github.com/congodevelopersclub/cdtm-api/blob/main/routes/api_v1.php) (API v1 routes), [`app/Services/AuthService.php`](https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Services/AuthService.php) (OAuth and tokens), [`app/Http/Controllers/Api/V1/ProfileController.php`](https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Http/Controllers/Api/V1/ProfileController.php) (Profile endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API entry"]
  node_api_routes["API v1 routes<br/>[api_v1.php]"]
  node_bootstrap["Application setup<br/>[app.php]"]
end

subgraph group_auth["Authentication"]
  node_auth_controller["Auth endpoints<br/>[AuthController.php]"]
  node_auth_service["OAuth and tokens<br/>[AuthService.php]"]
  node_mail_service["Welcome mail service<br/>[MailService.php]"]
  node_welcome_mail["Welcome email"]
  node_oauth_error["Invalid code error"]
end

subgraph group_profiles["Profile management"]
  node_profile_controller["Profile endpoints"]
  node_profile_requests["Profile validation"]
  node_validate_request["Status validation"]
  node_profile_service["Profile updates<br/>[ProfileService.php]"]
  node_skill_controller["Skill endpoints"]
  node_skill_resource["Skill response resource"]
  node_category_controller["Category endpoints"]
  node_user_controller["User endpoints<br/>[UserController.php]"]
end

subgraph group_domain["Domain data"]
  node_user[("User account<br/>[User.php]")]
  node_profile[("Profile<br/>[Profile.php]")]
  node_skill[("Skill<br/>[Skill.php]")]
  node_skill_profile[("Profile skill link<br/>[SkillProfile.php]")]
  node_project[("Project<br/>[Project.php]")]
  node_category[("Category<br/>[Category.php]")]
  node_account_status["Account status"]
end

node_client(("API client"))
node_linkedin["LinkedIn OAuth"]
node_frontend["Frontend callback"]

node_client -->|"calls API"| node_api_routes
node_api_routes -->|"routes to"| node_auth_controller
node_api_routes -->|"routes to"| node_profile_controller
node_api_routes -->|"routes to"| node_skill_controller
node_api_routes -->|"routes to"| node_category_controller
node_api_routes -->|"routes to"| node_user_controller
node_bootstrap -->|"loads routes"| node_api_routes
node_bootstrap -->|"renders errors"| node_oauth_error
node_auth_controller -->|"delegates auth"| node_auth_service
node_auth_service -->|"authenticates with"| node_linkedin
node_auth_controller -->|"redirects callback"| node_frontend
node_auth_service -->|"creates and loads"| node_user
node_auth_service -->|"sends welcome mail"| node_mail_service
node_mail_service -->|"queues message"| node_welcome_mail
node_auth_service -->|"throws invalid code"| node_oauth_error
node_auth_controller -->|"uses account"| node_user
node_profile_controller -->|"delegates updates"| node_profile_service
node_profile_controller -->|"validates updates"| node_profile_requests
node_profile_controller -->|"validates status"| node_validate_request
node_profile_controller -->|"reads profiles"| node_profile
node_profile_service -->|"updates profile"| node_profile
node_profile_service -->|"syncs skills"| node_skill
node_profile_service -->|"syncs projects"| node_project
node_profile -->|"uses pivot"| node_skill_profile
node_profile -->|"casts status"| node_account_status
node_profile -->|"belongs to"| node_user
node_profile -->|"belongs to"| node_category
node_profile -->|"has projects"| node_project
node_profile -->|"has skills"| node_skill
node_skill_controller -->|"uses skill data"| node_skill
node_skill_controller -->|"formats response"| node_skill_resource
node_category_controller -->|"uses categories"| node_category
node_user_controller -->|"uses accounts"| node_user

click node_api_routes "https://github.com/congodevelopersclub/cdtm-api/blob/main/routes/api_v1.php"
click node_bootstrap "https://github.com/congodevelopersclub/cdtm-api/blob/main/bootstrap/app.php"
click node_auth_controller "https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Http/Controllers/Api/V1/AuthController.php"
click node_auth_service "https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Services/AuthService.php"
click node_mail_service "https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Services/MailService.php"
click node_welcome_mail "https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Mail/WelcomeUserMail.php"
click node_oauth_error "https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Exceptions/InvalidOAuthCodeException.php"
click node_profile_controller "https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Http/Controllers/Api/V1/ProfileController.php"
click node_profile_requests "https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Http/Requests/UpdateProfileRequest.php"
click node_validate_request "https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Http/Requests/ValidateProfileRequest.php"
click node_profile_service "https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Services/ProfileService.php"
click node_skill_controller "https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Http/Controllers/Api/V1/SkillController.php"
click node_skill_resource "https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Http/Resources/SkillListResource.php"
click node_category_controller "https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Http/Controllers/Api/V1/CategoryController.php"
click node_user_controller "https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Http/Controllers/Api/V1/UserController.php"
click node_user "https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Models/User.php"
click node_profile "https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Models/Profile.php"
click node_skill "https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Models/Skill.php"
click node_skill_profile "https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Models/SkillProfile.php"
click node_project "https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Models/Project.php"
click node_category "https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Models/Category.php"
click node_account_status "https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Enums/ProfileAccountStatus.php"

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_api_routes,node_bootstrap,node_client,node_frontend toneBlue
class node_auth_controller,node_auth_service,node_mail_service,node_welcome_mail,node_oauth_error toneAmber
class node_profile_controller,node_profile_requests,node_validate_request,node_profile_service,node_skill_controller,node_skill_resource,node_category_controller,node_user_controller toneMint
class node_user,node_profile,node_skill,node_skill_profile,node_project,node_category,node_account_status toneRose
class node_linkedin toneIndigo
```

## Components

### API entry

- [API v1 routes](https://github.com/congodevelopersclub/cdtm-api/blob/main/routes/api_v1.php): `routes/api_v1.php`
- [Application setup](https://github.com/congodevelopersclub/cdtm-api/blob/main/bootstrap/app.php): `bootstrap/app.php`

### Authentication

- [Auth endpoints](https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Http/Controllers/Api/V1/AuthController.php): `app/Http/Controllers/Api/V1/AuthController.php`
- [OAuth and tokens](https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Services/AuthService.php): `app/Services/AuthService.php`
- [Welcome mail service](https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Services/MailService.php): `app/Services/MailService.php`
- [Welcome email](https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Mail/WelcomeUserMail.php): `app/Mail/WelcomeUserMail.php`
- [Invalid code error](https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Exceptions/InvalidOAuthCodeException.php): `app/Exceptions/InvalidOAuthCodeException.php`

### Profile management

- [Profile endpoints](https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Http/Controllers/Api/V1/ProfileController.php): `app/Http/Controllers/Api/V1/ProfileController.php`
- [Profile validation](https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Http/Requests/UpdateProfileRequest.php): `app/Http/Requests/UpdateProfileRequest.php`
- [Status validation](https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Http/Requests/ValidateProfileRequest.php): `app/Http/Requests/ValidateProfileRequest.php`
- [Profile updates](https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Services/ProfileService.php): `app/Services/ProfileService.php`
- [Skill endpoints](https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Http/Controllers/Api/V1/SkillController.php): `app/Http/Controllers/Api/V1/SkillController.php`
- [Skill response resource](https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Http/Resources/SkillListResource.php): `app/Http/Resources/SkillListResource.php`
- [Category endpoints](https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Http/Controllers/Api/V1/CategoryController.php): `app/Http/Controllers/Api/V1/CategoryController.php`
- [User endpoints](https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Http/Controllers/Api/V1/UserController.php): `app/Http/Controllers/Api/V1/UserController.php`

### Domain data

- [User account](https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Models/User.php): `app/Models/User.php`
- [Profile](https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Models/Profile.php): `app/Models/Profile.php`
- [Skill](https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Models/Skill.php): `app/Models/Skill.php`
- [Profile skill link](https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Models/SkillProfile.php): `app/Models/SkillProfile.php`
- [Project](https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Models/Project.php): `app/Models/Project.php`
- [Category](https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Models/Category.php): `app/Models/Category.php`
- [Account status](https://github.com/congodevelopersclub/cdtm-api/blob/main/app/Enums/ProfileAccountStatus.php): `app/Enums/ProfileAccountStatus.php`

### Other components

- **API client**
- **LinkedIn OAuth**
- **Frontend callback**

## Connections

- API client → API v1 routes: calls API (evidence: `routes/api_v1.php`)
- API v1 routes → Auth endpoints: routes to (evidence: `routes/api_v1.php`)
- API v1 routes → Profile endpoints: routes to (evidence: `routes/api_v1.php`)
- API v1 routes → Skill endpoints: routes to (evidence: `routes/api_v1.php`)
- API v1 routes → Category endpoints: routes to (evidence: `routes/api_v1.php`)
- API v1 routes → User endpoints: routes to (evidence: `routes/api_v1.php`)
- Application setup → API v1 routes: loads routes (evidence: `bootstrap/app.php`)
- Application setup → Invalid code error: renders errors (evidence: `bootstrap/app.php`)
- Auth endpoints → OAuth and tokens: delegates auth (evidence: `app/Http/Controllers/Api/V1/AuthController.php`)
- OAuth and tokens → LinkedIn OAuth: authenticates with (evidence: `app/Services/AuthService.php`)
- Auth endpoints → Frontend callback: redirects callback (evidence: `app/Http/Controllers/Api/V1/AuthController.php`)
- OAuth and tokens → User account: creates and loads (evidence: `app/Services/AuthService.php`)
- OAuth and tokens → Welcome mail service: sends welcome mail (evidence: `app/Services/AuthService.php`)
- Welcome mail service → Welcome email: queues message (evidence: `app/Services/MailService.php`)
- OAuth and tokens → Invalid code error: throws invalid code (evidence: `app/Services/AuthService.php`)
- Auth endpoints → User account: uses account (evidence: `app/Http/Controllers/Api/V1/AuthController.php`)
- Profile endpoints → Profile updates: delegates updates (evidence: `app/Http/Controllers/Api/V1/ProfileController.php`)
- Profile endpoints → Profile validation: validates updates (evidence: `app/Http/Controllers/Api/V1/ProfileController.php`)
- Profile endpoints → Status validation: validates status (evidence: `app/Http/Controllers/Api/V1/ProfileController.php`)
- Profile endpoints → Profile: reads profiles (evidence: `app/Http/Controllers/Api/V1/ProfileController.php`)
- Profile updates → Profile: updates profile (evidence: `app/Services/ProfileService.php`)
- Profile updates → Skill: syncs skills (evidence: `app/Services/ProfileService.php`)
- Profile updates → Project: syncs projects (evidence: `app/Services/ProfileService.php`)
- Profile → Profile skill link: uses pivot (evidence: `app/Models/Profile.php`)
- Profile → Account status: casts status (evidence: `app/Models/Profile.php`)
- Profile → User account: belongs to (evidence: `app/Models/Profile.php`)
- Profile → Category: belongs to (evidence: `app/Models/Profile.php`)
- Profile → Project: has projects (evidence: `app/Models/Profile.php`)
- Profile → Skill: has skills (evidence: `app/Models/Profile.php`)
- Skill endpoints → Skill: uses skill data (evidence: `app/Http/Controllers/Api/V1/SkillController.php`)
- Skill endpoints → Skill response resource: formats response (evidence: `app/Http/Controllers/Api/V1/SkillController.php`)
- Category endpoints → Category: uses categories (evidence: `app/Http/Controllers/Api/V1/CategoryController.php`)
- User endpoints → User account: uses accounts (evidence: `app/Http/Controllers/Api/V1/UserController.php`)
