# mizcausevic-dev/fraud-click-filter architecture

> Architecture diagram of the GitHub repository mizcausevic-dev/fraud-click-filter, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mizcausevic-dev/fraud-click-filter
- Repository: https://github.com/mizcausevic-dev/fraud-click-filter

## Overview

#### Purpose and principal workflow

Fraud Click Filter is a TypeScript demo control plane that presents sample traffic decisions, rules, threat signals, and spend-at-risk summaries to help growth and RevOps users reason about low-trust clicks. A browser user initiates the main workflow with an HTTP request: the Express app serves a rendered page or JSON response derived from in-memory sample data. The sampled implementation models decisions; it does not ingest or filter live ad traffic.

#### Components

##### HTTP entry and presentation

- **Browser user** — **Path: null (external actor).** Requests the documented pages and API routes to view traffic-integrity information.
- **Express route application** — `src/app.ts`. Defines HTML and JSON GET routes, calls renderers or service functions, and listens on loopback when run directly.
- **Traffic dashboard renderer** — `src/services/render.ts`. Builds the overview and grouped filter-lane, threat-signal, verification, and docs pages; its shown renderers obtain figures and records from the traffic service.

##### Domain data and projections

- **Traffic sample dataset** — `src/data/sampleTraffic.ts`. Defines event, rule, and threat-signal types and supplies the static records used by the demo.
- **Traffic projections and payload** — `src/services/trafficFilterService.ts`. Computes dashboard counts and spend at risk from events, exposes events/rules/signals/verification content, and assembles the combined sample payload.

##### Static output

- **Prerendered site and API exporter** — `scripts/prerender.ts`. Calls the same page renderers and service projections as the app, then writes HTML pages and JSON files under `site/`.

#### Relationships

- **Browser user -> Express route application:** sends HTTP GET requests to the documented routes.
- **Express route application -> Traffic dashboard renderer:** calls a page renderer for HTML routes.
- **Traffic dashboard renderer -> Traffic projections and payload:** reads summary, rule, signal, event, or verification projections to populate pages.
- **Express route application -> Traffic projections and payload:** calls the corresponding projection for JSON API routes.
- **Traffic projections and payload -> Traffic sample dataset:** reads the static events, rules, and threat signals; computes summary counts and spend from the events.
- **Prerendered site and API exporter -> Traffic dashboard renderer:** calls page renderers to produce static HTML.
- **Prerendered site and API exporter -> Traffic projections and payload:** calls projection functions to produce static JSON.
- **Prerendered site and API exporter -> Local filesystem (external system, Path: null):** writes generated HTML and JSON beneath `site/`.

#### Coverage limits

The source sample establishes an in-memory demo and its served and prerendered outputs, not a production traffic-ingestion or decision-enforcement pipeline. The README documents routes and product intent, but sampled code does not establish live integrations, persistent state, authentication, or downstream analytics/ad-platform connections. The renderer excerpt is partial, so details of unsampled page implementations are not inferred.

Main entry points: [`src/services/trafficFilterService.ts`](https://github.com/mizcausevic-dev/fraud-click-filter/blob/main/src/services/trafficFilterService.ts) (Traffic projections), [`scripts/prerender.ts`](https://github.com/mizcausevic-dev/fraud-click-filter/blob/main/scripts/prerender.ts) (Prerender exporter), [`src/app.ts`](https://github.com/mizcausevic-dev/fraud-click-filter/blob/main/src/app.ts) (Express routes), [`src/services/render.ts`](https://github.com/mizcausevic-dev/fraud-click-filter/blob/main/src/services/render.ts) (Traffic renderer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["HTTP Presentation"]
  node_app["Express routes<br/>HTTP application"]
  node_renderer["Traffic renderer<br/>Page renderer"]
end

subgraph group_domain["Traffic Data"]
  node_traffic["Traffic projections<br/>Domain service"]
  node_dataset["Traffic samples<br/>Static data"]
end

subgraph group_static["Static Output"]
  node_prerender["Prerender exporter<br/>Static exporter"]
end

node_browser(("Browser user<br/>External actor"))
node_filesystem["Local filesystem<br/>External system"]

node_browser -->|"HTTP GET"| node_app
node_app -->|"renders pages"| node_renderer
node_renderer -->|"reads projections"| node_traffic
node_app -->|"calls projections"| node_traffic
node_traffic -->|"reads samples"| node_dataset
node_prerender -->|"renders pages"| node_renderer
node_prerender -->|"calls projections"| node_traffic
node_prerender -->|"writes outputs"| node_filesystem

click node_app "https://github.com/mizcausevic-dev/fraud-click-filter/blob/main/src/app.ts"
click node_renderer "https://github.com/mizcausevic-dev/fraud-click-filter/blob/main/src/services/render.ts"
click node_traffic "https://github.com/mizcausevic-dev/fraud-click-filter/blob/main/src/services/trafficFilterService.ts"
click node_dataset "https://github.com/mizcausevic-dev/fraud-click-filter/blob/main/src/data/sampleTraffic.ts"
click node_prerender "https://github.com/mizcausevic-dev/fraud-click-filter/blob/main/scripts/prerender.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_app,node_renderer,node_browser toneBlue
class node_traffic,node_dataset toneAmber
class node_prerender toneMint
class node_filesystem toneIndigo
```

## Components

### HTTP Presentation

- [Express routes](https://github.com/mizcausevic-dev/fraud-click-filter/blob/main/src/app.ts): HTTP application · `src/app.ts`
- [Traffic renderer](https://github.com/mizcausevic-dev/fraud-click-filter/blob/main/src/services/render.ts): Page renderer · `src/services/render.ts`

### Traffic Data

- [Traffic projections](https://github.com/mizcausevic-dev/fraud-click-filter/blob/main/src/services/trafficFilterService.ts): Domain service · `src/services/trafficFilterService.ts`
- [Traffic samples](https://github.com/mizcausevic-dev/fraud-click-filter/blob/main/src/data/sampleTraffic.ts): Static data · `src/data/sampleTraffic.ts`

### Static Output

- [Prerender exporter](https://github.com/mizcausevic-dev/fraud-click-filter/blob/main/scripts/prerender.ts): Static exporter · `scripts/prerender.ts`

### Other components

- **Browser user**: External actor
- **Local filesystem**: External system

## Connections

- Browser user → Express routes: HTTP GET · Requests documented pages and API routes.
- Express routes → Traffic renderer: renders pages
- Traffic renderer → Traffic projections: reads projections
- Express routes → Traffic projections: calls projections
- Traffic projections → Traffic samples: reads samples
- Prerender exporter → Traffic renderer: renders pages
- Prerender exporter → Traffic projections: calls projections
- Prerender exporter → Local filesystem: writes outputs · Writes generated HTML and JSON beneath site/.
