# jabame731/sql-injection-activity architecture

> Architecture diagram of the GitHub repository jabame731/sql-injection-activity, 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/jabame731/sql-injection-activity
- Repository: https://github.com/jabame731/sql-injection-activity

## Overview

This repository implements a user authentication and account-management application: an Angular client provides login, welcome, and user screens, while an Express/MySQL backend exposes login and registration handlers. The principal flow is login submission through the client auth service to the backend route, controller, and database, with authenticated navigation guarded by client state. Registration is implemented server-side, but no client registration screen is present in the tree. The frontend-to-backend link is shown as unverified because the configured client URL and backend route mounting are not fully evidenced together.

Main entry points: [`frontend/src/app/app.routes.ts`](https://github.com/jabame731/sql-injection-activity/blob/master/frontend/src/app/app.routes.ts) (Client routes), [`backend/src/controller/user.ts`](https://github.com/jabame731/sql-injection-activity/blob/master/backend/src/controller/user.ts) (User controllers), [`backend/src/infrastructure/user.ts`](https://github.com/jabame731/sql-injection-activity/blob/master/backend/src/infrastructure/user.ts) (User operations), [`frontend/src/app/auth/auth.service.ts`](https://github.com/jabame731/sql-injection-activity/blob/master/frontend/src/app/auth/auth.service.ts) (Auth service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Angular client"]
  node_bootstrap["App bootstrap<br/>[main.ts]"]
  node_app["Root app shell<br/>[app.ts]"]
  node_config["Router configuration<br/>[app.config.ts]"]
  node_routes["Client routes<br/>[app.routes.ts]"]
  node_welcome["Welcome screen<br/>[welcome.ts]"]
  node_users["Users screen<br/>[users.ts]"]
end

subgraph group_auth["Client authentication"]
  node_login["Login screen<br/>[login.ts]"]
  node_authservice["Auth service<br/>[auth.service.ts]"]
  node_guard["Auth guard<br/>[auth.guard.ts]"]
  node_browserstore[("Browser local storage")]
end

subgraph group_server["Backend API"]
  node_apientry["Express server entry<br/>[index.ts]"]
  node_useroutes["User API routes<br/>[user.ts]"]
  node_usercontroller["User controllers<br/>[user.ts]"]
  node_userinfra["User operations<br/>[user.ts]"]
  node_responsemodel["Response types<br/>[response.model.ts]"]
  node_usermodel["User types<br/>[user.model.ts]"]
end

subgraph group_storage["Persistence"]
  node_mysqlconfig["MySQL connection<br/>[mysql.db.ts]"]
  node_mysql[("MySQL database")]
end

node_person(("Application user"))

node_person -->|"submits credentials"| node_login
node_bootstrap -->|"bootstraps"| node_app
node_bootstrap -->|"provides config"| node_config
node_config -->|"provides routes"| node_routes
node_routes -->|"routes to"| node_login
node_routes -->|"routes to"| node_welcome
node_routes -->|"routes to"| node_users
node_routes -->|"guards routes"| node_guard
node_login -->|"calls login"| node_authservice
node_guard -->|"checks session"| node_authservice
node_authservice -->|"reads/writes session"| node_browserstore
node_authservice -.->|"posts login"| node_useroutes
node_apientry -->|"mounts routes"| node_useroutes
node_useroutes -->|"dispatches handlers"| node_usercontroller
node_usercontroller -->|"calls operations"| node_userinfra
node_userinfra -->|"gets connection"| node_mysqlconfig
node_mysqlconfig -->|"creates pool"| node_mysql
node_usercontroller -->|"uses response types"| node_responsemodel
node_usercontroller -.->|"uses user types"| node_usermodel
node_userinfra -.->|"shapes responses"| node_responsemodel
node_userinfra -.->|"reads user fields"| node_usermodel

click node_bootstrap "https://github.com/jabame731/sql-injection-activity/blob/master/frontend/src/main.ts"
click node_app "https://github.com/jabame731/sql-injection-activity/blob/master/frontend/src/app/app.ts"
click node_config "https://github.com/jabame731/sql-injection-activity/blob/master/frontend/src/app/app.config.ts"
click node_routes "https://github.com/jabame731/sql-injection-activity/blob/master/frontend/src/app/app.routes.ts"
click node_login "https://github.com/jabame731/sql-injection-activity/blob/master/frontend/src/app/login/login.ts"
click node_authservice "https://github.com/jabame731/sql-injection-activity/blob/master/frontend/src/app/auth/auth.service.ts"
click node_guard "https://github.com/jabame731/sql-injection-activity/blob/master/frontend/src/app/auth/auth.guard.ts"
click node_welcome "https://github.com/jabame731/sql-injection-activity/blob/master/frontend/src/app/welcome/welcome.ts"
click node_users "https://github.com/jabame731/sql-injection-activity/blob/master/frontend/src/app/users/users.ts"
click node_apientry "https://github.com/jabame731/sql-injection-activity/blob/master/backend/src/index.ts"
click node_useroutes "https://github.com/jabame731/sql-injection-activity/blob/master/backend/src/routes/user.ts"
click node_usercontroller "https://github.com/jabame731/sql-injection-activity/blob/master/backend/src/controller/user.ts"
click node_userinfra "https://github.com/jabame731/sql-injection-activity/blob/master/backend/src/infrastructure/user.ts"
click node_responsemodel "https://github.com/jabame731/sql-injection-activity/blob/master/backend/src/models/response.model.ts"
click node_usermodel "https://github.com/jabame731/sql-injection-activity/blob/master/backend/src/models/user.model.ts"
click node_mysqlconfig "https://github.com/jabame731/sql-injection-activity/blob/master/backend/src/config/mysql.db.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_bootstrap,node_app,node_config,node_routes,node_welcome,node_users,node_person toneBlue
class node_login,node_authservice,node_guard,node_browserstore toneAmber
class node_apientry,node_useroutes,node_usercontroller,node_userinfra,node_responsemodel,node_usermodel toneMint
class node_mysqlconfig,node_mysql toneRose
```

## Components

### Angular client

- [App bootstrap](https://github.com/jabame731/sql-injection-activity/blob/master/frontend/src/main.ts): `frontend/src/main.ts`
- [Root app shell](https://github.com/jabame731/sql-injection-activity/blob/master/frontend/src/app/app.ts): `frontend/src/app/app.ts`
- [Router configuration](https://github.com/jabame731/sql-injection-activity/blob/master/frontend/src/app/app.config.ts): `frontend/src/app/app.config.ts`
- [Client routes](https://github.com/jabame731/sql-injection-activity/blob/master/frontend/src/app/app.routes.ts): `frontend/src/app/app.routes.ts`
- [Welcome screen](https://github.com/jabame731/sql-injection-activity/blob/master/frontend/src/app/welcome/welcome.ts): `frontend/src/app/welcome/welcome.ts`
- [Users screen](https://github.com/jabame731/sql-injection-activity/blob/master/frontend/src/app/users/users.ts): `frontend/src/app/users/users.ts`

### Client authentication

- [Login screen](https://github.com/jabame731/sql-injection-activity/blob/master/frontend/src/app/login/login.ts): `frontend/src/app/login/login.ts`
- [Auth service](https://github.com/jabame731/sql-injection-activity/blob/master/frontend/src/app/auth/auth.service.ts): `frontend/src/app/auth/auth.service.ts`
- [Auth guard](https://github.com/jabame731/sql-injection-activity/blob/master/frontend/src/app/auth/auth.guard.ts): `frontend/src/app/auth/auth.guard.ts`
- **Browser local storage**

### Backend API

- [Express server entry](https://github.com/jabame731/sql-injection-activity/blob/master/backend/src/index.ts): `backend/src/index.ts`
- [User API routes](https://github.com/jabame731/sql-injection-activity/blob/master/backend/src/routes/user.ts): `backend/src/routes/user.ts`
- [User controllers](https://github.com/jabame731/sql-injection-activity/blob/master/backend/src/controller/user.ts): `backend/src/controller/user.ts`
- [User operations](https://github.com/jabame731/sql-injection-activity/blob/master/backend/src/infrastructure/user.ts): `backend/src/infrastructure/user.ts`
- [Response types](https://github.com/jabame731/sql-injection-activity/blob/master/backend/src/models/response.model.ts): `backend/src/models/response.model.ts`
- [User types](https://github.com/jabame731/sql-injection-activity/blob/master/backend/src/models/user.model.ts): `backend/src/models/user.model.ts`

### Persistence

- [MySQL connection](https://github.com/jabame731/sql-injection-activity/blob/master/backend/src/config/mysql.db.ts): `backend/src/config/mysql.db.ts`
- **MySQL database**

### Other components

- **Application user**

## Connections

- Application user → Login screen: submits credentials (evidence: `frontend/src/app/login/login.ts`)
- App bootstrap → Root app shell: bootstraps (evidence: `frontend/src/main.ts`)
- App bootstrap → Router configuration: provides config (evidence: `frontend/src/main.ts`)
- Router configuration → Client routes: provides routes (evidence: `frontend/src/app/app.config.ts`)
- Client routes → Login screen: routes to (evidence: `frontend/src/app/app.routes.ts`)
- Client routes → Welcome screen: routes to (evidence: `frontend/src/app/app.routes.ts`)
- Client routes → Users screen: routes to (evidence: `frontend/src/app/app.routes.ts`)
- Client routes → Auth guard: guards routes (evidence: `frontend/src/app/app.routes.ts`)
- Login screen → Auth service: calls login (evidence: `frontend/src/app/login/login.ts`)
- Auth guard → Auth service: checks session (evidence: `frontend/src/app/auth/auth.guard.ts`)
- Auth service → Browser local storage: reads/writes session (evidence: `frontend/src/app/auth/auth.service.ts`)
- Auth service → User API routes: posts login
- Express server entry → User API routes: mounts routes (evidence: `backend/src/index.ts`)
- User API routes → User controllers: dispatches handlers (evidence: `backend/src/routes/user.ts`)
- User controllers → User operations: calls operations (evidence: `backend/src/controller/user.ts`)
- User operations → MySQL connection: gets connection (evidence: `backend/src/infrastructure/user.ts`)
- MySQL connection → MySQL database: creates pool (evidence: `backend/src/config/mysql.db.ts`)
- User controllers → Response types: uses response types (evidence: `backend/src/controller/user.ts`)
- User controllers → User types: uses user types
- User operations → Response types: shapes responses
- User operations → User types: reads user fields
