# polaris-academy/backend-laravel architecture

> Architecture diagram of the GitHub repository polaris-academy/backend-laravel, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/polaris-academy/backend-laravel
- Repository: https://github.com/polaris-academy/backend-laravel

## Overview

Polaris is a Laravel academic learning platform with mobile and web clients. The main student workflow is account/profile setup, browsing structured course content, enrolling, tracking video completion, and earning badges; teachers manage courses and admins oversee access and reporting. Social interaction, notifications, support, and content moderation are parallel capabilities. Source excerpts establish several service and model relationships; broader feature links rely on the README, so unsampled implementation details are not expanded.

Main entry points: [`app/Http/Controllers/API/Mobile/ContentStructureController.php`](https://github.com/polaris-academy/backend-laravel/blob/dev/app/Http/Controllers/API/Mobile/ContentStructureController.php) (Course structure API), [`app/Services/NotificationService.php`](https://github.com/polaris-academy/backend-laravel/blob/dev/app/Services/NotificationService.php) (Notification service), [`app/Models/Enrollment.php`](https://github.com/polaris-academy/backend-laravel/blob/dev/app/Models/Enrollment.php) (Enrollment progress), [`app/Http/Controllers/API/Auth/AuthController.php`](https://github.com/polaris-academy/backend-laravel/blob/dev/app/Http/Controllers/API/Auth/AuthController.php) (Authentication API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Identity and access"]
  node_auth["Authentication API<br/>[AuthController.php]"]
  node_profiles["Profile service<br/>[ProfileService.php]"]
end

subgraph group_learning["Learning experience"]
  node_catalog["Course structure API"]
  node_teacher["Teacher course tools"]
end

subgraph group_community["Community and engagement"]
  node_badges["Badges and streaks<br/>[StudentProfile.php]"]
  node_social["Comments and favorites"]
  node_notifications["Notification service"]
  node_moderation["Content reports"]
  node_support["Support tickets"]
end

subgraph group_operations["Administration and reporting"]
  node_activation["Code redemption"]
  node_activation_api["Activation code API"]
  node_dashboard["Admin dashboard"]
  node_reports["Report exports"]
end

subgraph group_data["Domain data"]
  node_users[("Users and profiles<br/>[User.php]")]
  node_course[("Courses<br/>[Course.php]")]
  node_unit[("Units and materials<br/>[Unit.php]")]
  node_video[("Videos and progress<br/>[Video.php]")]
  node_enrollment[("Enrollment progress<br/>[Enrollment.php]")]
  node_notification_store[("Notification records<br/>[Notification.php]")]
  node_device_tokens[("Device tokens<br/>[DeviceToken.php]")]
end

node_students(("Students and teachers"))
node_mobile["Mobile app"]
node_web["Web dashboard"]
node_firebase["Firebase messaging"]

node_students -->|"use"| node_mobile
node_mobile -->|"authenticate"| node_auth
node_web -.->|"authenticate"| node_auth
node_auth -->|"creates profiles"| node_profiles
node_profiles -->|"creates profiles"| node_users
node_mobile -->|"browse courses"| node_catalog
node_catalog -->|"queries courses"| node_course
node_catalog -->|"loads units"| node_unit
node_catalog -->|"loads videos"| node_video
node_teacher -->|"manages courses"| node_course
node_course -->|"has units"| node_unit
node_unit -->|"has videos"| node_video
node_students -->|"enroll and learn"| node_enrollment
node_enrollment -->|"counts completion"| node_video
node_enrollment -->|"awards progress"| node_badges
node_web -->|"manage codes"| node_activation_api
node_activation_api -->|"redeems codes"| node_activation
node_activation -->|"creates enrollment"| node_enrollment
node_mobile -->|"interact socially"| node_social
node_badges -->|"sends awards"| node_notifications
node_notifications -->|"stores notification"| node_notification_store
node_notifications -->|"loads tokens"| node_device_tokens
node_notifications -->|"pushes alerts"| node_firebase
node_mobile -.->|"report content"| node_moderation
node_mobile -.->|"request support"| node_support
node_web -->|"review activity"| node_dashboard
node_dashboard -.->|"export reports"| node_reports

click node_auth "https://github.com/polaris-academy/backend-laravel/blob/dev/app/Http/Controllers/API/Auth/AuthController.php"
click node_profiles "https://github.com/polaris-academy/backend-laravel/blob/dev/app/Services/ProfileService.php"
click node_users "https://github.com/polaris-academy/backend-laravel/blob/dev/app/Models/User.php"
click node_catalog "https://github.com/polaris-academy/backend-laravel/blob/dev/app/Http/Controllers/API/Mobile/ContentStructureController.php"
click node_teacher "https://github.com/polaris-academy/backend-laravel/blob/dev/app/Http/Controllers/API/Mobile/TeacherProfileController.php"
click node_course "https://github.com/polaris-academy/backend-laravel/blob/dev/app/Models/Course.php"
click node_unit "https://github.com/polaris-academy/backend-laravel/blob/dev/app/Models/Unit.php"
click node_video "https://github.com/polaris-academy/backend-laravel/blob/dev/app/Models/Video.php"
click node_enrollment "https://github.com/polaris-academy/backend-laravel/blob/dev/app/Models/Enrollment.php"
click node_activation "https://github.com/polaris-academy/backend-laravel/blob/dev/app/Services/CodeRedemptionService.php"
click node_activation_api "https://github.com/polaris-academy/backend-laravel/blob/dev/app/Http/Controllers/API/Web/AdminActivationCodeController.php"
click node_badges "https://github.com/polaris-academy/backend-laravel/blob/dev/app/Models/StudentProfile.php"
click node_social "https://github.com/polaris-academy/backend-laravel/blob/dev/app/Http/Controllers/API/Mobile/CommentController.php"
click node_notifications "https://github.com/polaris-academy/backend-laravel/blob/dev/app/Services/NotificationService.php"
click node_moderation "https://github.com/polaris-academy/backend-laravel/tree/dev/app/Http/Controllers/API/Mobile/ContentReport"
click node_support "https://github.com/polaris-academy/backend-laravel/tree/dev/app/Http/Controllers/API/Mobile/SupportTicket"
click node_dashboard "https://github.com/polaris-academy/backend-laravel/blob/dev/app/Http/Controllers/API/Web/AdminDashboardController.php"
click node_reports "https://github.com/polaris-academy/backend-laravel/blob/dev/app/Http/Controllers/API/Web/ReportExportController.php"
click node_notification_store "https://github.com/polaris-academy/backend-laravel/blob/dev/app/Models/Notification.php"
click node_device_tokens "https://github.com/polaris-academy/backend-laravel/blob/dev/app/Models/DeviceToken.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_auth,node_profiles toneBlue
class node_catalog,node_teacher toneAmber
class node_badges,node_social,node_notifications,node_moderation,node_support toneMint
class node_activation,node_activation_api,node_dashboard,node_reports toneRose
class node_users,node_course,node_unit,node_video,node_enrollment,node_notification_store,node_device_tokens,node_students,node_mobile,node_web,node_firebase toneIndigo
```

## Components

### Identity and access

- [Authentication API](https://github.com/polaris-academy/backend-laravel/blob/dev/app/Http/Controllers/API/Auth/AuthController.php): `app/Http/Controllers/API/Auth/AuthController.php`
- [Profile service](https://github.com/polaris-academy/backend-laravel/blob/dev/app/Services/ProfileService.php): `app/Services/ProfileService.php`

### Learning experience

- [Course structure API](https://github.com/polaris-academy/backend-laravel/blob/dev/app/Http/Controllers/API/Mobile/ContentStructureController.php): `app/Http/Controllers/API/Mobile/ContentStructureController.php`
- [Teacher course tools](https://github.com/polaris-academy/backend-laravel/blob/dev/app/Http/Controllers/API/Mobile/TeacherProfileController.php): `app/Http/Controllers/API/Mobile/TeacherProfileController.php`

### Community and engagement

- [Badges and streaks](https://github.com/polaris-academy/backend-laravel/blob/dev/app/Models/StudentProfile.php): `app/Models/StudentProfile.php`
- [Comments and favorites](https://github.com/polaris-academy/backend-laravel/blob/dev/app/Http/Controllers/API/Mobile/CommentController.php): `app/Http/Controllers/API/Mobile/CommentController.php`
- [Notification service](https://github.com/polaris-academy/backend-laravel/blob/dev/app/Services/NotificationService.php): `app/Services/NotificationService.php`
- [Content reports](https://github.com/polaris-academy/backend-laravel/tree/dev/app/Http/Controllers/API/Mobile/ContentReport): `app/Http/Controllers/API/Mobile/ContentReport`
- [Support tickets](https://github.com/polaris-academy/backend-laravel/tree/dev/app/Http/Controllers/API/Mobile/SupportTicket): `app/Http/Controllers/API/Mobile/SupportTicket`

### Administration and reporting

- [Code redemption](https://github.com/polaris-academy/backend-laravel/blob/dev/app/Services/CodeRedemptionService.php): `app/Services/CodeRedemptionService.php`
- [Activation code API](https://github.com/polaris-academy/backend-laravel/blob/dev/app/Http/Controllers/API/Web/AdminActivationCodeController.php): `app/Http/Controllers/API/Web/AdminActivationCodeController.php`
- [Admin dashboard](https://github.com/polaris-academy/backend-laravel/blob/dev/app/Http/Controllers/API/Web/AdminDashboardController.php): `app/Http/Controllers/API/Web/AdminDashboardController.php`
- [Report exports](https://github.com/polaris-academy/backend-laravel/blob/dev/app/Http/Controllers/API/Web/ReportExportController.php): `app/Http/Controllers/API/Web/ReportExportController.php`

### Domain data

- [Users and profiles](https://github.com/polaris-academy/backend-laravel/blob/dev/app/Models/User.php): `app/Models/User.php`
- [Courses](https://github.com/polaris-academy/backend-laravel/blob/dev/app/Models/Course.php): `app/Models/Course.php`
- [Units and materials](https://github.com/polaris-academy/backend-laravel/blob/dev/app/Models/Unit.php): `app/Models/Unit.php`
- [Videos and progress](https://github.com/polaris-academy/backend-laravel/blob/dev/app/Models/Video.php): `app/Models/Video.php`
- [Enrollment progress](https://github.com/polaris-academy/backend-laravel/blob/dev/app/Models/Enrollment.php): `app/Models/Enrollment.php`
- [Notification records](https://github.com/polaris-academy/backend-laravel/blob/dev/app/Models/Notification.php): `app/Models/Notification.php`
- [Device tokens](https://github.com/polaris-academy/backend-laravel/blob/dev/app/Models/DeviceToken.php): `app/Models/DeviceToken.php`

### Other components

- **Students and teachers**
- **Mobile app**
- **Web dashboard**
- **Firebase messaging**

## Connections

- Students and teachers → Mobile app: use
- Mobile app → Authentication API: authenticate
- Web dashboard → Authentication API: authenticate
- Authentication API → Profile service: creates profiles (evidence: `app/Http/Controllers/API/Auth/AuthController.php`)
- Profile service → Users and profiles: creates profiles (evidence: `app/Services/ProfileService.php`)
- Mobile app → Course structure API: browse courses
- Course structure API → Courses: queries courses (evidence: `app/Http/Controllers/API/Mobile/ContentStructureController.php`)
- Course structure API → Units and materials: loads units (evidence: `app/Http/Controllers/API/Mobile/ContentStructureController.php`)
- Course structure API → Videos and progress: loads videos (evidence: `app/Http/Controllers/API/Mobile/ContentStructureController.php`)
- Teacher course tools → Courses: manages courses (evidence: `app/Http/Controllers/API/Mobile/TeacherProfileController.php`)
- Courses → Units and materials: has units (evidence: `app/Models/Course.php`)
- Units and materials → Videos and progress: has videos (evidence: `app/Models/Unit.php`)
- Students and teachers → Enrollment progress: enroll and learn
- Enrollment progress → Videos and progress: counts completion (evidence: `app/Models/Enrollment.php`)
- Enrollment progress → Badges and streaks: awards progress (evidence: `app/Models/Enrollment.php`)
- Web dashboard → Activation code API: manage codes
- Activation code API → Code redemption: redeems codes (evidence: `app/Http/Controllers/API/Web/AdminActivationCodeController.php`)
- Code redemption → Enrollment progress: creates enrollment (evidence: `app/Services/CodeRedemptionService.php`)
- Mobile app → Comments and favorites: interact socially
- Badges and streaks → Notification service: sends awards (evidence: `app/Models/StudentProfile.php`)
- Notification service → Notification records: stores notification (evidence: `app/Services/NotificationService.php`)
- Notification service → Device tokens: loads tokens (evidence: `app/Services/NotificationService.php`)
- Notification service → Firebase messaging: pushes alerts (evidence: `app/Services/NotificationService.php`)
- Mobile app → Content reports: report content
- Mobile app → Support tickets: request support
- Web dashboard → Admin dashboard: review activity
- Admin dashboard → Report exports: export reports
