How jackblue19/juice-shop-fork works
Project Type and Purpose
• OWASP Juice Shop is a full-stack, intentionally vulnerable web application used for security training, CTFs, and tool testing.
• It consists of an Angular SPA frontend, a Node.js/Express REST/API backend, and a data layer (MongoDB or in-memory JSON store), all of which can be run locally, in Docker, or via Vagrant.
File Structure Analysis
• Top-level “frontend” directory holds the Angular application (components, services, assets, environments, build config).
• Top-level server files (server.ts, Dockerfile, routes/, models/, lib/, data/) implement the Express app, business logic, data access, static file serving, WebSocket events, and startup routines.
• “data/” contains static YAML/JSON challenge definitions, chat-bot training data, and database connection code.
• “models/” defines TypeScript interfaces for domain objects (User, Challenge, Basket, etc.).
• “routes/” holds Express route modules mapping URL endpoints to controllers.
• DevOps configs (docker-compose.test.yml, .github/workflows/*, .gitlab-ci.yml, Vagrantfile) support CI/CD, testing, and multi-environment deployment.
README Insights
• Describes a containerized, cross-platform setup via Docker, Vagrant, or direct Node.js run.
• Mentions OWASP Top 10 vulnerabilities coverage and a companion guide for architecture overview.
• Emphasizes build/test pipelines (npm, Grunt, Cypress E2E, Jest/Mocha) and multiple deployment methods.
a. Main Components
• Client Tier: Angular SPA loaded in browser.
• API Layer: Express.js server exposing REST endpoints + WebSocket channel.
• Data Persistence: MongoDB (or built-in JSON store) for user/challenge data; filesystem for uploads/FTP.
• Static Assets Server: Express static middleware serves Angular bundle, images, legal, tutorial pages, and FTP quarantine.
• External Services: OAuth/OpenID provider, payment gateways, external chat-bot API, optionally SMTP or SMS.
• DevOps: Docker engine, CI/CD pipelines, Vagrant VM, monitoring (Grafana).
b. Relationships and Interactions
• Browser ↔️ Angular SPA: renders UI, invokes HTTP/WS to backend.
• Angular → Express REST API: JSON over HTTP for data CRUD and challenge interactions.
• Angular ← WebSocket: real-time “challenge solved” or notification events.
• Express → MongoDB: persistence layer for all domain entities (users, orders, challenges).
• Express → File System: store/retrieve user uploads, logs, FTP quarantine.
• Express → External OAuth/Payment: API calls for login, token sale, premium rewards.
• CI/CD → Docker Registry: automated build/test push for containers.
c. Architectural Patterns and Principles
• Layered (Presentation / Service / Data Access) on the server side.
• Modular routing in Express: one file per resource endpoint.
• Dependency Injection in Angular (Services → Components).
• Static content served alongside dynamic API in a monolithic Node.js process.
• Configuration‐driven startup routines validating preconditions and customizing behavior.
d. Key Technologies, Frameworks, Libraries
• Frontend: Angular, TypeScript, RxJS, Webpack, StyleLint, ESLint, Cypress for E2E tests.
• Backend: Node.js, Express.js, TypeScript, Mongoose or custom JSON store, WS or socket.io for realtime.
• DevOps: Docker, docker-compose, GitHub Actions/GitLab CI, Vagrant.
• Monitoring: Grafana dashboard, custom metrics endpoint.
• Security tooling: ZAP rules, code-fix snippets, CSAF metadata.