# team2137/2026-frc-scouting-app architecture

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

- Interactive diagram: https://gitdiagram.com/team2137/2026-frc-scouting-app
- Repository: https://github.com/team2137/2026-frc-scouting-app

## Overview

This is a FIRST Robotics Competition scouting application: users create accounts, select an event, record pit and match observations, and review team and alliance insights. The graph separates scouting workflows, FRC event-data synchronization, analytics, and shared data infrastructure. Some feature implementations are indexed but not excerpted, so only documented or indexed relationships are shown; uncertain links are omitted.

Main entry points: [`lib/db.ts`](https://github.com/team2137/2026-frc-scouting-app/blob/main/lib/db.ts) (MongoDB connection), [`models/frc-events`](https://github.com/team2137/2026-frc-scouting-app/tree/main/models/frc-events) (FRC event records), [`app/api/insights/summaries/[eventCode]/route.ts`](https://github.com/team2137/2026-frc-scouting-app/blob/main/app/api/insights/summaries/%5BeventCode%5D/route.ts) (Match summaries), [`lib/scout`](https://github.com/team2137/2026-frc-scouting-app/tree/main/lib/scout) (Scout data operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_scouting["Scouting workflows"]
  node_scoutpage["Scouting workspace<br/>[page.tsx]"]
  node_matchlist["Match scouting list<br/>[ScoutMatches.tsx]"]
  node_matchform["Match observation form<br/>[MatchScoutForm.tsx]"]
  node_pitform["Pit observation form<br/>[PitScoutForm.tsx]"]
  node_alliancetools["Alliance pick tools<br/>[AllianceTools.tsx]"]
  node_scoutmodels[("Scout records")]
  node_scoutlib["Scout data operations"]
end

subgraph group_events["FRC event data"]
  node_selectevent["Event selection<br/>[page.tsx]"]
  node_eventapi["Event sync APIs<br/>[route.ts]"]
  node_teamapi["Team sync API<br/>[route.ts]"]
  node_scheduleapi["Schedule sync API<br/>[route.ts]"]
  node_resultsapi["Results sync API<br/>[route.ts]"]
  node_rankingapi["Rankings sync API<br/>[route.ts]"]
  node_eventmodels[("FRC event records")]
end

subgraph group_analytics["Insights and tools"]
  node_insightsui["Insights and rankings<br/>[Insights.tsx]"]
  node_matchsummaryapi["Match summaries<br/>[route.ts]"]
  node_teamsummaryapi["Team summaries<br/>[route.ts]"]
  node_eventsummaryapi["Event summary export<br/>[route.ts]"]
  node_summarymodel[("Match summary records<br/>[MatchSummary.ts]")]
  node_fpr["Fuel performance<br/>[route.ts]"]
end

subgraph group_identity["Identity and shared data"]
  node_home["Entry and auth pages<br/>[page.tsx]"]
  node_signup["Account registration<br/>[SignUpScout.tsx]"]
  node_storeuser["User persistence<br/>[storeUser.ts]"]
  node_user[("User records<br/>[User.ts]")]
  node_context["User and event context<br/>[AppContext.tsx]"]
  node_dbconn["MongoDB connection<br/>[db.ts]"]
end

node_visitor(("Scout or team user"))
node_frc["FIRST events service"]
node_mongodb[("MongoDB")]

node_visitor -->|"opens"| node_home
node_home -->|"presents"| node_signup
node_signup -->|"stores user"| node_storeuser
node_storeuser -->|"persists"| node_user
node_visitor -->|"chooses event"| node_selectevent
node_selectevent -->|"sets event"| node_context
node_context -->|"provides state"| node_scoutpage
node_scoutpage -->|"renders"| node_matchlist
node_matchlist -->|"loads schedule"| node_scoutlib
node_matchlist -->|"opens form"| node_matchform
node_matchform -.->|"uses operations"| node_scoutlib
node_pitform -.->|"uses operations"| node_scoutlib
node_alliancetools -.->|"uses operations"| node_scoutlib
node_scoutlib -.->|"reads and writes"| node_scoutmodels
node_eventapi -->|"fetches events"| node_frc
node_eventapi -->|"upserts events"| node_eventmodels
node_teamapi -->|"stores teams"| node_eventmodels
node_scheduleapi -->|"stores schedule"| node_eventmodels
node_resultsapi -->|"stores results"| node_eventmodels
node_rankingapi -->|"stores rankings"| node_eventmodels
node_insightsui -.->|"requests summaries"| node_matchsummaryapi
node_matchsummaryapi -->|"reads match data"| node_eventmodels
node_matchsummaryapi -->|"reads scout data"| node_scoutmodels
node_matchsummaryapi -->|"upserts summaries"| node_summarymodel
node_teamsummaryapi -->|"aggregates summaries"| node_summarymodel
node_eventsummaryapi -->|"reads summaries"| node_summarymodel
node_fpr -.->|"uses database"| node_mongodb
node_dbconn -->|"connects"| node_mongodb
node_eventapi -->|"connects"| node_dbconn
node_scheduleapi -->|"connects"| node_dbconn
node_resultsapi -->|"connects"| node_dbconn
node_rankingapi -->|"connects"| node_dbconn
node_matchsummaryapi -->|"connects"| node_dbconn
node_teamsummaryapi -->|"connects"| node_dbconn

click node_home "https://github.com/team2137/2026-frc-scouting-app/blob/main/app/page.tsx"
click node_signup "https://github.com/team2137/2026-frc-scouting-app/blob/main/components/auth/SignUpScout.tsx"
click node_storeuser "https://github.com/team2137/2026-frc-scouting-app/blob/main/lib/auth/storeUser.ts"
click node_user "https://github.com/team2137/2026-frc-scouting-app/blob/main/models/auth/User.ts"
click node_context "https://github.com/team2137/2026-frc-scouting-app/blob/main/context/AppContext.tsx"
click node_selectevent "https://github.com/team2137/2026-frc-scouting-app/blob/main/app/selectevent/page.tsx"
click node_scoutpage "https://github.com/team2137/2026-frc-scouting-app/blob/main/app/scout/page.tsx"
click node_matchlist "https://github.com/team2137/2026-frc-scouting-app/blob/main/components/scout/ScoutMatches.tsx"
click node_matchform "https://github.com/team2137/2026-frc-scouting-app/blob/main/components/scout/MatchScoutForm.tsx"
click node_pitform "https://github.com/team2137/2026-frc-scouting-app/blob/main/components/scout/PitScoutForm.tsx"
click node_alliancetools "https://github.com/team2137/2026-frc-scouting-app/blob/main/components/scout/AllianceTools.tsx"
click node_scoutmodels "https://github.com/team2137/2026-frc-scouting-app/tree/main/models/scout"
click node_scoutlib "https://github.com/team2137/2026-frc-scouting-app/tree/main/lib/scout"
click node_eventapi "https://github.com/team2137/2026-frc-scouting-app/blob/main/app/api/frc-events/pulleventstodb/route.ts"
click node_teamapi "https://github.com/team2137/2026-frc-scouting-app/blob/main/app/api/frc-events/pullteamstodb/route.ts"
click node_scheduleapi "https://github.com/team2137/2026-frc-scouting-app/blob/main/app/api/frc-events/pulltodb/geteventschedule/route.ts"
click node_resultsapi "https://github.com/team2137/2026-frc-scouting-app/blob/main/app/api/frc-events/pulltodb/getmatchresults/route.ts"
click node_rankingapi "https://github.com/team2137/2026-frc-scouting-app/blob/main/app/api/frc-events/pulltodb/geteventrankings/route.ts"
click node_eventmodels "https://github.com/team2137/2026-frc-scouting-app/tree/main/models/frc-events"
click node_insightsui "https://github.com/team2137/2026-frc-scouting-app/blob/main/components/scout/Insights.tsx"
click node_matchsummaryapi "https://github.com/team2137/2026-frc-scouting-app/blob/main/app/api/insights/summaries/%5BeventCode%5D/route.ts"
click node_teamsummaryapi "https://github.com/team2137/2026-frc-scouting-app/blob/main/app/api/insights/teamsummaries/%5BeventCode%5D/route.ts"
click node_eventsummaryapi "https://github.com/team2137/2026-frc-scouting-app/blob/main/app/api/insights/sumevent/route.ts"
click node_summarymodel "https://github.com/team2137/2026-frc-scouting-app/blob/main/models/insights/MatchSummary.ts"
click node_fpr "https://github.com/team2137/2026-frc-scouting-app/blob/main/app/api/fpr/route.ts"
click node_dbconn "https://github.com/team2137/2026-frc-scouting-app/blob/main/lib/db.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_scoutpage,node_matchlist,node_matchform,node_pitform,node_alliancetools,node_scoutmodels,node_scoutlib,node_visitor toneBlue
class node_selectevent,node_eventapi,node_teamapi,node_scheduleapi,node_resultsapi,node_rankingapi,node_eventmodels,node_mongodb toneAmber
class node_insightsui,node_matchsummaryapi,node_teamsummaryapi,node_eventsummaryapi,node_summarymodel,node_fpr toneMint
class node_home,node_signup,node_storeuser,node_user,node_context,node_dbconn toneRose
class node_frc toneIndigo
```

## Components

### Scouting workflows

- [Scouting workspace](https://github.com/team2137/2026-frc-scouting-app/blob/main/app/scout/page.tsx): `app/scout/page.tsx`
- [Match scouting list](https://github.com/team2137/2026-frc-scouting-app/blob/main/components/scout/ScoutMatches.tsx): `components/scout/ScoutMatches.tsx`
- [Match observation form](https://github.com/team2137/2026-frc-scouting-app/blob/main/components/scout/MatchScoutForm.tsx): `components/scout/MatchScoutForm.tsx`
- [Pit observation form](https://github.com/team2137/2026-frc-scouting-app/blob/main/components/scout/PitScoutForm.tsx): `components/scout/PitScoutForm.tsx`
- [Alliance pick tools](https://github.com/team2137/2026-frc-scouting-app/blob/main/components/scout/AllianceTools.tsx): `components/scout/AllianceTools.tsx`
- [Scout records](https://github.com/team2137/2026-frc-scouting-app/tree/main/models/scout): `models/scout`
- [Scout data operations](https://github.com/team2137/2026-frc-scouting-app/tree/main/lib/scout): `lib/scout`

### FRC event data

- [Event selection](https://github.com/team2137/2026-frc-scouting-app/blob/main/app/selectevent/page.tsx): `app/selectevent/page.tsx`
- [Event sync APIs](https://github.com/team2137/2026-frc-scouting-app/blob/main/app/api/frc-events/pulleventstodb/route.ts): `app/api/frc-events/pulleventstodb/route.ts`
- [Team sync API](https://github.com/team2137/2026-frc-scouting-app/blob/main/app/api/frc-events/pullteamstodb/route.ts): `app/api/frc-events/pullteamstodb/route.ts`
- [Schedule sync API](https://github.com/team2137/2026-frc-scouting-app/blob/main/app/api/frc-events/pulltodb/geteventschedule/route.ts): `app/api/frc-events/pulltodb/geteventschedule/route.ts`
- [Results sync API](https://github.com/team2137/2026-frc-scouting-app/blob/main/app/api/frc-events/pulltodb/getmatchresults/route.ts): `app/api/frc-events/pulltodb/getmatchresults/route.ts`
- [Rankings sync API](https://github.com/team2137/2026-frc-scouting-app/blob/main/app/api/frc-events/pulltodb/geteventrankings/route.ts): `app/api/frc-events/pulltodb/geteventrankings/route.ts`
- [FRC event records](https://github.com/team2137/2026-frc-scouting-app/tree/main/models/frc-events): `models/frc-events`

### Insights and tools

- [Insights and rankings](https://github.com/team2137/2026-frc-scouting-app/blob/main/components/scout/Insights.tsx): `components/scout/Insights.tsx`
- [Match summaries](https://github.com/team2137/2026-frc-scouting-app/blob/main/app/api/insights/summaries/%5BeventCode%5D/route.ts): `app/api/insights/summaries/[eventCode]/route.ts`
- [Team summaries](https://github.com/team2137/2026-frc-scouting-app/blob/main/app/api/insights/teamsummaries/%5BeventCode%5D/route.ts): `app/api/insights/teamsummaries/[eventCode]/route.ts`
- [Event summary export](https://github.com/team2137/2026-frc-scouting-app/blob/main/app/api/insights/sumevent/route.ts): `app/api/insights/sumevent/route.ts`
- [Match summary records](https://github.com/team2137/2026-frc-scouting-app/blob/main/models/insights/MatchSummary.ts): `models/insights/MatchSummary.ts`
- [Fuel performance](https://github.com/team2137/2026-frc-scouting-app/blob/main/app/api/fpr/route.ts): `app/api/fpr/route.ts`

### Identity and shared data

- [Entry and auth pages](https://github.com/team2137/2026-frc-scouting-app/blob/main/app/page.tsx): `app/page.tsx`
- [Account registration](https://github.com/team2137/2026-frc-scouting-app/blob/main/components/auth/SignUpScout.tsx): `components/auth/SignUpScout.tsx`
- [User persistence](https://github.com/team2137/2026-frc-scouting-app/blob/main/lib/auth/storeUser.ts): `lib/auth/storeUser.ts`
- [User records](https://github.com/team2137/2026-frc-scouting-app/blob/main/models/auth/User.ts): `models/auth/User.ts`
- [User and event context](https://github.com/team2137/2026-frc-scouting-app/blob/main/context/AppContext.tsx): `context/AppContext.tsx`
- [MongoDB connection](https://github.com/team2137/2026-frc-scouting-app/blob/main/lib/db.ts): `lib/db.ts`

### Other components

- **Scout or team user**
- **FIRST events service**
- **MongoDB**

## Connections

- Scout or team user → Entry and auth pages: opens (evidence: `app/page.tsx`)
- Entry and auth pages → Account registration: presents (evidence: `app/page.tsx`)
- Account registration → User persistence: stores user (evidence: `components/auth/SignUpScout.tsx`)
- User persistence → User records: persists (evidence: `components/auth/SignUpScout.tsx`)
- Scout or team user → Event selection: chooses event (evidence: `app/selectevent/page.tsx`)
- Event selection → User and event context: sets event (evidence: `app/selectevent/page.tsx`)
- User and event context → Scouting workspace: provides state (evidence: `app/scout/page.tsx`)
- Scouting workspace → Match scouting list: renders (evidence: `app/scout/page.tsx`)
- Match scouting list → Scout data operations: loads schedule (evidence: `components/scout/ScoutMatches.tsx`)
- Match scouting list → Match observation form: opens form (evidence: `components/scout/ScoutMatches.tsx`)
- Match observation form → Scout data operations: uses operations
- Pit observation form → Scout data operations: uses operations
- Alliance pick tools → Scout data operations: uses operations
- Scout data operations → Scout records: reads and writes
- Event sync APIs → FIRST events service: fetches events (evidence: `app/api/frc-events/pulleventstodb/route.ts`)
- Event sync APIs → FRC event records: upserts events (evidence: `app/api/frc-events/pulleventstodb/route.ts`)
- Team sync API → FRC event records: stores teams (evidence: `app/api/frc-events/pullteamstodb/route.ts`)
- Schedule sync API → FRC event records: stores schedule (evidence: `app/api/frc-events/pulltodb/geteventschedule/route.ts`)
- Results sync API → FRC event records: stores results (evidence: `app/api/frc-events/pulltodb/getmatchresults/route.ts`)
- Rankings sync API → FRC event records: stores rankings (evidence: `app/api/frc-events/pulltodb/geteventrankings/route.ts`)
- Insights and rankings → Match summaries: requests summaries
- Match summaries → FRC event records: reads match data (evidence: `app/api/insights/summaries/[eventCode]/route.ts`)
- Match summaries → Scout records: reads scout data (evidence: `app/api/insights/summaries/[eventCode]/route.ts`)
- Match summaries → Match summary records: upserts summaries (evidence: `app/api/insights/summaries/[eventCode]/route.ts`)
- Team summaries → Match summary records: aggregates summaries (evidence: `app/api/insights/teamsummaries/[eventCode]/route.ts`)
- Event summary export → Match summary records: reads summaries (evidence: `app/api/insights/sumevent/route.ts`)
- Fuel performance → MongoDB: uses database
- MongoDB connection → MongoDB: connects (evidence: `lib/db.ts`)
- Event sync APIs → MongoDB connection: connects (evidence: `app/api/frc-events/pulleventstodb/route.ts`)
- Schedule sync API → MongoDB connection: connects (evidence: `app/api/frc-events/pulltodb/geteventschedule/route.ts`)
- Results sync API → MongoDB connection: connects (evidence: `app/api/frc-events/pulltodb/getmatchresults/route.ts`)
- Rankings sync API → MongoDB connection: connects (evidence: `app/api/frc-events/pulltodb/geteventrankings/route.ts`)
- Match summaries → MongoDB connection: connects (evidence: `app/api/insights/summaries/[eventCode]/route.ts`)
- Team summaries → MongoDB connection: connects (evidence: `app/api/insights/teamsummaries/[eventCode]/route.ts`)
