# bouchra-ader/juice-shop architecture

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

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

## Overview

OWASP Juice Shop is an intentionally vulnerable online shop used for security training, awareness demonstrations, CTFs, and security-tool evaluation. Users interact with an Angular storefront and its challenge-oriented features; the Node/Express server exposes the application and API, backed by Sequelize models and seeded data. Distinct product areas include shopping, identity/security, and hacking challenges, with challenge-solving state and notifications as an internal layer. The graph follows documented routing and sampled server/data/model relationships; many individual route-to-model calls and frontend service bindings were not shown, so uncertain links are omitted or dashed.

Main entry points: [`frontend/src/app/app.routing.ts`](https://github.com/bouchra-ader/juice-shop/blob/master/frontend/src/app/app.routing.ts) (Page routing), [`server.ts`](https://github.com/bouchra-ader/juice-shop/blob/master/server.ts) (HTTP server), [`data/datacreator.ts`](https://github.com/bouchra-ader/juice-shop/blob/master/data/datacreator.ts) (Initial data loading), [`lib/challengeUtils.ts`](https://github.com/bouchra-ader/juice-shop/blob/master/lib/challengeUtils.ts) (Challenge solving)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_angular["Angular client<br/>[app.component.ts]"]
  node_routing["Page routing<br/>[app.routing.ts]"]
  node_shopui["Shopping interface"]
  node_challengeui["Challenge interface"]
  node_chatbot["Chatbot interface"]
end

subgraph group_server["Server and APIs"]
  node_entry["Application entry<br/>[app.ts]"]
  node_http["HTTP server<br/>[server.ts]"]
  node_reviewapi["Review endpoints"]
  node_shopapi["Shop APIs<br/>[basket.ts]"]
  node_identity["Identity APIs<br/>[login.ts]"]
end

subgraph group_commerce["Shop domain"]
  node_commerce["Commerce records<br/>[product.ts]"]
  node_account["User records<br/>[user.ts]"]
end

subgraph group_security["Security challenges"]
  node_challenge["Challenge catalog<br/>[challenge.ts]"]
  node_challengeflow["Challenge solving<br/>[challengeUtils.ts]"]
  node_coding["Coding challenges"]
  node_webhook["Solution webhook<br/>[webhook.ts]"]
end

subgraph group_persistence["Data and state"]
  node_seed["Initial data loading<br/>[datacreator.ts]"]
  node_cache["Runtime data cache<br/>[datacache.ts]"]
  node_models["Model registry<br/>[index.ts]"]
  node_database[("SQLite database<br/>[index.ts]")]
  node_staticdata["Static challenge data<br/>[staticData.ts]"]
end

node_visitor(("Shop user"))

node_visitor -->|"uses"| node_angular
node_angular -->|"navigates via"| node_routing
node_routing -->|"routes to"| node_shopui
node_routing -->|"routes to"| node_challengeui
node_routing -->|"routes to"| node_chatbot
node_entry -->|"starts"| node_http
node_http -->|"serves client"| node_angular
node_http -->|"awaits initialization"| node_seed
node_http -.->|"registers endpoints"| node_reviewapi
node_shopui -.->|"requests shop data"| node_shopapi
node_shopapi -.->|"accesses records"| node_commerce
node_identity -.->|"uses accounts"| node_account
node_reviewapi -->|"reads runtime cache"| node_cache
node_seed -->|"loads seed data"| node_staticdata
node_seed -->|"loads definitions"| node_coding
node_seed -->|"creates challenge records"| node_challenge
node_models -->|"configures SQLite"| node_database
node_challengeflow -->|"updates solved state"| node_challenge
node_challengeflow -->|"records notifications"| node_cache
node_challengeflow -->|"notifies on solve"| node_webhook
node_challengeui -.->|"submits progress"| node_challengeflow

click node_angular "https://github.com/bouchra-ader/juice-shop/blob/master/frontend/src/app/app.component.ts"
click node_routing "https://github.com/bouchra-ader/juice-shop/blob/master/frontend/src/app/app.routing.ts"
click node_shopui "https://github.com/bouchra-ader/juice-shop/blob/master/frontend/src/app/product/product.component.ts"
click node_challengeui "https://github.com/bouchra-ader/juice-shop/blob/master/frontend/src/app/score-board/score-board.component.ts"
click node_chatbot "https://github.com/bouchra-ader/juice-shop/blob/master/frontend/src/app/chatbot/chatbot.component.ts"
click node_entry "https://github.com/bouchra-ader/juice-shop/blob/master/app.ts"
click node_http "https://github.com/bouchra-ader/juice-shop/blob/master/server.ts"
click node_reviewapi "https://github.com/bouchra-ader/juice-shop/blob/master/routes/showProductReviews.ts"
click node_shopapi "https://github.com/bouchra-ader/juice-shop/blob/master/routes/basket.ts"
click node_identity "https://github.com/bouchra-ader/juice-shop/blob/master/routes/login.ts"
click node_commerce "https://github.com/bouchra-ader/juice-shop/blob/master/models/product.ts"
click node_account "https://github.com/bouchra-ader/juice-shop/blob/master/models/user.ts"
click node_challenge "https://github.com/bouchra-ader/juice-shop/blob/master/models/challenge.ts"
click node_challengeflow "https://github.com/bouchra-ader/juice-shop/blob/master/lib/challengeUtils.ts"
click node_coding "https://github.com/bouchra-ader/juice-shop/blob/master/lib/codingChallenges.ts"
click node_seed "https://github.com/bouchra-ader/juice-shop/blob/master/data/datacreator.ts"
click node_cache "https://github.com/bouchra-ader/juice-shop/blob/master/data/datacache.ts"
click node_models "https://github.com/bouchra-ader/juice-shop/blob/master/models/index.ts"
click node_database "https://github.com/bouchra-ader/juice-shop/blob/master/models/index.ts"
click node_staticdata "https://github.com/bouchra-ader/juice-shop/blob/master/data/staticData.ts"
click node_webhook "https://github.com/bouchra-ader/juice-shop/blob/master/lib/webhook.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_angular,node_routing,node_shopui,node_challengeui,node_chatbot,node_visitor toneBlue
class node_entry,node_http,node_reviewapi,node_shopapi,node_identity toneAmber
class node_commerce,node_account toneMint
class node_challenge,node_challengeflow,node_coding,node_webhook toneRose
class node_seed,node_cache,node_models,node_database,node_staticdata toneIndigo
```

## Components

### Web client

- [Angular client](https://github.com/bouchra-ader/juice-shop/blob/master/frontend/src/app/app.component.ts): `frontend/src/app/app.component.ts`
- [Page routing](https://github.com/bouchra-ader/juice-shop/blob/master/frontend/src/app/app.routing.ts): `frontend/src/app/app.routing.ts`
- [Shopping interface](https://github.com/bouchra-ader/juice-shop/blob/master/frontend/src/app/product/product.component.ts): `frontend/src/app/product/product.component.ts`
- [Challenge interface](https://github.com/bouchra-ader/juice-shop/blob/master/frontend/src/app/score-board/score-board.component.ts): `frontend/src/app/score-board/score-board.component.ts`
- [Chatbot interface](https://github.com/bouchra-ader/juice-shop/blob/master/frontend/src/app/chatbot/chatbot.component.ts): `frontend/src/app/chatbot/chatbot.component.ts`

### Server and APIs

- [Application entry](https://github.com/bouchra-ader/juice-shop/blob/master/app.ts): `app.ts`
- [HTTP server](https://github.com/bouchra-ader/juice-shop/blob/master/server.ts): `server.ts`
- [Review endpoints](https://github.com/bouchra-ader/juice-shop/blob/master/routes/showProductReviews.ts): `routes/showProductReviews.ts`
- [Shop APIs](https://github.com/bouchra-ader/juice-shop/blob/master/routes/basket.ts): `routes/basket.ts`
- [Identity APIs](https://github.com/bouchra-ader/juice-shop/blob/master/routes/login.ts): `routes/login.ts`

### Shop domain

- [Commerce records](https://github.com/bouchra-ader/juice-shop/blob/master/models/product.ts): `models/product.ts`
- [User records](https://github.com/bouchra-ader/juice-shop/blob/master/models/user.ts): `models/user.ts`

### Security challenges

- [Challenge catalog](https://github.com/bouchra-ader/juice-shop/blob/master/models/challenge.ts): `models/challenge.ts`
- [Challenge solving](https://github.com/bouchra-ader/juice-shop/blob/master/lib/challengeUtils.ts): `lib/challengeUtils.ts`
- [Coding challenges](https://github.com/bouchra-ader/juice-shop/blob/master/lib/codingChallenges.ts): `lib/codingChallenges.ts`
- [Solution webhook](https://github.com/bouchra-ader/juice-shop/blob/master/lib/webhook.ts): `lib/webhook.ts`

### Data and state

- [Initial data loading](https://github.com/bouchra-ader/juice-shop/blob/master/data/datacreator.ts): `data/datacreator.ts`
- [Runtime data cache](https://github.com/bouchra-ader/juice-shop/blob/master/data/datacache.ts): `data/datacache.ts`
- [Model registry](https://github.com/bouchra-ader/juice-shop/blob/master/models/index.ts): `models/index.ts`
- [SQLite database](https://github.com/bouchra-ader/juice-shop/blob/master/models/index.ts): `models/index.ts`
- [Static challenge data](https://github.com/bouchra-ader/juice-shop/blob/master/data/staticData.ts): `data/staticData.ts`

### Other components

- **Shop user**

## Connections

- Shop user → Angular client: uses (evidence: `README.md`)
- Angular client → Page routing: navigates via (evidence: `frontend/src/app/app.component.ts`)
- Page routing → Shopping interface: routes to (evidence: `frontend/src/app/app.routing.ts`)
- Page routing → Challenge interface: routes to (evidence: `frontend/src/app/app.routing.ts`)
- Page routing → Chatbot interface: routes to (evidence: `frontend/src/app/app.routing.ts`)
- Application entry → HTTP server: starts (evidence: `app.ts`)
- HTTP server → Angular client: serves client (evidence: `server.ts`)
- HTTP server → Initial data loading: awaits initialization (evidence: `server.ts`)
- HTTP server → Review endpoints: registers endpoints
- Shopping interface → Shop APIs: requests shop data
- Shop APIs → Commerce records: accesses records
- Identity APIs → User records: uses accounts
- Review endpoints → Runtime data cache: reads runtime cache (evidence: `routes/showProductReviews.ts`)
- Initial data loading → Static challenge data: loads seed data (evidence: `data/datacreator.ts`)
- Initial data loading → Coding challenges: loads definitions (evidence: `data/datacreator.ts`)
- Initial data loading → Challenge catalog: creates challenge records (evidence: `data/datacreator.ts`)
- Model registry → SQLite database: configures SQLite (evidence: `models/index.ts`)
- Challenge solving → Challenge catalog: updates solved state (evidence: `lib/challengeUtils.ts`)
- Challenge solving → Runtime data cache: records notifications (evidence: `lib/challengeUtils.ts`)
- Challenge solving → Solution webhook: notifies on solve (evidence: `lib/challengeUtils.ts`)
- Challenge interface → Challenge solving: submits progress
