# lucas-retanero/pi-repository architecture

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

- Interactive diagram: https://gitdiagram.com/lucas-retanero/pi-repository
- Repository: https://github.com/lucas-retanero/pi-repository

## Overview

Acervo Acadêmico Fatec is a web application for organizing and consulting Fatec Itaquera Integrator Projects. Its main workflow is authenticated project creation and management, followed by browsing projects and recording progress; professors can verify projects, while administrators manage users and courses. The application also supports favorites, notifications, semester awards, dashboards, and profiles. Edges are limited to relationships visible in excerpts, the SOURCE INDEX, or README; unsampled UI-to-API wiring is not asserted.

Main entry points: [`src/db/index.ts`](https://github.com/lucas-retanero/pi-repository/blob/main/src/db/index.ts) (Database connection), [`src/app/api/projects/route.ts`](https://github.com/lucas-retanero/pi-repository/blob/main/src/app/api/projects/route.ts) (Project commands), [`src/infrastructure/projects/db-project-command-repository.ts`](https://github.com/lucas-retanero/pi-repository/blob/main/src/infrastructure/projects/db-project-command-repository.ts) (Project command storage), [`src/infrastructure/projects/db-project-repository.ts`](https://github.com/lucas-retanero/pi-repository/blob/main/src/infrastructure/projects/db-project-repository.ts) (Project reading)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and accounts"]
  node_authui["Sign-in experience<br/>[auth-context.tsx]"]
  node_authrepo["Better Auth client"]
  node_authserver["Session and auth<br/>[auth.ts]"]
  node_adminusers["User administration<br/>[route.ts]"]
  node_profile["Profile management<br/>[route.ts]"]
end

subgraph group_projects["Project lifecycle"]
  node_projectapi["Project commands<br/>[route.ts]"]
  node_projectuse["Create project use case"]
  node_projectrepo["Project command storage"]
  node_projectread["Project reading"]
  node_progressapi["Progress tracking<br/>[route.ts]"]
  node_verification["Project verification"]
  node_favorites["Project favorites<br/>[route.ts]"]
  node_awards["Semester awards<br/>[route.ts]"]
  node_recommended["Public recommendations<br/>[route.ts]"]
end

subgraph group_operations["Academic operations"]
  node_admincourses["Course administration<br/>[route.ts]"]
  node_coursequeries["Course queries and rules<br/>[course-queries.ts]"]
  node_dashboard["Role dashboards<br/>[DashboardPage.tsx]"]
  node_notificationsapi["Notification access<br/>[route.ts]"]
  node_notifyevents["Task event notifications"]
  node_notificationstore["Notification storage"]
end

subgraph group_data["Persistence"]
  node_database[("PostgreSQL schema<br/>[schema.ts]")]
  node_dbclient["Database connection<br/>[index.ts]"]
end

node_user(("Students, faculty, admins"))
node_postgres[("PostgreSQL &#40;Neon&#41;")]
node_microsoft["Microsoft Entra ID"]
node_email["Email delivery"]

node_user -->|"signs in"| node_authui
node_authui -->|"calls"| node_authrepo
node_authrepo -.->|"starts social login"| node_microsoft
node_authserver -->|"sends reset email"| node_email
node_adminusers -->|"loads courses"| node_coursequeries
node_adminusers -.->|"sends account invite"| node_email
node_profile -->|"looks up course"| node_coursequeries
node_projectapi -->|"invokes"| node_projectuse
node_projectapi -->|"configures"| node_projectrepo
node_projectapi -->|"notifies task events"| node_notifyevents
node_projectuse -.->|"persists project"| node_projectrepo
node_progressapi -->|"notifies changes"| node_notifyevents
node_favorites -->|"checks project"| node_projectread
node_awards -->|"loads projects"| node_projectread
node_admincourses -->|"uses course rules"| node_coursequeries
node_notificationsapi -->|"reads and updates"| node_notificationstore
node_notifyevents -->|"creates records"| node_notificationstore
node_projectrepo -->|"queries"| node_dbclient
node_projectread -->|"queries"| node_dbclient
node_verification -->|"reads and writes"| node_dbclient
node_notificationstore -->|"reads and writes"| node_dbclient
node_dbclient -->|"connects"| node_postgres
node_database -.->|"defines tables"| node_postgres
node_user -.->|"manages projects"| node_projectapi
node_user -.->|"updates progress"| node_progressapi
node_user -.->|"saves favorites"| node_favorites
node_user -.->|"views dashboard"| node_dashboard
node_user -.->|"browses awards"| node_recommended

click node_authui "https://github.com/lucas-retanero/pi-repository/blob/main/src/presentation/auth/auth-context.tsx"
click node_authrepo "https://github.com/lucas-retanero/pi-repository/blob/main/src/infrastructure/auth/better-auth-auth-repository.ts"
click node_authserver "https://github.com/lucas-retanero/pi-repository/blob/main/src/libs/auth.ts"
click node_adminusers "https://github.com/lucas-retanero/pi-repository/blob/main/src/app/api/admin/users/route.ts"
click node_profile "https://github.com/lucas-retanero/pi-repository/blob/main/src/app/api/profile/route.ts"
click node_projectapi "https://github.com/lucas-retanero/pi-repository/blob/main/src/app/api/projects/route.ts"
click node_projectuse "https://github.com/lucas-retanero/pi-repository/blob/main/src/application/projects/create-project-use-case.ts"
click node_projectrepo "https://github.com/lucas-retanero/pi-repository/blob/main/src/infrastructure/projects/db-project-command-repository.ts"
click node_projectread "https://github.com/lucas-retanero/pi-repository/blob/main/src/infrastructure/projects/db-project-repository.ts"
click node_progressapi "https://github.com/lucas-retanero/pi-repository/blob/main/src/app/api/projects/%5Bid%5D/progress/route.ts"
click node_verification "https://github.com/lucas-retanero/pi-repository/blob/main/src/infrastructure/projects/db-project-verification-repository.ts"
click node_favorites "https://github.com/lucas-retanero/pi-repository/blob/main/src/app/api/favorites/route.ts"
click node_awards "https://github.com/lucas-retanero/pi-repository/blob/main/src/app/api/semester-awards/route.ts"
click node_recommended "https://github.com/lucas-retanero/pi-repository/blob/main/src/app/api/projects/recommended/route.ts"
click node_admincourses "https://github.com/lucas-retanero/pi-repository/blob/main/src/app/api/admin/courses/route.ts"
click node_coursequeries "https://github.com/lucas-retanero/pi-repository/blob/main/src/infrastructure/courses/course-queries.ts"
click node_dashboard "https://github.com/lucas-retanero/pi-repository/blob/main/src/components/dashboard/DashboardPage.tsx"
click node_notificationsapi "https://github.com/lucas-retanero/pi-repository/blob/main/src/app/api/notifications/route.ts"
click node_notifyevents "https://github.com/lucas-retanero/pi-repository/blob/main/src/infrastructure/notifications/notify-task-event.ts"
click node_notificationstore "https://github.com/lucas-retanero/pi-repository/blob/main/src/infrastructure/notifications/db-notification-repository.ts"
click node_database "https://github.com/lucas-retanero/pi-repository/blob/main/src/db/schema.ts"
click node_dbclient "https://github.com/lucas-retanero/pi-repository/blob/main/src/db/index.ts"

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_authui,node_authrepo,node_authserver,node_adminusers,node_profile toneBlue
class node_projectapi,node_projectuse,node_projectrepo,node_projectread,node_progressapi,node_verification,node_favorites,node_awards,node_recommended,node_postgres toneAmber
class node_admincourses,node_coursequeries,node_dashboard,node_notificationsapi,node_notifyevents,node_notificationstore toneMint
class node_database,node_dbclient toneRose
class node_user,node_microsoft,node_email toneIndigo
```

## Components

### Access and accounts

- [Sign-in experience](https://github.com/lucas-retanero/pi-repository/blob/main/src/presentation/auth/auth-context.tsx): `src/presentation/auth/auth-context.tsx`
- [Better Auth client](https://github.com/lucas-retanero/pi-repository/blob/main/src/infrastructure/auth/better-auth-auth-repository.ts): `src/infrastructure/auth/better-auth-auth-repository.ts`
- [Session and auth](https://github.com/lucas-retanero/pi-repository/blob/main/src/libs/auth.ts): `src/libs/auth.ts`
- [User administration](https://github.com/lucas-retanero/pi-repository/blob/main/src/app/api/admin/users/route.ts): `src/app/api/admin/users/route.ts`
- [Profile management](https://github.com/lucas-retanero/pi-repository/blob/main/src/app/api/profile/route.ts): `src/app/api/profile/route.ts`

### Project lifecycle

- [Project commands](https://github.com/lucas-retanero/pi-repository/blob/main/src/app/api/projects/route.ts): `src/app/api/projects/route.ts`
- [Create project use case](https://github.com/lucas-retanero/pi-repository/blob/main/src/application/projects/create-project-use-case.ts): `src/application/projects/create-project-use-case.ts`
- [Project command storage](https://github.com/lucas-retanero/pi-repository/blob/main/src/infrastructure/projects/db-project-command-repository.ts): `src/infrastructure/projects/db-project-command-repository.ts`
- [Project reading](https://github.com/lucas-retanero/pi-repository/blob/main/src/infrastructure/projects/db-project-repository.ts): `src/infrastructure/projects/db-project-repository.ts`
- [Progress tracking](https://github.com/lucas-retanero/pi-repository/blob/main/src/app/api/projects/%5Bid%5D/progress/route.ts): `src/app/api/projects/[id]/progress/route.ts`
- [Project verification](https://github.com/lucas-retanero/pi-repository/blob/main/src/infrastructure/projects/db-project-verification-repository.ts): `src/infrastructure/projects/db-project-verification-repository.ts`
- [Project favorites](https://github.com/lucas-retanero/pi-repository/blob/main/src/app/api/favorites/route.ts): `src/app/api/favorites/route.ts`
- [Semester awards](https://github.com/lucas-retanero/pi-repository/blob/main/src/app/api/semester-awards/route.ts): `src/app/api/semester-awards/route.ts`
- [Public recommendations](https://github.com/lucas-retanero/pi-repository/blob/main/src/app/api/projects/recommended/route.ts): `src/app/api/projects/recommended/route.ts`

### Academic operations

- [Course administration](https://github.com/lucas-retanero/pi-repository/blob/main/src/app/api/admin/courses/route.ts): `src/app/api/admin/courses/route.ts`
- [Course queries and rules](https://github.com/lucas-retanero/pi-repository/blob/main/src/infrastructure/courses/course-queries.ts): `src/infrastructure/courses/course-queries.ts`
- [Role dashboards](https://github.com/lucas-retanero/pi-repository/blob/main/src/components/dashboard/DashboardPage.tsx): `src/components/dashboard/DashboardPage.tsx`
- [Notification access](https://github.com/lucas-retanero/pi-repository/blob/main/src/app/api/notifications/route.ts): `src/app/api/notifications/route.ts`
- [Task event notifications](https://github.com/lucas-retanero/pi-repository/blob/main/src/infrastructure/notifications/notify-task-event.ts): `src/infrastructure/notifications/notify-task-event.ts`
- [Notification storage](https://github.com/lucas-retanero/pi-repository/blob/main/src/infrastructure/notifications/db-notification-repository.ts): `src/infrastructure/notifications/db-notification-repository.ts`

### Persistence

- [PostgreSQL schema](https://github.com/lucas-retanero/pi-repository/blob/main/src/db/schema.ts): `src/db/schema.ts`
- [Database connection](https://github.com/lucas-retanero/pi-repository/blob/main/src/db/index.ts): `src/db/index.ts`

### Other components

- **Students, faculty, admins**
- **PostgreSQL (Neon)**
- **Microsoft Entra ID**
- **Email delivery**

## Connections

- Students, faculty, admins → Sign-in experience: signs in (evidence: `README.md`)
- Sign-in experience → Better Auth client: calls (evidence: `src/presentation/auth/auth-context.tsx`)
- Better Auth client → Microsoft Entra ID: starts social login
- Session and auth → Email delivery: sends reset email (evidence: `src/libs/auth.ts`)
- User administration → Course queries and rules: loads courses (evidence: `src/app/api/admin/users/route.ts`)
- User administration → Email delivery: sends account invite
- Profile management → Course queries and rules: looks up course (evidence: `src/app/api/profile/route.ts`)
- Project commands → Create project use case: invokes (evidence: `src/app/api/projects/route.ts`)
- Project commands → Project command storage: configures (evidence: `src/app/api/projects/route.ts`)
- Project commands → Task event notifications: notifies task events (evidence: `src/app/api/projects/route.ts`)
- Create project use case → Project command storage: persists project
- Progress tracking → Task event notifications: notifies changes (evidence: `src/app/api/projects/[id]/progress/route.ts`)
- Project favorites → Project reading: checks project (evidence: `src/app/api/favorites/route.ts`)
- Semester awards → Project reading: loads projects (evidence: `src/app/api/semester-awards/route.ts`)
- Course administration → Course queries and rules: uses course rules (evidence: `src/app/api/admin/courses/route.ts`)
- Notification access → Notification storage: reads and updates (evidence: `src/app/api/notifications/route.ts`)
- Task event notifications → Notification storage: creates records (evidence: `src/infrastructure/notifications/notify-task-event.ts`)
- Project command storage → Database connection: queries (evidence: `src/infrastructure/projects/db-project-command-repository.ts`)
- Project reading → Database connection: queries (evidence: `src/infrastructure/projects/db-project-repository.ts`)
- Project verification → Database connection: reads and writes (evidence: `src/infrastructure/projects/db-project-verification-repository.ts`)
- Notification storage → Database connection: reads and writes (evidence: `src/infrastructure/notifications/db-notification-repository.ts`)
- Database connection → PostgreSQL (Neon): connects (evidence: `src/db/index.ts`)
- PostgreSQL schema → PostgreSQL (Neon): defines tables
- Students, faculty, admins → Project commands: manages projects
- Students, faculty, admins → Progress tracking: updates progress
- Students, faculty, admins → Project favorites: saves favorites
- Students, faculty, admins → Role dashboards: views dashboard
- Students, faculty, admins → Public recommendations: browses awards
