# moemadeldin/applyai architecture

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

- Interactive diagram: https://gitdiagram.com/moemadeldin/applyai
- Repository: https://github.com/moemadeldin/applyai

## Overview

ApplyAI is a Laravel API for managing job applications with AI-assisted resume evaluation and preparation. The principal workflow is: an authenticated user submits job text or a URL; the API fetches pages when needed, records a vacancy and application, and queues processing; results are then available through the API. Separate capabilities include resume upload and PDF extraction, cover-letter and mock-interview generation, account/profile management, and dashboard statistics. The graph reflects documented capabilities and shown dispatches; unsampled implementation links are omitted or marked unverified.

Main entry points: [`routes/auth_api.php`](https://github.com/moemadeldin/applyai/blob/main/routes/auth_api.php) (API routes), [`app/Http/Controllers/API/V1/CustomJobVacancyController.php`](https://github.com/moemadeldin/applyai/blob/main/app/Http/Controllers/API/V1/CustomJobVacancyController.php) (Vacancy API), [`app/Jobs/ProcessCustomJobVacancyJob.php`](https://github.com/moemadeldin/applyai/blob/main/app/Jobs/ProcessCustomJobVacancyJob.php) (Background queue), [`app/Services/GeminiClient.php`](https://github.com/moemadeldin/applyai/blob/main/app/Services/GeminiClient.php) (Gemini client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and API"]
  node_api_routes["API routes<br/>[auth_api.php]"]
  node_session["Session API"]
  node_login["Login action<br/>[LoginAction.php]"]
  node_tokens["Token manager<br/>[TokenManager.php]"]
  node_resume_api["Resume API"]
end

subgraph group_jobflow["Job application workflow"]
  node_vacancy_api["Vacancy API"]
  node_fetch_page["Job page fetch"]
  node_queue["Background queue"]
  node_create_vacancy["Vacancy creation"]
  node_application_api["Application API"]
  node_mock_api["Mock interview API"]
  node_dashboard["Dashboard statistics"]
end

subgraph group_ai["AI services"]
  node_ai_eval["Resume evaluation"]
  node_gemini["Gemini client<br/>[GeminiClient.php]"]
  node_openai_client["Compatible AI client"]
  node_cover_letter["Cover-letter generation"]
  node_interview["Mock interview generation"]
end

subgraph group_data["Domain and storage"]
  node_user_model["User account<br/>[User.php]"]
  node_resume_model[("Resume records<br/>[Resume.php]")]
  node_vacancy_model[("Vacancy records")]
  node_application_model[("Application records")]
end

node_user_actor(("User"))
node_gemini_service{{"Google Gemini"}}
node_openrouter_service{{"OpenRouter fallback"}}
node_database[("Relational database")]

node_user_actor -->|"calls"| node_api_routes
node_api_routes -->|"routes to"| node_session
node_session -->|"invokes"| node_login
node_login -->|"creates token"| node_tokens
node_tokens -->|"issues token"| node_user_model
node_api_routes -->|"routes to"| node_vacancy_api
node_vacancy_api -->|"fetches URL"| node_fetch_page
node_vacancy_api -->|"creates vacancy"| node_vacancy_model
node_vacancy_api -->|"creates application"| node_application_model
node_vacancy_api -->|"dispatches"| node_queue
node_queue -->|"invokes"| node_create_vacancy
node_queue -->|"updates status"| node_vacancy_model
node_queue -->|"updates results"| node_application_model
node_user_actor -->|"uploads resume"| node_resume_api
node_resume_api -.->|"stores resume"| node_resume_model
node_user_actor -->|"requests letter"| node_cover_letter
node_user_actor -->|"requests practice"| node_interview
node_user_actor -->|"views results"| node_application_api
node_api_routes -->|"routes to"| node_application_api
node_api_routes -->|"routes to"| node_mock_api
node_api_routes -->|"routes to"| node_dashboard
node_vacancy_model -.->|"persists in"| node_database
node_application_model -.->|"persists in"| node_database
node_resume_model -.->|"persists in"| node_database
node_ai_eval -.->|"uses"| node_gemini
node_gemini -->|"calls"| node_gemini_service
node_gemini -->|"fallbacks to"| node_openai_client
node_openai_client -.->|"calls optionally"| node_openrouter_service

click node_api_routes "https://github.com/moemadeldin/applyai/blob/main/routes/auth_api.php"
click node_session "https://github.com/moemadeldin/applyai/blob/main/app/Http/Controllers/API/V1/Auth/SessionController.php"
click node_login "https://github.com/moemadeldin/applyai/blob/main/app/Actions/Auth/LoginAction.php"
click node_tokens "https://github.com/moemadeldin/applyai/blob/main/app/Services/TokenManager.php"
click node_user_model "https://github.com/moemadeldin/applyai/blob/main/app/Models/User.php"
click node_resume_api "https://github.com/moemadeldin/applyai/blob/main/app/Http/Controllers/API/V1/ResumeController.php"
click node_resume_model "https://github.com/moemadeldin/applyai/blob/main/app/Models/Resume.php"
click node_vacancy_api "https://github.com/moemadeldin/applyai/blob/main/app/Http/Controllers/API/V1/CustomJobVacancyController.php"
click node_fetch_page "https://github.com/moemadeldin/applyai/blob/main/app/Services/FetchJobPageService.php"
click node_queue "https://github.com/moemadeldin/applyai/blob/main/app/Jobs/ProcessCustomJobVacancyJob.php"
click node_create_vacancy "https://github.com/moemadeldin/applyai/blob/main/app/Actions/CustomJobVacancy/CreateCustomJobVacancyAction.php"
click node_vacancy_model "https://github.com/moemadeldin/applyai/blob/main/app/Models/CustomJobVacancy.php"
click node_application_model "https://github.com/moemadeldin/applyai/blob/main/app/Models/CustomJobApplication.php"
click node_ai_eval "https://github.com/moemadeldin/applyai/blob/main/app/Services/EvaluateResumeWithAIService.php"
click node_gemini "https://github.com/moemadeldin/applyai/blob/main/app/Services/GeminiClient.php"
click node_openai_client "https://github.com/moemadeldin/applyai/blob/main/app/Services/OpenAiCompatibleClient.php"
click node_cover_letter "https://github.com/moemadeldin/applyai/blob/main/app/Services/GenerateCoverLetterService.php"
click node_interview "https://github.com/moemadeldin/applyai/blob/main/app/Services/GenerateMockInterviewQAService.php"
click node_application_api "https://github.com/moemadeldin/applyai/blob/main/app/Http/Controllers/API/V1/CustomApplicationController.php"
click node_mock_api "https://github.com/moemadeldin/applyai/blob/main/app/Http/Controllers/API/V1/CustomMockInterviewController.php"
click node_dashboard "https://github.com/moemadeldin/applyai/blob/main/app/Queries/DashboardStatsQuery.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_session,node_login,node_tokens,node_resume_api,node_user_actor toneBlue
class node_vacancy_api,node_fetch_page,node_queue,node_create_vacancy,node_application_api,node_mock_api,node_dashboard,node_database toneAmber
class node_ai_eval,node_gemini,node_openai_client,node_cover_letter,node_interview,node_openrouter_service toneMint
class node_user_model,node_resume_model,node_vacancy_model,node_application_model toneRose
class node_gemini_service toneIndigo
```

## Components

### Access and API

- [API routes](https://github.com/moemadeldin/applyai/blob/main/routes/auth_api.php): `routes/auth_api.php`
- [Session API](https://github.com/moemadeldin/applyai/blob/main/app/Http/Controllers/API/V1/Auth/SessionController.php): `app/Http/Controllers/API/V1/Auth/SessionController.php`
- [Login action](https://github.com/moemadeldin/applyai/blob/main/app/Actions/Auth/LoginAction.php): `app/Actions/Auth/LoginAction.php`
- [Token manager](https://github.com/moemadeldin/applyai/blob/main/app/Services/TokenManager.php): `app/Services/TokenManager.php`
- [Resume API](https://github.com/moemadeldin/applyai/blob/main/app/Http/Controllers/API/V1/ResumeController.php): `app/Http/Controllers/API/V1/ResumeController.php`

### Job application workflow

- [Vacancy API](https://github.com/moemadeldin/applyai/blob/main/app/Http/Controllers/API/V1/CustomJobVacancyController.php): `app/Http/Controllers/API/V1/CustomJobVacancyController.php`
- [Job page fetch](https://github.com/moemadeldin/applyai/blob/main/app/Services/FetchJobPageService.php): `app/Services/FetchJobPageService.php`
- [Background queue](https://github.com/moemadeldin/applyai/blob/main/app/Jobs/ProcessCustomJobVacancyJob.php): `app/Jobs/ProcessCustomJobVacancyJob.php`
- [Vacancy creation](https://github.com/moemadeldin/applyai/blob/main/app/Actions/CustomJobVacancy/CreateCustomJobVacancyAction.php): `app/Actions/CustomJobVacancy/CreateCustomJobVacancyAction.php`
- [Application API](https://github.com/moemadeldin/applyai/blob/main/app/Http/Controllers/API/V1/CustomApplicationController.php): `app/Http/Controllers/API/V1/CustomApplicationController.php`
- [Mock interview API](https://github.com/moemadeldin/applyai/blob/main/app/Http/Controllers/API/V1/CustomMockInterviewController.php): `app/Http/Controllers/API/V1/CustomMockInterviewController.php`
- [Dashboard statistics](https://github.com/moemadeldin/applyai/blob/main/app/Queries/DashboardStatsQuery.php): `app/Queries/DashboardStatsQuery.php`

### AI services

- [Resume evaluation](https://github.com/moemadeldin/applyai/blob/main/app/Services/EvaluateResumeWithAIService.php): `app/Services/EvaluateResumeWithAIService.php`
- [Gemini client](https://github.com/moemadeldin/applyai/blob/main/app/Services/GeminiClient.php): `app/Services/GeminiClient.php`
- [Compatible AI client](https://github.com/moemadeldin/applyai/blob/main/app/Services/OpenAiCompatibleClient.php): `app/Services/OpenAiCompatibleClient.php`
- [Cover-letter generation](https://github.com/moemadeldin/applyai/blob/main/app/Services/GenerateCoverLetterService.php): `app/Services/GenerateCoverLetterService.php`
- [Mock interview generation](https://github.com/moemadeldin/applyai/blob/main/app/Services/GenerateMockInterviewQAService.php): `app/Services/GenerateMockInterviewQAService.php`

### Domain and storage

- [User account](https://github.com/moemadeldin/applyai/blob/main/app/Models/User.php): `app/Models/User.php`
- [Resume records](https://github.com/moemadeldin/applyai/blob/main/app/Models/Resume.php): `app/Models/Resume.php`
- [Vacancy records](https://github.com/moemadeldin/applyai/blob/main/app/Models/CustomJobVacancy.php): `app/Models/CustomJobVacancy.php`
- [Application records](https://github.com/moemadeldin/applyai/blob/main/app/Models/CustomJobApplication.php): `app/Models/CustomJobApplication.php`

### Other components

- **User**
- **Google Gemini**
- **OpenRouter fallback**
- **Relational database**

## Connections

- User → API routes: calls (evidence: `README.md`)
- API routes → Session API: routes to (evidence: `routes/auth_api.php`)
- Session API → Login action: invokes (evidence: `app/Http/Controllers/API/V1/Auth/SessionController.php`)
- Login action → Token manager: creates token (evidence: `app/Actions/Auth/LoginAction.php`)
- Token manager → User account: issues token (evidence: `app/Services/TokenManager.php`)
- API routes → Vacancy API: routes to (evidence: `routes/auth_api.php`)
- Vacancy API → Job page fetch: fetches URL (evidence: `app/Http/Controllers/API/V1/CustomJobVacancyController.php`)
- Vacancy API → Vacancy records: creates vacancy (evidence: `app/Http/Controllers/API/V1/CustomJobVacancyController.php`)
- Vacancy API → Application records: creates application (evidence: `app/Http/Controllers/API/V1/CustomJobVacancyController.php`)
- Vacancy API → Background queue: dispatches (evidence: `app/Http/Controllers/API/V1/CustomJobVacancyController.php`)
- Background queue → Vacancy creation: invokes (evidence: `app/Jobs/ProcessCustomJobVacancyJob.php`)
- Background queue → Vacancy records: updates status (evidence: `app/Jobs/ProcessCustomJobVacancyJob.php`)
- Background queue → Application records: updates results (evidence: `app/Jobs/ProcessCustomJobVacancyJob.php`)
- User → Resume API: uploads resume (evidence: `README.md`)
- Resume API → Resume records: stores resume
- User → Cover-letter generation: requests letter (evidence: `README.md`)
- User → Mock interview generation: requests practice (evidence: `README.md`)
- User → Application API: views results
- API routes → Application API: routes to (evidence: `routes/auth_api.php`)
- API routes → Mock interview API: routes to (evidence: `routes/auth_api.php`)
- API routes → Dashboard statistics: routes to (evidence: `routes/auth_api.php`)
- Vacancy records → Relational database: persists in
- Application records → Relational database: persists in
- Resume records → Relational database: persists in
- Resume evaluation → Gemini client: uses
- Gemini client → Google Gemini: calls (evidence: `README.md`)
- Gemini client → Compatible AI client: fallbacks to (evidence: `app/Services/GeminiClient.php`)
- Compatible AI client → OpenRouter fallback: calls optionally (evidence: `README.md`)
