# shaundelcastillo/auth-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/shaundelcastillo/auth-frontend
- Repository: https://github.com/shaundelcastillo/auth-frontend

## Overview

This repository pairs an Angular authentication frontend with an Express/TypeORM authentication API. The main workflow is registration and email verification, then sign-in and access to a guarded dashboard; password recovery and user-management APIs are additional capabilities. The frontend centralizes API calls and auth state, while backend routes dispatch to controllers and domain services. Some frontend recovery pages and backend modules are documented or indexed but not excerpted, so their internal behavior and some links are not shown.

Main entry points: [`auth-frontend/src/app/core/services/auth.service.ts`](https://github.com/shaundelcastillo/auth-frontend/blob/main/auth-frontend/src/app/core/services/auth.service.ts) (Auth state and API), [`auth-frontend/src/app/app.routes.ts`](https://github.com/shaundelcastillo/auth-frontend/blob/main/auth-frontend/src/app/app.routes.ts) (Feature routing), [`src/index.ts`](https://github.com/shaundelcastillo/auth-frontend/blob/main/src/index.ts) (Express API server), [`src/routes/authRoutes.ts`](https://github.com/shaundelcastillo/auth-frontend/blob/main/src/routes/authRoutes.ts) (Auth routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Angular frontend"]
  node_frontend_routes["Feature routing<br/>[app.routes.ts]"]
  node_login["Login page<br/>[login.component.ts]"]
  node_registration["Registration page"]
  node_email_verify["Email verification"]
  node_recovery["Password recovery pages"]
  node_dashboard["Protected dashboard"]
  node_auth_state["Auth state and API<br/>[auth.service.ts]"]
  node_route_guards["Route guards<br/>[auth.guard.ts]"]
  node_http_interceptors["HTTP interceptors<br/>[app.config.ts]"]
end

subgraph group_api["API routing"]
  node_api_server["Express API server<br/>[index.ts]"]
  node_auth_routes["Auth routes<br/>[authRoutes.ts]"]
  node_verification_routes["Verification routes"]
  node_user_routes["User routes<br/>[userRoutes.ts]"]
  node_health_routes["Health routes<br/>[healthRoutes.ts]"]
  node_auth_controller["Auth controller<br/>[authController.ts]"]
  node_verification_controller["Verification controller"]
  node_user_controller["User controller<br/>[userController.ts]"]
end

subgraph group_domain["Auth and user services"]
  node_auth_service["Authentication service<br/>[authService.ts]"]
  node_verification_service["Verification service"]
  node_user_service["User service<br/>[userService.ts]"]
  node_email_service["Email delivery<br/>[emailService.ts]"]
end

subgraph group_runtime["Runtime and persistence"]
  node_user_store[("User records<br/>[User.ts]")]
  node_data_source["Database connection<br/>[data-source.ts]"]
  node_request_middleware["Request middleware<br/>[auth.ts]"]
  node_error_handling["Error handling<br/>[errorHandler.ts]"]
end

node_visitor(("Browser user"))

node_visitor -->|"navigates"| node_frontend_routes
node_frontend_routes -->|"loads"| node_login
node_frontend_routes -->|"loads"| node_registration
node_frontend_routes -->|"loads"| node_email_verify
node_frontend_routes -->|"lazy-loads"| node_recovery
node_frontend_routes -->|"loads"| node_dashboard
node_frontend_routes -->|"uses"| node_route_guards
node_login -->|"calls"| node_auth_state
node_registration -->|"calls"| node_auth_state
node_email_verify -->|"calls"| node_auth_state
node_dashboard -->|"reads state"| node_auth_state
node_route_guards -->|"checks state"| node_auth_state
node_auth_state -.->|"sends requests"| node_http_interceptors
node_auth_state -->|"calls API"| node_auth_routes
node_auth_state -->|"calls API"| node_verification_routes
node_api_server -->|"mounts"| node_auth_routes
node_api_server -->|"mounts"| node_user_routes
node_api_server -->|"mounts"| node_health_routes
node_api_server -.->|"configures"| node_request_middleware
node_api_server -->|"configures"| node_error_handling
node_auth_routes -->|"dispatches"| node_auth_controller
node_auth_routes -->|"references"| node_verification_routes
node_verification_routes -->|"dispatches"| node_verification_controller
node_user_routes -->|"dispatches"| node_user_controller
node_auth_controller -->|"calls"| node_auth_service
node_verification_controller -->|"calls"| node_verification_service
node_user_controller -->|"calls"| node_user_service
node_auth_service -->|"queries"| node_data_source
node_verification_service -->|"queries"| node_data_source
node_user_service -->|"queries"| node_data_source
node_data_source -->|"registers entity"| node_user_store
node_verification_service -->|"sends mail"| node_email_service

click node_frontend_routes "https://github.com/shaundelcastillo/auth-frontend/blob/main/auth-frontend/src/app/app.routes.ts"
click node_login "https://github.com/shaundelcastillo/auth-frontend/blob/main/auth-frontend/src/app/features/auth/login/login.component.ts"
click node_registration "https://github.com/shaundelcastillo/auth-frontend/blob/main/auth-frontend/src/app/features/auth/register/register.component.ts"
click node_email_verify "https://github.com/shaundelcastillo/auth-frontend/blob/main/auth-frontend/src/app/features/auth/verify-email/verify-email.component.ts"
click node_recovery "https://github.com/shaundelcastillo/auth-frontend/tree/main/auth-frontend/src/app/features/auth"
click node_dashboard "https://github.com/shaundelcastillo/auth-frontend/blob/main/auth-frontend/src/app/features/dashboard/dashboard.component.ts"
click node_auth_state "https://github.com/shaundelcastillo/auth-frontend/blob/main/auth-frontend/src/app/core/services/auth.service.ts"
click node_route_guards "https://github.com/shaundelcastillo/auth-frontend/blob/main/auth-frontend/src/app/core/guards/auth.guard.ts"
click node_http_interceptors "https://github.com/shaundelcastillo/auth-frontend/blob/main/auth-frontend/src/app/app.config.ts"
click node_api_server "https://github.com/shaundelcastillo/auth-frontend/blob/main/src/index.ts"
click node_auth_routes "https://github.com/shaundelcastillo/auth-frontend/blob/main/src/routes/authRoutes.ts"
click node_verification_routes "https://github.com/shaundelcastillo/auth-frontend/blob/main/src/routes/verificationRoutes.ts"
click node_user_routes "https://github.com/shaundelcastillo/auth-frontend/blob/main/src/routes/userRoutes.ts"
click node_health_routes "https://github.com/shaundelcastillo/auth-frontend/blob/main/src/routes/healthRoutes.ts"
click node_auth_controller "https://github.com/shaundelcastillo/auth-frontend/blob/main/src/controllers/authController.ts"
click node_verification_controller "https://github.com/shaundelcastillo/auth-frontend/blob/main/src/controllers/verificationController.ts"
click node_user_controller "https://github.com/shaundelcastillo/auth-frontend/blob/main/src/controllers/userController.ts"
click node_auth_service "https://github.com/shaundelcastillo/auth-frontend/blob/main/src/services/authService.ts"
click node_verification_service "https://github.com/shaundelcastillo/auth-frontend/blob/main/src/services/verificationService.ts"
click node_user_service "https://github.com/shaundelcastillo/auth-frontend/blob/main/src/services/userService.ts"
click node_email_service "https://github.com/shaundelcastillo/auth-frontend/blob/main/src/services/emailService.ts"
click node_user_store "https://github.com/shaundelcastillo/auth-frontend/blob/main/src/entities/User.ts"
click node_data_source "https://github.com/shaundelcastillo/auth-frontend/blob/main/src/config/data-source.ts"
click node_request_middleware "https://github.com/shaundelcastillo/auth-frontend/blob/main/src/middleware/auth.ts"
click node_error_handling "https://github.com/shaundelcastillo/auth-frontend/blob/main/src/middleware/errorHandler.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_frontend_routes,node_login,node_registration,node_email_verify,node_recovery,node_dashboard,node_auth_state,node_route_guards,node_http_interceptors,node_visitor toneBlue
class node_api_server,node_auth_routes,node_verification_routes,node_user_routes,node_health_routes,node_auth_controller,node_verification_controller,node_user_controller toneAmber
class node_auth_service,node_verification_service,node_user_service,node_email_service toneMint
class node_user_store,node_data_source,node_request_middleware,node_error_handling toneRose
```

## Components

### Angular frontend

- [Feature routing](https://github.com/shaundelcastillo/auth-frontend/blob/main/auth-frontend/src/app/app.routes.ts): `auth-frontend/src/app/app.routes.ts`
- [Login page](https://github.com/shaundelcastillo/auth-frontend/blob/main/auth-frontend/src/app/features/auth/login/login.component.ts): `auth-frontend/src/app/features/auth/login/login.component.ts`
- [Registration page](https://github.com/shaundelcastillo/auth-frontend/blob/main/auth-frontend/src/app/features/auth/register/register.component.ts): `auth-frontend/src/app/features/auth/register/register.component.ts`
- [Email verification](https://github.com/shaundelcastillo/auth-frontend/blob/main/auth-frontend/src/app/features/auth/verify-email/verify-email.component.ts): `auth-frontend/src/app/features/auth/verify-email/verify-email.component.ts`
- [Password recovery pages](https://github.com/shaundelcastillo/auth-frontend/tree/main/auth-frontend/src/app/features/auth): `auth-frontend/src/app/features/auth`
- [Protected dashboard](https://github.com/shaundelcastillo/auth-frontend/blob/main/auth-frontend/src/app/features/dashboard/dashboard.component.ts): `auth-frontend/src/app/features/dashboard/dashboard.component.ts`
- [Auth state and API](https://github.com/shaundelcastillo/auth-frontend/blob/main/auth-frontend/src/app/core/services/auth.service.ts): `auth-frontend/src/app/core/services/auth.service.ts`
- [Route guards](https://github.com/shaundelcastillo/auth-frontend/blob/main/auth-frontend/src/app/core/guards/auth.guard.ts): `auth-frontend/src/app/core/guards/auth.guard.ts`
- [HTTP interceptors](https://github.com/shaundelcastillo/auth-frontend/blob/main/auth-frontend/src/app/app.config.ts): `auth-frontend/src/app/app.config.ts`

### API routing

- [Express API server](https://github.com/shaundelcastillo/auth-frontend/blob/main/src/index.ts): `src/index.ts`
- [Auth routes](https://github.com/shaundelcastillo/auth-frontend/blob/main/src/routes/authRoutes.ts): `src/routes/authRoutes.ts`
- [Verification routes](https://github.com/shaundelcastillo/auth-frontend/blob/main/src/routes/verificationRoutes.ts): `src/routes/verificationRoutes.ts`
- [User routes](https://github.com/shaundelcastillo/auth-frontend/blob/main/src/routes/userRoutes.ts): `src/routes/userRoutes.ts`
- [Health routes](https://github.com/shaundelcastillo/auth-frontend/blob/main/src/routes/healthRoutes.ts): `src/routes/healthRoutes.ts`
- [Auth controller](https://github.com/shaundelcastillo/auth-frontend/blob/main/src/controllers/authController.ts): `src/controllers/authController.ts`
- [Verification controller](https://github.com/shaundelcastillo/auth-frontend/blob/main/src/controllers/verificationController.ts): `src/controllers/verificationController.ts`
- [User controller](https://github.com/shaundelcastillo/auth-frontend/blob/main/src/controllers/userController.ts): `src/controllers/userController.ts`

### Auth and user services

- [Authentication service](https://github.com/shaundelcastillo/auth-frontend/blob/main/src/services/authService.ts): `src/services/authService.ts`
- [Verification service](https://github.com/shaundelcastillo/auth-frontend/blob/main/src/services/verificationService.ts): `src/services/verificationService.ts`
- [User service](https://github.com/shaundelcastillo/auth-frontend/blob/main/src/services/userService.ts): `src/services/userService.ts`
- [Email delivery](https://github.com/shaundelcastillo/auth-frontend/blob/main/src/services/emailService.ts): `src/services/emailService.ts`

### Runtime and persistence

- [User records](https://github.com/shaundelcastillo/auth-frontend/blob/main/src/entities/User.ts): `src/entities/User.ts`
- [Database connection](https://github.com/shaundelcastillo/auth-frontend/blob/main/src/config/data-source.ts): `src/config/data-source.ts`
- [Request middleware](https://github.com/shaundelcastillo/auth-frontend/blob/main/src/middleware/auth.ts): `src/middleware/auth.ts`
- [Error handling](https://github.com/shaundelcastillo/auth-frontend/blob/main/src/middleware/errorHandler.ts): `src/middleware/errorHandler.ts`

### Other components

- **Browser user**

## Connections

- Browser user → Feature routing: navigates (evidence: `auth-frontend/src/app/app.routes.ts`)
- Feature routing → Login page: loads (evidence: `auth-frontend/src/app/app.routes.ts`)
- Feature routing → Registration page: loads (evidence: `auth-frontend/src/app/app.routes.ts`)
- Feature routing → Email verification: loads (evidence: `auth-frontend/src/app/app.routes.ts`)
- Feature routing → Password recovery pages: lazy-loads (evidence: `auth-frontend/src/app/app.routes.ts`)
- Feature routing → Protected dashboard: loads (evidence: `auth-frontend/src/app/app.routes.ts`)
- Feature routing → Route guards: uses (evidence: `auth-frontend/src/app/app.routes.ts`)
- Login page → Auth state and API: calls (evidence: `auth-frontend/src/app/features/auth/login/login.component.ts`)
- Registration page → Auth state and API: calls (evidence: `auth-frontend/src/app/features/auth/register/register.component.ts`)
- Email verification → Auth state and API: calls (evidence: `auth-frontend/src/app/features/auth/verify-email/verify-email.component.ts`)
- Protected dashboard → Auth state and API: reads state (evidence: `auth-frontend/src/app/features/dashboard/dashboard.component.ts`)
- Route guards → Auth state and API: checks state (evidence: `auth-frontend/src/app/core/guards/auth.guard.ts`)
- Auth state and API → HTTP interceptors: sends requests
- Auth state and API → Auth routes: calls API (evidence: `auth-frontend/src/app/core/services/auth.service.ts`)
- Auth state and API → Verification routes: calls API (evidence: `auth-frontend/src/app/core/services/auth.service.ts`)
- Express API server → Auth routes: mounts (evidence: `src/index.ts`)
- Express API server → User routes: mounts (evidence: `src/index.ts`)
- Express API server → Health routes: mounts (evidence: `src/index.ts`)
- Express API server → Request middleware: configures
- Express API server → Error handling: configures (evidence: `src/index.ts`)
- Auth routes → Auth controller: dispatches (evidence: `src/routes/authRoutes.ts`)
- Auth routes → Verification routes: references (evidence: `src/routes/authRoutes.ts`)
- Verification routes → Verification controller: dispatches (evidence: `src/routes/verificationRoutes.ts`)
- User routes → User controller: dispatches (evidence: `src/routes/userRoutes.ts`)
- Auth controller → Authentication service: calls (evidence: `src/controllers/authController.ts`)
- Verification controller → Verification service: calls (evidence: `src/controllers/verificationController.ts`)
- User controller → User service: calls (evidence: `src/controllers/userController.ts`)
- Authentication service → Database connection: queries (evidence: `src/services/authService.ts`)
- Verification service → Database connection: queries (evidence: `src/services/verificationService.ts`)
- User service → Database connection: queries (evidence: `src/services/userService.ts`)
- Database connection → User records: registers entity (evidence: `src/config/data-source.ts`)
- Verification service → Email delivery: sends mail (evidence: `src/services/verificationService.ts`)
