# jadamduff/commission-tracker architecture

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

- Interactive diagram: https://gitdiagram.com/jadamduff/commission-tracker
- Repository: https://github.com/jadamduff/commission-tracker

## Overview

Commission Tracker is a Rails web app for managers to configure products and commissions, and employees to record sales and track earnings. The main workflow runs from routed user requests through account/session or manager/employee controllers to product and sale records, then serves profile and sales views or JSON. The graph also shows manager and employee profile paths and product/sales reporting routes. Some controllers and model implementations were not sampled, so uncertain internal calls and serialization wiring are omitted.

Main entry points: [`config/routes.rb`](https://github.com/jadamduff/commission-tracker/blob/master/config/routes.rb) (Rails routes), [`app/controllers/products_controller.rb`](https://github.com/jadamduff/commission-tracker/blob/master/app/controllers/products_controller.rb) (Product actions), [`app/controllers/sales_controller.rb`](https://github.com/jadamduff/commission-tracker/blob/master/app/controllers/sales_controller.rb) (Sale actions), [`app/controllers/sessions_controller.rb`](https://github.com/jadamduff/commission-tracker/blob/master/app/controllers/sessions_controller.rb) (Sessions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Web entry"]
  node_routes["Rails routes<br/>[routes.rb]"]
end

subgraph group_accounts["Accounts and roles"]
  node_sessions["Sessions"]
  node_users["User profiles"]
  node_employees["Employee profiles"]
  node_managers["Manager profiles"]
  node_user_model["User records<br/>[user.rb]"]
  node_manager_employee["Manager assignments"]
end

subgraph group_catalog["Products and commissions"]
  node_products["Product actions"]
  node_product_helper["Product pricing<br/>[products_helper.rb]"]
  node_product_model["Product records<br/>[product.rb]"]
end

subgraph group_sales["Sales and reporting"]
  node_sales["Sale actions"]
  node_sale_model["Sale records<br/>[sale.rb]"]
  node_sales_report["Sales reporting<br/>[sale.rb]"]
end

node_user(("Manager or employee"))
node_database[("Application database<br/>[schema.rb]")]
node_facebook{{"Facebook sign-in"}}

node_user -->|"sends request"| node_routes
node_routes -->|"dispatches"| node_sessions
node_routes -->|"dispatches"| node_users
node_routes -->|"dispatches"| node_employees
node_routes -->|"dispatches"| node_managers
node_routes -->|"dispatches"| node_products
node_routes -->|"dispatches"| node_sales
node_sessions -->|"finds or creates"| node_user_model
node_sessions -.->|"accepts callback"| node_facebook
node_users -->|"creates and reads"| node_user_model
node_users -->|"assigns employee"| node_manager_employee
node_employees -->|"reads profiles"| node_user_model
node_managers -->|"reads profiles"| node_user_model
node_managers -->|"reads products"| node_product_model
node_products -->|"sets price"| node_product_helper
node_products -->|"creates and updates"| node_product_model
node_products -->|"deletes related sales"| node_sale_model
node_sales -->|"creates and updates"| node_sale_model
node_sales -->|"reads products"| node_product_model
node_sales -->|"requests quantity order"| node_sales_report
node_sessions -->|"persists account"| node_database
node_users -->|"persists profile"| node_database
node_products -->|"persists products"| node_database
node_sales -->|"persists sales"| node_database

click node_routes "https://github.com/jadamduff/commission-tracker/blob/master/config/routes.rb"
click node_sessions "https://github.com/jadamduff/commission-tracker/blob/master/app/controllers/sessions_controller.rb"
click node_users "https://github.com/jadamduff/commission-tracker/blob/master/app/controllers/users_controller.rb"
click node_employees "https://github.com/jadamduff/commission-tracker/blob/master/app/controllers/employees_controller.rb"
click node_managers "https://github.com/jadamduff/commission-tracker/blob/master/app/controllers/managers_controller.rb"
click node_user_model "https://github.com/jadamduff/commission-tracker/blob/master/app/models/user.rb"
click node_manager_employee "https://github.com/jadamduff/commission-tracker/blob/master/app/models/manager_employee.rb"
click node_products "https://github.com/jadamduff/commission-tracker/blob/master/app/controllers/products_controller.rb"
click node_product_helper "https://github.com/jadamduff/commission-tracker/blob/master/app/helpers/products_helper.rb"
click node_product_model "https://github.com/jadamduff/commission-tracker/blob/master/app/models/product.rb"
click node_sales "https://github.com/jadamduff/commission-tracker/blob/master/app/controllers/sales_controller.rb"
click node_sale_model "https://github.com/jadamduff/commission-tracker/blob/master/app/models/sale.rb"
click node_sales_report "https://github.com/jadamduff/commission-tracker/blob/master/app/models/sale.rb"
click node_database "https://github.com/jadamduff/commission-tracker/blob/master/db/schema.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 toneBlue
class node_sessions,node_users,node_employees,node_managers,node_user_model,node_manager_employee,node_database toneAmber
class node_products,node_product_helper,node_product_model toneMint
class node_sales,node_sale_model,node_sales_report toneRose
class node_user,node_facebook toneIndigo
```

## Components

### Web entry

- [Rails routes](https://github.com/jadamduff/commission-tracker/blob/master/config/routes.rb): `config/routes.rb`

### Accounts and roles

- [Sessions](https://github.com/jadamduff/commission-tracker/blob/master/app/controllers/sessions_controller.rb): `app/controllers/sessions_controller.rb`
- [User profiles](https://github.com/jadamduff/commission-tracker/blob/master/app/controllers/users_controller.rb): `app/controllers/users_controller.rb`
- [Employee profiles](https://github.com/jadamduff/commission-tracker/blob/master/app/controllers/employees_controller.rb): `app/controllers/employees_controller.rb`
- [Manager profiles](https://github.com/jadamduff/commission-tracker/blob/master/app/controllers/managers_controller.rb): `app/controllers/managers_controller.rb`
- [User records](https://github.com/jadamduff/commission-tracker/blob/master/app/models/user.rb): `app/models/user.rb`
- [Manager assignments](https://github.com/jadamduff/commission-tracker/blob/master/app/models/manager_employee.rb): `app/models/manager_employee.rb`

### Products and commissions

- [Product actions](https://github.com/jadamduff/commission-tracker/blob/master/app/controllers/products_controller.rb): `app/controllers/products_controller.rb`
- [Product pricing](https://github.com/jadamduff/commission-tracker/blob/master/app/helpers/products_helper.rb): `app/helpers/products_helper.rb`
- [Product records](https://github.com/jadamduff/commission-tracker/blob/master/app/models/product.rb): `app/models/product.rb`

### Sales and reporting

- [Sale actions](https://github.com/jadamduff/commission-tracker/blob/master/app/controllers/sales_controller.rb): `app/controllers/sales_controller.rb`
- [Sale records](https://github.com/jadamduff/commission-tracker/blob/master/app/models/sale.rb): `app/models/sale.rb`
- [Sales reporting](https://github.com/jadamduff/commission-tracker/blob/master/app/models/sale.rb): `app/models/sale.rb`

### Other components

- **Manager or employee**
- [Application database](https://github.com/jadamduff/commission-tracker/blob/master/db/schema.rb): `db/schema.rb`
- **Facebook sign-in**

## Connections

- Manager or employee → Rails routes: sends request
- Rails routes → Sessions: dispatches
- Rails routes → User profiles: dispatches
- Rails routes → Employee profiles: dispatches
- Rails routes → Manager profiles: dispatches
- Rails routes → Product actions: dispatches
- Rails routes → Sale actions: dispatches
- Sessions → User records: finds or creates
- Sessions → Facebook sign-in: accepts callback
- User profiles → User records: creates and reads
- User profiles → Manager assignments: assigns employee
- Employee profiles → User records: reads profiles
- Manager profiles → User records: reads profiles
- Manager profiles → Product records: reads products
- Product actions → Product pricing: sets price
- Product actions → Product records: creates and updates
- Product actions → Sale records: deletes related sales
- Sale actions → Sale records: creates and updates
- Sale actions → Product records: reads products
- Sale actions → Sales reporting: requests quantity order
- Sessions → Application database: persists account
- User profiles → Application database: persists profile
- Product actions → Application database: persists products
- Sale actions → Application database: persists sales
