# p0olar/new-pix-nextjs architecture

> Architecture diagram of the GitHub repository p0olar/new-pix-nextjs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/p0olar/new-pix-nextjs
- Repository: https://github.com/p0olar/new-pix-nextjs

## Overview

ConfiraPix is a Banco do Brasil received-Pix dashboard. A user selects a date, the page requests the app’s API, and the server obtains an OAuth token, fetches all matching Pix pages over mTLS, normalizes the payments, and returns them for local search, sorting, totals, and printing. The README documents this workflow and the certificate/credential setup; source excerpts show the route and client calls. The dashboard’s request to the API is documented and visible in its fetch code.

Main entry points: [`lib/bbPixClient.js`](https://github.com/p0olar/new-pix-nextjs/blob/main/lib/bbPixClient.js) (Paginated Pix fetch), [`app/page.js`](https://github.com/p0olar/new-pix-nextjs/blob/main/app/page.js) (Pix dashboard), [`app/api/pix/route.js`](https://github.com/p0olar/new-pix-nextjs/blob/main/app/api/pix/route.js) (Date API route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Dashboard"]
  node_dashboard_page["Pix dashboard<br/>[page.js]"]
  node_report["Print report<br/>[page.js]"]
end

subgraph group_server["Server API"]
  node_pix_route["Date API route<br/>[route.js]"]
end

subgraph group_bb_client["BB Pix Client"]
  node_pix_fetcher["Paginated Pix fetch<br/>[bbPixClient.js]"]
  node_normalizer["Payment normalizer<br/>[bbPixClient.js]"]
  node_oauth["OAuth token client<br/>[bbPixClient.js]"]
end

subgraph group_external["External Services"]
  node_bb_oauth{{"BB OAuth service"}}
  node_bb_pix{{"BB Pix API"}}
end

node_user(("Dashboard user"))

node_user -->|"uses"| node_dashboard_page
node_dashboard_page -->|"fetches date"| node_pix_route
node_pix_route -->|"requests payments"| node_pix_fetcher
node_pix_fetcher -->|"gets token"| node_oauth
node_oauth -->|"requests token"| node_bb_oauth
node_pix_fetcher -->|"fetches pages"| node_bb_pix
node_pix_fetcher -->|"normalizes items"| node_normalizer
node_pix_route -->|"returns payments"| node_dashboard_page
node_dashboard_page -->|"prints filtered view"| node_report

click node_dashboard_page "https://github.com/p0olar/new-pix-nextjs/blob/main/app/page.js"
click node_report "https://github.com/p0olar/new-pix-nextjs/blob/main/app/page.js"
click node_pix_route "https://github.com/p0olar/new-pix-nextjs/blob/main/app/api/pix/route.js"
click node_pix_fetcher "https://github.com/p0olar/new-pix-nextjs/blob/main/lib/bbPixClient.js"
click node_normalizer "https://github.com/p0olar/new-pix-nextjs/blob/main/lib/bbPixClient.js"
click node_oauth "https://github.com/p0olar/new-pix-nextjs/blob/main/lib/bbPixClient.js"

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_dashboard_page,node_report,node_user toneBlue
class node_pix_route toneAmber
class node_pix_fetcher,node_normalizer,node_oauth toneMint
class node_bb_oauth,node_bb_pix toneRose
```

## Components

### Dashboard

- [Pix dashboard](https://github.com/p0olar/new-pix-nextjs/blob/main/app/page.js): `app/page.js`
- [Print report](https://github.com/p0olar/new-pix-nextjs/blob/main/app/page.js): `app/page.js`

### Server API

- [Date API route](https://github.com/p0olar/new-pix-nextjs/blob/main/app/api/pix/route.js): `app/api/pix/route.js`

### BB Pix Client

- [Paginated Pix fetch](https://github.com/p0olar/new-pix-nextjs/blob/main/lib/bbPixClient.js): `lib/bbPixClient.js`
- [Payment normalizer](https://github.com/p0olar/new-pix-nextjs/blob/main/lib/bbPixClient.js): `lib/bbPixClient.js`
- [OAuth token client](https://github.com/p0olar/new-pix-nextjs/blob/main/lib/bbPixClient.js): `lib/bbPixClient.js`

### External Services

- **BB OAuth service**
- **BB Pix API**

### Other components

- **Dashboard user**

## Connections

- Dashboard user → Pix dashboard: uses (evidence: `README.md`)
- Pix dashboard → Date API route: fetches date (evidence: `app/page.js`)
- Date API route → Paginated Pix fetch: requests payments (evidence: `app/api/pix/route.js`)
- Paginated Pix fetch → OAuth token client: gets token (evidence: `lib/bbPixClient.js`)
- OAuth token client → BB OAuth service: requests token (evidence: `lib/bbPixClient.js`)
- Paginated Pix fetch → BB Pix API: fetches pages (evidence: `lib/bbPixClient.js`)
- Paginated Pix fetch → Payment normalizer: normalizes items (evidence: `lib/bbPixClient.js`)
- Date API route → Pix dashboard: returns payments (evidence: `app/api/pix/route.js`)
- Pix dashboard → Print report: prints filtered view (evidence: `app/page.js`)
