# yamagutisenior/juice-shop architecture

> Architecture diagram of the GitHub repository yamagutisenior/juice-shop, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yamagutisenior/juice-shop
- Repository: https://github.com/yamagutisenior/juice-shop

## Overview

OWASP Juice Shop is an intentionally insecure online shop used for security training, demos, CTFs, and security-tool evaluation. The user-facing workflow enters the Angular application and reaches the server; the server initializes shop data and domain models. Training challenges, scoring, and security flaws are a distinct product capability alongside shop features. The supplied excerpts establish only some wiring, so unsampled route and service connections are omitted rather than inferred.

Main entry points: [`server.ts`](https://github.com/yamagutisenior/juice-shop/blob/master/server.ts) (HTTP server), [`lib/challengeUtils.ts`](https://github.com/yamagutisenior/juice-shop/blob/master/lib/challengeUtils.ts) (Challenge tracking and scoring), [`routes/showProductReviews.ts`](https://github.com/yamagutisenior/juice-shop/blob/master/routes/showProductReviews.ts) (Product reviews), [`data/datacreator.ts`](https://github.com/yamagutisenior/juice-shop/blob/master/data/datacreator.ts) (Shop data initialization)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_frontend["Angular application<br/>[app.module.ts]"]
  node_routing["Page routing<br/>[app.routing.ts]"]
  node_appboot["Application bootstrap<br/>[app.ts]"]
  node_server["HTTP server<br/>[server.ts]"]
end

subgraph group_shop["Shop domain"]
  node_datainit["Shop data initialization<br/>[datacreator.ts]"]
  node_staticdata["Static shop data<br/>[staticData.ts]"]
  node_models["Shop domain models"]
  node_database[("SQLite domain store<br/>[index.ts]")]
  node_productreviews["Product reviews"]
end

subgraph group_training["Security training"]
  node_challenges["Challenge definitions<br/>[staticData.ts]"]
  node_challengeengine["Challenge tracking and scoring<br/>[challengeUtils.ts]"]
  node_codechallenges["Coding challenges"]
end

subgraph group_platform["Shared platform"]
  node_security["Authentication and security helpers<br/>[insecurity.ts]"]
  node_cache["Runtime data cache<br/>[datacache.ts]"]
  node_utilities["Shared utilities<br/>[utils.ts]"]
end

node_user(("Shop user"))

node_user -->|"uses"| node_frontend
node_frontend -->|"routes pages"| node_routing
node_appboot -->|"starts"| node_server
node_server -->|"initializes data"| node_datainit
node_server -->|"syncs models"| node_database
node_server -->|"imports models"| node_models
node_datainit -->|"loads records"| node_staticdata
node_datainit -->|"creates records"| node_models
node_database -->|"initializes models"| node_models
node_productreviews -->|"reads cache"| node_cache
node_productreviews -->|"uses helpers"| node_security
node_productreviews -->|"uses helpers"| node_utilities
node_challenges -.->|"tracks solutions"| node_challengeengine
node_challengeengine -->|"records notifications"| node_cache
node_challengeengine -.->|"supports coding"| node_codechallenges
node_challengeengine -->|"uses helpers"| node_utilities

click node_frontend "https://github.com/yamagutisenior/juice-shop/blob/master/frontend/src/app/app.module.ts"
click node_routing "https://github.com/yamagutisenior/juice-shop/blob/master/frontend/src/app/app.routing.ts"
click node_appboot "https://github.com/yamagutisenior/juice-shop/blob/master/app.ts"
click node_server "https://github.com/yamagutisenior/juice-shop/blob/master/server.ts"
click node_datainit "https://github.com/yamagutisenior/juice-shop/blob/master/data/datacreator.ts"
click node_staticdata "https://github.com/yamagutisenior/juice-shop/blob/master/data/staticData.ts"
click node_models "https://github.com/yamagutisenior/juice-shop/tree/master/models"
click node_database "https://github.com/yamagutisenior/juice-shop/blob/master/models/index.ts"
click node_productreviews "https://github.com/yamagutisenior/juice-shop/blob/master/routes/showProductReviews.ts"
click node_challenges "https://github.com/yamagutisenior/juice-shop/blob/master/data/staticData.ts"
click node_challengeengine "https://github.com/yamagutisenior/juice-shop/blob/master/lib/challengeUtils.ts"
click node_codechallenges "https://github.com/yamagutisenior/juice-shop/blob/master/lib/codingChallenges.ts"
click node_security "https://github.com/yamagutisenior/juice-shop/blob/master/lib/insecurity.ts"
click node_cache "https://github.com/yamagutisenior/juice-shop/blob/master/data/datacache.ts"
click node_utilities "https://github.com/yamagutisenior/juice-shop/blob/master/lib/utils.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,node_routing,node_appboot,node_server,node_user toneBlue
class node_datainit,node_staticdata,node_models,node_database,node_productreviews toneAmber
class node_challenges,node_challengeengine,node_codechallenges toneMint
class node_security,node_cache,node_utilities toneRose
```

## Components

### Application entry

- [Angular application](https://github.com/yamagutisenior/juice-shop/blob/master/frontend/src/app/app.module.ts): `frontend/src/app/app.module.ts`
- [Page routing](https://github.com/yamagutisenior/juice-shop/blob/master/frontend/src/app/app.routing.ts): `frontend/src/app/app.routing.ts`
- [Application bootstrap](https://github.com/yamagutisenior/juice-shop/blob/master/app.ts): `app.ts`
- [HTTP server](https://github.com/yamagutisenior/juice-shop/blob/master/server.ts): `server.ts`

### Shop domain

- [Shop data initialization](https://github.com/yamagutisenior/juice-shop/blob/master/data/datacreator.ts): `data/datacreator.ts`
- [Static shop data](https://github.com/yamagutisenior/juice-shop/blob/master/data/staticData.ts): `data/staticData.ts`
- [Shop domain models](https://github.com/yamagutisenior/juice-shop/tree/master/models): `models`
- [SQLite domain store](https://github.com/yamagutisenior/juice-shop/blob/master/models/index.ts): `models/index.ts`
- [Product reviews](https://github.com/yamagutisenior/juice-shop/blob/master/routes/showProductReviews.ts): `routes/showProductReviews.ts`

### Security training

- [Challenge definitions](https://github.com/yamagutisenior/juice-shop/blob/master/data/staticData.ts): `data/staticData.ts`
- [Challenge tracking and scoring](https://github.com/yamagutisenior/juice-shop/blob/master/lib/challengeUtils.ts): `lib/challengeUtils.ts`
- [Coding challenges](https://github.com/yamagutisenior/juice-shop/blob/master/lib/codingChallenges.ts): `lib/codingChallenges.ts`

### Shared platform

- [Authentication and security helpers](https://github.com/yamagutisenior/juice-shop/blob/master/lib/insecurity.ts): `lib/insecurity.ts`
- [Runtime data cache](https://github.com/yamagutisenior/juice-shop/blob/master/data/datacache.ts): `data/datacache.ts`
- [Shared utilities](https://github.com/yamagutisenior/juice-shop/blob/master/lib/utils.ts): `lib/utils.ts`

### Other components

- **Shop user**

## Connections

- Shop user → Angular application: uses
- Angular application → Page routing: routes pages (evidence: `frontend/src/app/app.module.ts`)
- Application bootstrap → HTTP server: starts (evidence: `app.ts`)
- HTTP server → Shop data initialization: initializes data (evidence: `server.ts`)
- HTTP server → SQLite domain store: syncs models (evidence: `server.ts`)
- HTTP server → Shop domain models: imports models (evidence: `server.ts`)
- Shop data initialization → Static shop data: loads records (evidence: `data/datacreator.ts`)
- Shop data initialization → Shop domain models: creates records (evidence: `data/datacreator.ts`)
- SQLite domain store → Shop domain models: initializes models (evidence: `models/index.ts`)
- Product reviews → Runtime data cache: reads cache (evidence: `routes/showProductReviews.ts`)
- Product reviews → Authentication and security helpers: uses helpers (evidence: `routes/showProductReviews.ts`)
- Product reviews → Shared utilities: uses helpers (evidence: `routes/showProductReviews.ts`)
- Challenge definitions → Challenge tracking and scoring: tracks solutions
- Challenge tracking and scoring → Runtime data cache: records notifications (evidence: `lib/challengeUtils.ts`)
- Challenge tracking and scoring → Coding challenges: supports coding
- Challenge tracking and scoring → Shared utilities: uses helpers (evidence: `lib/challengeUtils.ts`)
