# mofc-endhunger/freshtrak-registration-api architecture

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

- Interactive diagram: https://gitdiagram.com/mofc-endhunger/freshtrak-registration-api
- Repository: https://github.com/mofc-endhunger/freshtrak-registration-api

## Overview

Freshtrak Registration API exposes selected pre-registration data and account operations. The main workflow is an API client creating or managing a user, household, or reservation; reservation creation also checks event availability and can synchronize with PantryTrak. Facebook callbacks and guest authentication provide account entry points, while SMS and email routes expose communications endpoints. The graph keeps these product areas distinct. Some controller and integration implementations are unsampled, so links not established by the excerpts or README are omitted.

Main entry points: [`config/routes.rb`](https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/config/routes.rb) (HTTP Routes), [`app/controllers/auth_callbacks_controller.rb`](https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/controllers/auth_callbacks_controller.rb) (Facebook Callback), [`app/controllers/api/reservations_controller.rb`](https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/controllers/api/reservations_controller.rb) (Reservation API), [`app/controllers/twilio_controller.rb`](https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/controllers/twilio_controller.rb) (Communications Routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Registration API"]
  node_routes["HTTP Routes<br/>[routes.rb]"]
  node_api_base["API Base<br/>[base_controller.rb]"]
  node_users["User API"]
  node_households["Household API"]
  node_reservations["Reservation API"]
end

subgraph group_identity["Identity and Access"]
  node_facebook_callback["Facebook Callback"]
  node_guest_auth["Guest Authentication"]
  node_authentication["Authentication Records<br/>[authentication.rb]"]
  node_auth_serializer["Auth Serializer"]
end

subgraph group_domain["Registration Data"]
  node_reservation_service["Reservation Creation"]
  node_user_model["Users<br/>[user.rb]"]
  node_household_model["Households<br/>[household.rb]"]
  node_reservation_model["Reservations<br/>[reservation.rb]"]
  node_database[("MySQL Database")]
end

subgraph group_integrations["External Integrations"]
  node_facebook_api["Facebook Verification<br/>[facebook_api.rb]"]
  node_pantry_finder["Event Availability"]
  node_pantrytrak["PantryTrak Client<br/>[client.rb]"]
  node_twilio_controller["Communications Routes"]
  node_sms["SMS Sender<br/>[sms.rb]"]
  node_email["Email Sender<br/>[email.rb]"]
  node_pantrytrak_service(("PantryTrak Service"))
end

node_client(("API Client"))
node_facebook(("Facebook"))

node_client -->|"sends requests"| node_routes
node_routes -->|"routes to"| node_households
node_routes -->|"routes to"| node_reservations
node_routes -->|"routes to"| node_users
node_routes -->|"routes to"| node_facebook_callback
node_routes -->|"routes to"| node_guest_auth
node_routes -->|"routes to"| node_twilio_controller
node_households -->|"creates and updates"| node_household_model
node_facebook_callback -->|"verifies token"| node_facebook_api
node_facebook_callback -->|"creates or finds"| node_authentication
node_facebook_callback -->|"serializes response"| node_auth_serializer
node_facebook -->|"submits callback"| node_facebook_callback
node_household_model -.->|"persists"| node_database
node_reservation_model -.->|"persists"| node_database
node_user_model -.->|"persists"| node_database
node_reservations -.->|"creates reservation"| node_reservation_service
node_reservation_service -.->|"checks availability"| node_pantry_finder
node_reservations -.->|"synchronizes"| node_pantrytrak
node_pantrytrak -.->|"sends requests"| node_pantrytrak_service
node_twilio_controller -.->|"dispatches SMS"| node_sms
node_twilio_controller -.->|"dispatches email"| node_email

click node_routes "https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/config/routes.rb"
click node_api_base "https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/controllers/api/base_controller.rb"
click node_users "https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/controllers/api/users_controller.rb"
click node_households "https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/controllers/api/households_controller.rb"
click node_reservations "https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/controllers/api/reservations_controller.rb"
click node_reservation_service "https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/services/create_reservation.rb"
click node_user_model "https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/models/user.rb"
click node_household_model "https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/models/household.rb"
click node_reservation_model "https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/models/reservation.rb"
click node_facebook_callback "https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/controllers/auth_callbacks_controller.rb"
click node_guest_auth "https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/controllers/guest_authentications_controller.rb"
click node_authentication "https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/models/authentication.rb"
click node_auth_serializer "https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/serializers/authentication_serializer.rb"
click node_facebook_api "https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/lib/facebook_api.rb"
click node_pantry_finder "https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/lib/pantry_finder_api.rb"
click node_pantrytrak "https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/lib/pantry_trak/client.rb"
click node_twilio_controller "https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/controllers/twilio_controller.rb"
click node_sms "https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/lib/twilio/sms.rb"
click node_email "https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/lib/twilio/email.rb"

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_routes,node_api_base,node_users,node_households,node_reservations,node_client toneBlue
class node_facebook_callback,node_guest_auth,node_authentication,node_auth_serializer toneAmber
class node_reservation_service,node_user_model,node_household_model,node_reservation_model,node_database toneMint
class node_facebook_api,node_pantry_finder,node_pantrytrak,node_twilio_controller,node_sms,node_email,node_pantrytrak_service toneRose
class node_facebook toneIndigo
```

## Components

### Registration API

- [HTTP Routes](https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/config/routes.rb): `config/routes.rb`
- [API Base](https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/controllers/api/base_controller.rb): `app/controllers/api/base_controller.rb`
- [User API](https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/controllers/api/users_controller.rb): `app/controllers/api/users_controller.rb`
- [Household API](https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/controllers/api/households_controller.rb): `app/controllers/api/households_controller.rb`
- [Reservation API](https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/controllers/api/reservations_controller.rb): `app/controllers/api/reservations_controller.rb`

### Identity and Access

- [Facebook Callback](https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/controllers/auth_callbacks_controller.rb): `app/controllers/auth_callbacks_controller.rb`
- [Guest Authentication](https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/controllers/guest_authentications_controller.rb): `app/controllers/guest_authentications_controller.rb`
- [Authentication Records](https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/models/authentication.rb): `app/models/authentication.rb`
- [Auth Serializer](https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/serializers/authentication_serializer.rb): `app/serializers/authentication_serializer.rb`

### Registration Data

- [Reservation Creation](https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/services/create_reservation.rb): `app/services/create_reservation.rb`
- [Users](https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/models/user.rb): `app/models/user.rb`
- [Households](https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/models/household.rb): `app/models/household.rb`
- [Reservations](https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/models/reservation.rb): `app/models/reservation.rb`
- **MySQL Database**

### External Integrations

- [Facebook Verification](https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/lib/facebook_api.rb): `app/lib/facebook_api.rb`
- [Event Availability](https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/lib/pantry_finder_api.rb): `app/lib/pantry_finder_api.rb`
- [PantryTrak Client](https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/lib/pantry_trak/client.rb): `app/lib/pantry_trak/client.rb`
- [Communications Routes](https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/controllers/twilio_controller.rb): `app/controllers/twilio_controller.rb`
- [SMS Sender](https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/lib/twilio/sms.rb): `app/lib/twilio/sms.rb`
- [Email Sender](https://github.com/mofc-endhunger/freshtrak-registration-api/blob/master/app/lib/twilio/email.rb): `app/lib/twilio/email.rb`
- **PantryTrak Service**

### Other components

- **API Client**
- **Facebook**

## Connections

- API Client → HTTP Routes: sends requests (evidence: `config/routes.rb`)
- HTTP Routes → Household API: routes to (evidence: `config/routes.rb`)
- HTTP Routes → Reservation API: routes to (evidence: `config/routes.rb`)
- HTTP Routes → User API: routes to (evidence: `config/routes.rb`)
- HTTP Routes → Facebook Callback: routes to (evidence: `config/routes.rb`)
- HTTP Routes → Guest Authentication: routes to (evidence: `config/routes.rb`)
- HTTP Routes → Communications Routes: routes to (evidence: `config/routes.rb`)
- Household API → Households: creates and updates (evidence: `app/controllers/api/households_controller.rb`)
- Facebook Callback → Facebook Verification: verifies token (evidence: `app/controllers/auth_callbacks_controller.rb`)
- Facebook Callback → Authentication Records: creates or finds (evidence: `app/controllers/auth_callbacks_controller.rb`)
- Facebook Callback → Auth Serializer: serializes response (evidence: `app/controllers/auth_callbacks_controller.rb`)
- Facebook → Facebook Callback: submits callback
- Households → MySQL Database: persists
- Reservations → MySQL Database: persists
- Users → MySQL Database: persists
- Reservation API → Reservation Creation: creates reservation
- Reservation Creation → Event Availability: checks availability
- Reservation API → PantryTrak Client: synchronizes
- PantryTrak Client → PantryTrak Service: sends requests
- Communications Routes → SMS Sender: dispatches SMS
- Communications Routes → Email Sender: dispatches email
