# edgarlandal/edgar-1964 architecture

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

- Interactive diagram: https://gitdiagram.com/edgarlandal/edgar-1964
- Repository: https://github.com/edgarlandal/edgar-1964

## Overview

SnailPay is a demo balance top-up application: users register or sign in, open a local account dashboard, submit fictitious card details, and add funds only after a validated approval. The frontend keeps accounts and sessions in browser LocalStorage; its payment form sends requests to an Express API, which validates input, simulates approval/rejection or service failure, and formats a response. The dashboard also includes a chart component. Relationships are limited to sampled code and indexed references; the README content was not provided, so undocumented capabilities cannot be verified.

Main entry points: [`frontend/src/lib/account.ts`](https://github.com/edgarlandal/edgar-1964/blob/main/frontend/src/lib/account.ts) (Account and session), [`frontend/src/routeTree.gen.ts`](https://github.com/edgarlandal/edgar-1964/blob/main/frontend/src/routeTree.gen.ts) (Route tree), [`frontend/src/routes/dashboard.tsx`](https://github.com/edgarlandal/edgar-1964/blob/main/frontend/src/routes/dashboard.tsx) (Account dashboard), [`frontend/src/components/PaymentForm.tsx`](https://github.com/edgarlandal/edgar-1964/blob/main/frontend/src/components/PaymentForm.tsx) (Top-up form)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Frontend experience"]
  node_router["Router setup<br/>[router.tsx]"]
  node_routes["Route tree<br/>[routeTree.gen.ts]"]
  node_login["Sign-in form<br/>[LoginForm.tsx]"]
  node_register["Registration form<br/>[RegisterForm.tsx]"]
  node_input["Form inputs<br/>[InputCustom.tsx]"]
  node_dashboard["Account dashboard<br/>[dashboard.tsx]"]
  node_paymentform["Top-up form<br/>[PaymentForm.tsx]"]
  node_charts["Balance charts<br/>[BarsSnail.tsx]"]
end

subgraph group_account["Local account"]
  node_accountlib["Account and session<br/>[account.ts]"]
  node_browserstore[("Browser LocalStorage")]
end

subgraph group_api["Payment API"]
  node_apiapp["Express application<br/>[app.ts]"]
  node_routesapi["Payment route<br/>[snailpay.routes.ts]"]
  node_controller["Payment controller"]
  node_errors["Error middleware"]
end

subgraph group_payment["Payment processing"]
  node_validation["Payment validation"]
  node_service["Approval simulation"]
  node_types["Payment contracts<br/>[payment.types.ts]"]
  node_presenter["Response presenter"]
end

node_user(("User"))
node_paymentapi["SnailPay API"]

node_user -->|"uses"| node_router
node_router -->|"loads"| node_routes
node_routes -->|"routes to"| node_dashboard
node_routes -->|"routes to"| node_register
node_routes -->|"routes to"| node_login
node_login -->|"renders"| node_input
node_register -->|"renders"| node_input
node_login -->|"uses"| node_accountlib
node_register -->|"uses"| node_accountlib
node_dashboard -->|"reads session"| node_accountlib
node_accountlib -->|"reads/writes"| node_browserstore
node_dashboard -->|"renders"| node_paymentform
node_dashboard -->|"renders"| node_charts
node_paymentform -->|"renders"| node_input
node_paymentform -->|"applies approval"| node_accountlib
node_paymentform -->|"POSTs payment"| node_paymentapi
node_paymentapi -.->|"receives request"| node_apiapp
node_apiapp -->|"mounts route"| node_routesapi
node_routesapi -->|"dispatches"| node_controller
node_controller -->|"processes payment"| node_service
node_controller -->|"formats response"| node_presenter
node_service -->|"validates input"| node_validation
node_service -->|"uses contracts"| node_types
node_validation -->|"uses contracts"| node_types
node_presenter -->|"uses contracts"| node_types
node_apiapp -->|"registers handler"| node_errors

click node_router "https://github.com/edgarlandal/edgar-1964/blob/main/frontend/src/router.tsx"
click node_routes "https://github.com/edgarlandal/edgar-1964/blob/main/frontend/src/routeTree.gen.ts"
click node_login "https://github.com/edgarlandal/edgar-1964/blob/main/frontend/src/components/LoginForm.tsx"
click node_register "https://github.com/edgarlandal/edgar-1964/blob/main/frontend/src/components/RegisterForm.tsx"
click node_input "https://github.com/edgarlandal/edgar-1964/blob/main/frontend/src/components/InputCustom.tsx"
click node_dashboard "https://github.com/edgarlandal/edgar-1964/blob/main/frontend/src/routes/dashboard.tsx"
click node_paymentform "https://github.com/edgarlandal/edgar-1964/blob/main/frontend/src/components/PaymentForm.tsx"
click node_charts "https://github.com/edgarlandal/edgar-1964/blob/main/frontend/src/components/BarsSnail.tsx"
click node_accountlib "https://github.com/edgarlandal/edgar-1964/blob/main/frontend/src/lib/account.ts"
click node_apiapp "https://github.com/edgarlandal/edgar-1964/blob/main/backend/src/app.ts"
click node_routesapi "https://github.com/edgarlandal/edgar-1964/blob/main/backend/src/route/snailpay.routes.ts"
click node_controller "https://github.com/edgarlandal/edgar-1964/blob/main/backend/src/controllers/snailpay.controller.ts"
click node_errors "https://github.com/edgarlandal/edgar-1964/blob/main/backend/src/middleware/error.middleware.ts"
click node_validation "https://github.com/edgarlandal/edgar-1964/blob/main/backend/src/validators/payment.validator.ts"
click node_service "https://github.com/edgarlandal/edgar-1964/blob/main/backend/src/services/snailpay.service.ts"
click node_types "https://github.com/edgarlandal/edgar-1964/blob/main/backend/src/types/payment.types.ts"
click node_presenter "https://github.com/edgarlandal/edgar-1964/blob/main/backend/src/presenters/payment.presenter.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_router,node_routes,node_login,node_register,node_input,node_dashboard,node_paymentform,node_charts,node_user toneBlue
class node_accountlib,node_browserstore toneAmber
class node_apiapp,node_routesapi,node_controller,node_errors,node_paymentapi toneMint
class node_validation,node_service,node_types,node_presenter toneRose
```

## Components

### Frontend experience

- [Router setup](https://github.com/edgarlandal/edgar-1964/blob/main/frontend/src/router.tsx): `frontend/src/router.tsx`
- [Route tree](https://github.com/edgarlandal/edgar-1964/blob/main/frontend/src/routeTree.gen.ts): `frontend/src/routeTree.gen.ts`
- [Sign-in form](https://github.com/edgarlandal/edgar-1964/blob/main/frontend/src/components/LoginForm.tsx): `frontend/src/components/LoginForm.tsx`
- [Registration form](https://github.com/edgarlandal/edgar-1964/blob/main/frontend/src/components/RegisterForm.tsx): `frontend/src/components/RegisterForm.tsx`
- [Form inputs](https://github.com/edgarlandal/edgar-1964/blob/main/frontend/src/components/InputCustom.tsx): `frontend/src/components/InputCustom.tsx`
- [Account dashboard](https://github.com/edgarlandal/edgar-1964/blob/main/frontend/src/routes/dashboard.tsx): `frontend/src/routes/dashboard.tsx`
- [Top-up form](https://github.com/edgarlandal/edgar-1964/blob/main/frontend/src/components/PaymentForm.tsx): `frontend/src/components/PaymentForm.tsx`
- [Balance charts](https://github.com/edgarlandal/edgar-1964/blob/main/frontend/src/components/BarsSnail.tsx): `frontend/src/components/BarsSnail.tsx`

### Local account

- [Account and session](https://github.com/edgarlandal/edgar-1964/blob/main/frontend/src/lib/account.ts): `frontend/src/lib/account.ts`
- **Browser LocalStorage**

### Payment API

- [Express application](https://github.com/edgarlandal/edgar-1964/blob/main/backend/src/app.ts): `backend/src/app.ts`
- [Payment route](https://github.com/edgarlandal/edgar-1964/blob/main/backend/src/route/snailpay.routes.ts): `backend/src/route/snailpay.routes.ts`
- [Payment controller](https://github.com/edgarlandal/edgar-1964/blob/main/backend/src/controllers/snailpay.controller.ts): `backend/src/controllers/snailpay.controller.ts`
- [Error middleware](https://github.com/edgarlandal/edgar-1964/blob/main/backend/src/middleware/error.middleware.ts): `backend/src/middleware/error.middleware.ts`

### Payment processing

- [Payment validation](https://github.com/edgarlandal/edgar-1964/blob/main/backend/src/validators/payment.validator.ts): `backend/src/validators/payment.validator.ts`
- [Approval simulation](https://github.com/edgarlandal/edgar-1964/blob/main/backend/src/services/snailpay.service.ts): `backend/src/services/snailpay.service.ts`
- [Payment contracts](https://github.com/edgarlandal/edgar-1964/blob/main/backend/src/types/payment.types.ts): `backend/src/types/payment.types.ts`
- [Response presenter](https://github.com/edgarlandal/edgar-1964/blob/main/backend/src/presenters/payment.presenter.ts): `backend/src/presenters/payment.presenter.ts`

### Other components

- **User**
- **SnailPay API**

## Connections

- User → Router setup: uses (evidence: `frontend/src/router.tsx`)
- Router setup → Route tree: loads (evidence: `frontend/src/router.tsx`)
- Route tree → Account dashboard: routes to (evidence: `frontend/src/routeTree.gen.ts`)
- Route tree → Registration form: routes to (evidence: `frontend/src/routeTree.gen.ts`)
- Route tree → Sign-in form: routes to (evidence: `frontend/src/routeTree.gen.ts`)
- Sign-in form → Form inputs: renders (evidence: `frontend/src/components/LoginForm.tsx`)
- Registration form → Form inputs: renders (evidence: `frontend/src/components/RegisterForm.tsx`)
- Sign-in form → Account and session: uses (evidence: `frontend/src/components/LoginForm.tsx`)
- Registration form → Account and session: uses (evidence: `frontend/src/components/RegisterForm.tsx`)
- Account dashboard → Account and session: reads session (evidence: `frontend/src/routes/dashboard.tsx`)
- Account and session → Browser LocalStorage: reads/writes (evidence: `frontend/src/lib/account.ts`)
- Account dashboard → Top-up form: renders (evidence: `frontend/src/routes/dashboard.tsx`)
- Account dashboard → Balance charts: renders (evidence: `frontend/src/routes/dashboard.tsx`)
- Top-up form → Form inputs: renders (evidence: `frontend/src/components/PaymentForm.tsx`)
- Top-up form → Account and session: applies approval (evidence: `frontend/src/components/PaymentForm.tsx`)
- Top-up form → SnailPay API: POSTs payment (evidence: `frontend/src/components/PaymentForm.tsx`)
- SnailPay API → Express application: receives request
- Express application → Payment route: mounts route (evidence: `backend/src/app.ts`)
- Payment route → Payment controller: dispatches (evidence: `backend/src/route/snailpay.routes.ts`)
- Payment controller → Approval simulation: processes payment (evidence: `backend/src/controllers/snailpay.controller.ts`)
- Payment controller → Response presenter: formats response (evidence: `backend/src/controllers/snailpay.controller.ts`)
- Approval simulation → Payment validation: validates input (evidence: `backend/src/services/snailpay.service.ts`)
- Approval simulation → Payment contracts: uses contracts (evidence: `backend/src/services/snailpay.service.ts`)
- Payment validation → Payment contracts: uses contracts (evidence: `backend/src/validators/payment.validator.ts`)
- Response presenter → Payment contracts: uses contracts (evidence: `backend/src/presenters/payment.presenter.ts`)
- Express application → Error middleware: registers handler (evidence: `backend/src/app.ts`)
