# bistadinesh03/critique architecture

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

- Interactive diagram: https://gitdiagram.com/bistadinesh03/critique
- Repository: https://github.com/bistadinesh03/critique

## Overview

Critique is a platform for collecting structured human feedback on projects. A builder creates a project with one focused question, shares it, and receives ratings plus optional private suggestions; other users can discover projects and respond. Owners review results and can share a live-count badge. The graph follows the browser-to-FastAPI flow and separates project/feedback handling, discovery and reporting, identity, and persistence. README documents the product capabilities; source excerpts and the index support the shown module relationships, while unsampled internals are not inferred.

Main entry points: [`backend/app/main.py`](https://github.com/bistadinesh03/critique/blob/main/backend/app/main.py) (FastAPI app), [`backend/app/database.py`](https://github.com/bistadinesh03/critique/blob/main/backend/app/database.py) (Database access), [`backend/app/routes_projects.py`](https://github.com/bistadinesh03/critique/blob/main/backend/app/routes_projects.py) (Project management), [`backend/app/routes_responses.py`](https://github.com/bistadinesh03/critique/blob/main/backend/app/routes_responses.py) (Feedback responses)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_browser["Browser UI"]
  node_app["FastAPI app<br/>[main.py]"]
end

subgraph group_feedback["Projects and feedback"]
  node_project["Project management<br/>[routes_projects.py]"]
  node_responses["Feedback responses"]
  node_models["Domain models<br/>[models.py]"]
  node_schemas["Request validation<br/>[schemas.py]"]
end

subgraph group_insight["Discovery and reporting"]
  node_ranking["Discover ranking<br/>[ranking.py]"]
  node_results["Results dashboard<br/>[routes_results.py]"]
  node_stats["Feedback statistics<br/>[stats.py]"]
  node_badge["Response badge<br/>[routes_badge.py]"]
  node_seo["SEO feeds<br/>[routes_seo.py]"]
end

subgraph group_identity["Identity and safety"]
  node_auth["Sign-in<br/>[auth.py]"]
  node_email["Magic-link email<br/>[email.py]"]
  node_csrf["CSRF protection<br/>[csrf.py]"]
  node_limits["Rate limiting<br/>[rate_limit.py]"]
end

subgraph group_platform["Persistence and telemetry"]
  node_database[("Database access<br/>[database.py]")]
  node_analytics["Analytics events<br/>[analytics.py]"]
  node_analytics_routes["Analytics endpoints"]
  node_dashboard["Analytics dashboard"]
end

node_visitor(("Builder or visitor"))
node_github{{"GitHub OAuth"}}
node_resend{{"Resend"}}

node_visitor -->|"uses"| node_browser
node_browser -->|"requests pages and API"| node_app
node_app -->|"routes project requests"| node_project
node_app -->|"routes feedback requests"| node_responses
node_app -->|"routes sign-in"| node_auth
node_app -->|"routes results"| node_results
node_app -->|"routes badge requests"| node_badge
node_app -->|"routes SEO requests"| node_seo
node_app -->|"routes analytics"| node_analytics_routes
node_app -->|"routes dashboard"| node_dashboard
node_project -->|"queries and writes"| node_database
node_responses -->|"queries and writes"| node_database
node_results -->|"queries feedback"| node_database
node_results -->|"aggregates with"| node_stats
node_project -->|"ranks Discover feed"| node_ranking
node_project -->|"validates input"| node_schemas
node_responses -->|"validates input"| node_schemas
node_models -->|"uses declarative base"| node_database
node_badge -->|"reads response count"| node_database
node_seo -->|"reads projects"| node_database
node_auth -->|"loads user records"| node_database
node_auth -.->|"OAuth exchange"| node_github
node_auth -->|"sends sign-in links"| node_email
node_email -.->|"delivers email"| node_resend
node_project -->|"requires owner identity"| node_auth
node_project -->|"checks request token"| node_csrf
node_project -->|"applies request limits"| node_limits
node_responses -->|"checks request token"| node_csrf
node_responses -->|"applies request limits"| node_limits
node_analytics_routes -->|"records events"| node_analytics
node_analytics_routes -->|"stores events"| node_database
node_dashboard -->|"queries events"| node_database
node_visitor -.->|"may sign in with"| node_github
node_visitor -.->|"may request email link"| node_resend

click node_browser "https://github.com/bistadinesh03/critique/tree/main/frontend"
click node_app "https://github.com/bistadinesh03/critique/blob/main/backend/app/main.py"
click node_project "https://github.com/bistadinesh03/critique/blob/main/backend/app/routes_projects.py"
click node_responses "https://github.com/bistadinesh03/critique/blob/main/backend/app/routes_responses.py"
click node_models "https://github.com/bistadinesh03/critique/blob/main/backend/app/models.py"
click node_schemas "https://github.com/bistadinesh03/critique/blob/main/backend/app/schemas.py"
click node_ranking "https://github.com/bistadinesh03/critique/blob/main/backend/app/ranking.py"
click node_results "https://github.com/bistadinesh03/critique/blob/main/backend/app/routes_results.py"
click node_stats "https://github.com/bistadinesh03/critique/blob/main/backend/app/stats.py"
click node_badge "https://github.com/bistadinesh03/critique/blob/main/backend/app/routes_badge.py"
click node_seo "https://github.com/bistadinesh03/critique/blob/main/backend/app/routes_seo.py"
click node_auth "https://github.com/bistadinesh03/critique/blob/main/backend/app/auth.py"
click node_email "https://github.com/bistadinesh03/critique/blob/main/backend/app/email.py"
click node_csrf "https://github.com/bistadinesh03/critique/blob/main/backend/app/csrf.py"
click node_limits "https://github.com/bistadinesh03/critique/blob/main/backend/app/rate_limit.py"
click node_database "https://github.com/bistadinesh03/critique/blob/main/backend/app/database.py"
click node_analytics "https://github.com/bistadinesh03/critique/blob/main/backend/app/analytics.py"
click node_analytics_routes "https://github.com/bistadinesh03/critique/blob/main/backend/app/routes_analytics.py"
click node_dashboard "https://github.com/bistadinesh03/critique/blob/main/backend/app/routes_analytics_dashboard.py"

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_browser,node_app toneBlue
class node_project,node_responses,node_models,node_schemas toneAmber
class node_ranking,node_results,node_stats,node_badge,node_seo toneMint
class node_auth,node_email,node_csrf,node_limits toneRose
class node_database,node_analytics,node_analytics_routes,node_dashboard,node_visitor,node_github,node_resend toneIndigo
```

## Components

### Web experience

- [Browser UI](https://github.com/bistadinesh03/critique/tree/main/frontend): `frontend`
- [FastAPI app](https://github.com/bistadinesh03/critique/blob/main/backend/app/main.py): `backend/app/main.py`

### Projects and feedback

- [Project management](https://github.com/bistadinesh03/critique/blob/main/backend/app/routes_projects.py): `backend/app/routes_projects.py`
- [Feedback responses](https://github.com/bistadinesh03/critique/blob/main/backend/app/routes_responses.py): `backend/app/routes_responses.py`
- [Domain models](https://github.com/bistadinesh03/critique/blob/main/backend/app/models.py): `backend/app/models.py`
- [Request validation](https://github.com/bistadinesh03/critique/blob/main/backend/app/schemas.py): `backend/app/schemas.py`

### Discovery and reporting

- [Discover ranking](https://github.com/bistadinesh03/critique/blob/main/backend/app/ranking.py): `backend/app/ranking.py`
- [Results dashboard](https://github.com/bistadinesh03/critique/blob/main/backend/app/routes_results.py): `backend/app/routes_results.py`
- [Feedback statistics](https://github.com/bistadinesh03/critique/blob/main/backend/app/stats.py): `backend/app/stats.py`
- [Response badge](https://github.com/bistadinesh03/critique/blob/main/backend/app/routes_badge.py): `backend/app/routes_badge.py`
- [SEO feeds](https://github.com/bistadinesh03/critique/blob/main/backend/app/routes_seo.py): `backend/app/routes_seo.py`

### Identity and safety

- [Sign-in](https://github.com/bistadinesh03/critique/blob/main/backend/app/auth.py): `backend/app/auth.py`
- [Magic-link email](https://github.com/bistadinesh03/critique/blob/main/backend/app/email.py): `backend/app/email.py`
- [CSRF protection](https://github.com/bistadinesh03/critique/blob/main/backend/app/csrf.py): `backend/app/csrf.py`
- [Rate limiting](https://github.com/bistadinesh03/critique/blob/main/backend/app/rate_limit.py): `backend/app/rate_limit.py`

### Persistence and telemetry

- [Database access](https://github.com/bistadinesh03/critique/blob/main/backend/app/database.py): `backend/app/database.py`
- [Analytics events](https://github.com/bistadinesh03/critique/blob/main/backend/app/analytics.py): `backend/app/analytics.py`
- [Analytics endpoints](https://github.com/bistadinesh03/critique/blob/main/backend/app/routes_analytics.py): `backend/app/routes_analytics.py`
- [Analytics dashboard](https://github.com/bistadinesh03/critique/blob/main/backend/app/routes_analytics_dashboard.py): `backend/app/routes_analytics_dashboard.py`

### Other components

- **Builder or visitor**
- **GitHub OAuth**
- **Resend**

## Connections

- Builder or visitor → Browser UI: uses (evidence: `README.md`)
- Browser UI → FastAPI app: requests pages and API (evidence: `README.md`)
- FastAPI app → Project management: routes project requests (evidence: `backend/app/main.py`)
- FastAPI app → Feedback responses: routes feedback requests (evidence: `backend/app/main.py`)
- FastAPI app → Sign-in: routes sign-in (evidence: `backend/app/main.py`)
- FastAPI app → Results dashboard: routes results (evidence: `backend/app/main.py`)
- FastAPI app → Response badge: routes badge requests (evidence: `backend/app/main.py`)
- FastAPI app → SEO feeds: routes SEO requests (evidence: `backend/app/main.py`)
- FastAPI app → Analytics endpoints: routes analytics (evidence: `backend/app/main.py`)
- FastAPI app → Analytics dashboard: routes dashboard (evidence: `backend/app/main.py`)
- Project management → Database access: queries and writes (evidence: `backend/app/routes_projects.py`)
- Feedback responses → Database access: queries and writes (evidence: `backend/app/routes_responses.py`)
- Results dashboard → Database access: queries feedback (evidence: `backend/app/routes_results.py`)
- Results dashboard → Feedback statistics: aggregates with (evidence: `backend/app/routes_results.py`)
- Project management → Discover ranking: ranks Discover feed (evidence: `backend/app/routes_projects.py`)
- Project management → Request validation: validates input (evidence: `backend/app/routes_projects.py`)
- Feedback responses → Request validation: validates input (evidence: `backend/app/routes_responses.py`)
- Domain models → Database access: uses declarative base (evidence: `backend/app/models.py`)
- Response badge → Database access: reads response count (evidence: `backend/app/routes_badge.py`)
- SEO feeds → Database access: reads projects (evidence: `backend/app/routes_seo.py`)
- Sign-in → Database access: loads user records (evidence: `backend/app/auth.py`)
- Sign-in → GitHub OAuth: OAuth exchange (evidence: `README.md`)
- Sign-in → Magic-link email: sends sign-in links (evidence: `backend/app/auth.py`)
- Magic-link email → Resend: delivers email (evidence: `README.md`)
- Project management → Sign-in: requires owner identity (evidence: `backend/app/routes_projects.py`)
- Project management → CSRF protection: checks request token (evidence: `backend/app/routes_projects.py`)
- Project management → Rate limiting: applies request limits (evidence: `backend/app/routes_projects.py`)
- Feedback responses → CSRF protection: checks request token (evidence: `backend/app/routes_responses.py`)
- Feedback responses → Rate limiting: applies request limits (evidence: `backend/app/routes_responses.py`)
- Analytics endpoints → Analytics events: records events (evidence: `backend/app/routes_analytics.py`)
- Analytics endpoints → Database access: stores events (evidence: `backend/app/routes_analytics.py`)
- Analytics dashboard → Database access: queries events (evidence: `backend/app/routes_analytics_dashboard.py`)
- Builder or visitor → GitHub OAuth: may sign in with (evidence: `README.md`)
- Builder or visitor → Resend: may request email link (evidence: `README.md`)
