# sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship architecture

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

- Interactive diagram: https://gitdiagram.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship
- Repository: https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship

## Overview

This is a NestJS REST backend for an appointment application. Its visible workflow covers Google-token login and doctor signup, doctor profile discovery, and authenticated doctor availability management backed by PostgreSQL; doctor signup also sends a verification email. The README mentions appointment creation and management, but the tree contains no appointment module, so that capability is not mapped as an implemented workflow. Source excerpts show the main service calls; wiring for unsampled modules is represented only where supported by the tree or documentation.

Main entry points: [`src/auth/auth.service.ts`](https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/auth/auth.service.ts) (Auth workflows), [`src/availability/availability.service.ts`](https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/availability/availability.service.ts) (Availability management), [`src/doctor/doctor.entity.ts`](https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/doctor/doctor.entity.ts) (Doctor records), [`src/app.module.ts`](https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/app.module.ts) (Root module)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["REST API"]
  node_app["Application bootstrap<br/>[main.ts]"]
  node_appmodule["Root module<br/>[app.module.ts]"]
  node_health["Health endpoints<br/>[app.controller.ts]"]
end

subgraph group_identity["Identity"]
  node_authcontroller["Auth endpoints<br/>[auth.controller.ts]"]
  node_authservice["Auth workflows<br/>[auth.service.ts]"]
  node_user["User records<br/>[user.entity.ts]"]
  node_jwt["JWT strategy<br/>[jwt.strategy.ts]"]
  node_guards["Access guards"]
end

subgraph group_providers["Doctors &amp; Availability"]
  node_doctorcontroller["Doctor endpoints"]
  node_doctorservice["Doctor queries<br/>[doctor.service.ts]"]
  node_doctor["Doctor records<br/>[doctor.entity.ts]"]
  node_availabilitycontroller["Availability endpoints"]
  node_availabilityservice["Availability management"]
  node_availability["Availability records"]
end

subgraph group_infrastructure["Persistence &amp; Integrations"]
  node_postgres[("PostgreSQL")]
  node_mailservice["Verification mailer<br/>[mail.service.ts]"]
end

node_client(("API client"))
node_google(("Google identity"))
node_gmail(("Gmail SMTP"))

node_client -->|"requests"| node_health
node_client -->|"authenticates"| node_authcontroller
node_client -->|"queries"| node_doctorcontroller
node_client -->|"manages slots"| node_availabilitycontroller
node_app -->|"bootstraps"| node_appmodule
node_authcontroller -->|"delegates"| node_authservice
node_authservice -->|"verifies token"| node_google
node_authservice -->|"reads/writes"| node_user
node_authservice -->|"writes"| node_doctor
node_authservice -->|"signs token"| node_jwt
node_authservice -->|"sends verification"| node_mailservice
node_mailservice -->|"sends email"| node_gmail
node_doctorcontroller -->|"delegates"| node_doctorservice
node_doctorservice -->|"reads"| node_doctor
node_availabilitycontroller -->|"delegates"| node_availabilityservice
node_availabilityservice -->|"reads"| node_doctor
node_availabilityservice -->|"reads/writes"| node_availability
node_appmodule -->|"configures database"| node_postgres
node_jwt -->|"authenticates requests"| node_guards

click node_app "https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/main.ts"
click node_appmodule "https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/app.module.ts"
click node_health "https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/app.controller.ts"
click node_authcontroller "https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/auth/auth.controller.ts"
click node_authservice "https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/auth/auth.service.ts"
click node_user "https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/auth/user.entity.ts"
click node_jwt "https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/auth/jwt.strategy.ts"
click node_guards "https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/tree/main/src/guards"
click node_doctorcontroller "https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/doctor/doctor.controller.ts"
click node_doctorservice "https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/doctor/doctor.service.ts"
click node_doctor "https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/doctor/doctor.entity.ts"
click node_availabilitycontroller "https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/availability/availability.controller.ts"
click node_availabilityservice "https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/availability/availability.service.ts"
click node_availability "https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/availability/availability.entity.ts"
click node_mailservice "https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/auth/mail.service.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_app,node_appmodule,node_health,node_client toneBlue
class node_authcontroller,node_authservice,node_user,node_jwt,node_guards toneAmber
class node_doctorcontroller,node_doctorservice,node_doctor,node_availabilitycontroller,node_availabilityservice,node_availability toneMint
class node_postgres,node_mailservice toneRose
class node_google,node_gmail toneIndigo
```

## Components

### REST API

- [Application bootstrap](https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/main.ts): `src/main.ts`
- [Root module](https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/app.module.ts): `src/app.module.ts`
- [Health endpoints](https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/app.controller.ts): `src/app.controller.ts`

### Identity

- [Auth endpoints](https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/auth/auth.controller.ts): `src/auth/auth.controller.ts`
- [Auth workflows](https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/auth/auth.service.ts): `src/auth/auth.service.ts`
- [User records](https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/auth/user.entity.ts): `src/auth/user.entity.ts`
- [JWT strategy](https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/auth/jwt.strategy.ts): `src/auth/jwt.strategy.ts`
- [Access guards](https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/tree/main/src/guards): `src/guards`

### Doctors & Availability

- [Doctor endpoints](https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/doctor/doctor.controller.ts): `src/doctor/doctor.controller.ts`
- [Doctor queries](https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/doctor/doctor.service.ts): `src/doctor/doctor.service.ts`
- [Doctor records](https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/doctor/doctor.entity.ts): `src/doctor/doctor.entity.ts`
- [Availability endpoints](https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/availability/availability.controller.ts): `src/availability/availability.controller.ts`
- [Availability management](https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/availability/availability.service.ts): `src/availability/availability.service.ts`
- [Availability records](https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/availability/availability.entity.ts): `src/availability/availability.entity.ts`

### Persistence & Integrations

- **PostgreSQL**
- [Verification mailer](https://github.com/sanchetkuchanwar2nbnsticcomp-jpg/pearlthoughts-internship/blob/main/src/auth/mail.service.ts): `src/auth/mail.service.ts`

### Other components

- **API client**
- **Google identity**
- **Gmail SMTP**

## Connections

- API client → Health endpoints: requests
- API client → Auth endpoints: authenticates
- API client → Doctor endpoints: queries
- API client → Availability endpoints: manages slots
- Application bootstrap → Root module: bootstraps
- Auth endpoints → Auth workflows: delegates
- Auth workflows → Google identity: verifies token
- Auth workflows → User records: reads/writes
- Auth workflows → Doctor records: writes
- Auth workflows → JWT strategy: signs token
- Auth workflows → Verification mailer: sends verification
- Verification mailer → Gmail SMTP: sends email
- Doctor endpoints → Doctor queries: delegates
- Doctor queries → Doctor records: reads
- Availability endpoints → Availability management: delegates
- Availability management → Doctor records: reads
- Availability management → Availability records: reads/writes
- Root module → PostgreSQL: configures database
- JWT strategy → Access guards: authenticates requests
