# smashing/smashing architecture

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

- Interactive diagram: https://gitdiagram.com/smashing/smashing
- Repository: https://github.com/smashing/smashing

## Overview

Smashing is a Sinatra-based framework for creating and serving real-time dashboards. The main workflow is: a user creates a project with the CLI, starts its server, dashboard pages render widgets, scheduled jobs publish events, and connected browsers receive those events over server-sent events. The repository also includes generators and Gist-based widget installation. The map reflects documented and excerpted behavior; generated-project wiring and several frontend asset relationships were not sampled, so those links are omitted where unverified.

Main entry points: [`lib/dashing/cli.rb`](https://github.com/smashing/smashing/blob/master/lib/dashing/cli.rb) (Smashing CLI), [`lib/dashing/app.rb`](https://github.com/smashing/smashing/blob/master/lib/dashing/app.rb) (Sinatra app), [`templates/project/dashboards/layout.erb`](https://github.com/smashing/smashing/blob/master/templates/project/dashboards/layout.erb) (Dashboard layout), [`javascripts/batman.jquery.js`](https://github.com/smashing/smashing/blob/master/javascripts/batman.jquery.js) (jQuery adapter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_project["Project creation"]
  node_cli["Smashing CLI<br/>[cli.rb]"]
  node_project_template["Project template"]
  node_generators["Resource templates"]
  node_downloader["Gist downloader<br/>[downloader.rb]"]
end

subgraph group_server["Dashboard server"]
  node_server_app["Sinatra app<br/>[app.rb]"]
  node_dashboard_views["Dashboard views"]
  node_widget_views["Widget views"]
end

subgraph group_updates["Live updates"]
  node_jobs["Scheduled jobs"]
  node_event_dispatch["Event dispatch<br/>[app.rb]"]
  node_event_history[("Event history<br/>[app.rb]")]
end

subgraph group_frontend["Browser interface"]
  node_dashboard_layout["Dashboard layout<br/>[layout.erb]"]
  node_widget_components["Widget components"]
  node_application_js["Project JavaScript<br/>[application.coffee]"]
  node_batman["Batman framework<br/>[batman.js]"]
  node_jquery["jQuery<br/>[jquery.js]"]
  node_batman_jquery["jQuery adapter<br/>[batman.jquery.js]"]
  node_es5["ES5 shim<br/>[es5-shim.js]"]
  node_dashboard_assets["Dashboard assets"]
end

node_user(("Dashboard builder"))
node_github["GitHub Gists"]
node_browser(("Dashboard viewer"))

node_user -->|"creates or starts"| node_cli
node_cli -->|"generates project"| node_project_template
node_cli -->|"generates resources"| node_generators
node_cli -->|"requests Gist"| node_downloader
node_downloader -->|"fetches Gist"| node_github
node_cli -->|"starts server"| node_server_app
node_server_app -->|"renders dashboard"| node_dashboard_views
node_server_app -->|"serves widget view"| node_widget_views
node_jobs -->|"publishes events"| node_event_dispatch
node_server_app -->|"routes event posts"| node_event_dispatch
node_event_dispatch -->|"stores events"| node_event_history
node_event_dispatch -->|"streams events"| node_browser
node_browser -->|"views dashboard"| node_dashboard_layout
node_dashboard_layout -.->|"presents widgets"| node_widget_components
node_application_js -.->|"uses framework"| node_batman
node_batman_jquery -->|"extends DOM"| node_batman
node_batman_jquery -->|"uses AJAX and DOM"| node_jquery
node_dashboard_layout -.->|"uses assets"| node_dashboard_assets
node_es5 -.->|"supports compatibility"| node_browser

click node_cli "https://github.com/smashing/smashing/blob/master/lib/dashing/cli.rb"
click node_project_template "https://github.com/smashing/smashing/tree/master/templates/project"
click node_generators "https://github.com/smashing/smashing/tree/master/templates"
click node_downloader "https://github.com/smashing/smashing/blob/master/lib/dashing/downloader.rb"
click node_server_app "https://github.com/smashing/smashing/blob/master/lib/dashing/app.rb"
click node_dashboard_views "https://github.com/smashing/smashing/tree/master/templates/project/dashboards"
click node_widget_views "https://github.com/smashing/smashing/tree/master/templates/project/widgets"
click node_jobs "https://github.com/smashing/smashing/tree/master/templates/project/jobs"
click node_event_dispatch "https://github.com/smashing/smashing/blob/master/lib/dashing/app.rb"
click node_event_history "https://github.com/smashing/smashing/blob/master/lib/dashing/app.rb"
click node_dashboard_layout "https://github.com/smashing/smashing/blob/master/templates/project/dashboards/layout.erb"
click node_widget_components "https://github.com/smashing/smashing/tree/master/templates/project/widgets"
click node_application_js "https://github.com/smashing/smashing/blob/master/templates/project/assets/javascripts/application.coffee"
click node_batman "https://github.com/smashing/smashing/blob/master/javascripts/batman.js"
click node_jquery "https://github.com/smashing/smashing/blob/master/javascripts/jquery.js"
click node_batman_jquery "https://github.com/smashing/smashing/blob/master/javascripts/batman.jquery.js"
click node_es5 "https://github.com/smashing/smashing/blob/master/javascripts/es5-shim.js"
click node_dashboard_assets "https://github.com/smashing/smashing/tree/master/templates/project/assets"

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_cli,node_project_template,node_generators,node_downloader,node_browser toneBlue
class node_server_app,node_dashboard_views,node_widget_views toneAmber
class node_jobs,node_event_dispatch,node_event_history toneMint
class node_dashboard_layout,node_widget_components,node_application_js,node_batman,node_jquery,node_batman_jquery,node_es5,node_dashboard_assets toneRose
class node_user,node_github toneIndigo
```

## Components

### Project creation

- [Smashing CLI](https://github.com/smashing/smashing/blob/master/lib/dashing/cli.rb): `lib/dashing/cli.rb`
- [Project template](https://github.com/smashing/smashing/tree/master/templates/project): `templates/project`
- [Resource templates](https://github.com/smashing/smashing/tree/master/templates): `templates`
- [Gist downloader](https://github.com/smashing/smashing/blob/master/lib/dashing/downloader.rb): `lib/dashing/downloader.rb`

### Dashboard server

- [Sinatra app](https://github.com/smashing/smashing/blob/master/lib/dashing/app.rb): `lib/dashing/app.rb`
- [Dashboard views](https://github.com/smashing/smashing/tree/master/templates/project/dashboards): `templates/project/dashboards`
- [Widget views](https://github.com/smashing/smashing/tree/master/templates/project/widgets): `templates/project/widgets`

### Live updates

- [Scheduled jobs](https://github.com/smashing/smashing/tree/master/templates/project/jobs): `templates/project/jobs`
- [Event dispatch](https://github.com/smashing/smashing/blob/master/lib/dashing/app.rb): `lib/dashing/app.rb`
- [Event history](https://github.com/smashing/smashing/blob/master/lib/dashing/app.rb): `lib/dashing/app.rb`

### Browser interface

- [Dashboard layout](https://github.com/smashing/smashing/blob/master/templates/project/dashboards/layout.erb): `templates/project/dashboards/layout.erb`
- [Widget components](https://github.com/smashing/smashing/tree/master/templates/project/widgets): `templates/project/widgets`
- [Project JavaScript](https://github.com/smashing/smashing/blob/master/templates/project/assets/javascripts/application.coffee): `templates/project/assets/javascripts/application.coffee`
- [Batman framework](https://github.com/smashing/smashing/blob/master/javascripts/batman.js): `javascripts/batman.js`
- [jQuery](https://github.com/smashing/smashing/blob/master/javascripts/jquery.js): `javascripts/jquery.js`
- [jQuery adapter](https://github.com/smashing/smashing/blob/master/javascripts/batman.jquery.js): `javascripts/batman.jquery.js`
- [ES5 shim](https://github.com/smashing/smashing/blob/master/javascripts/es5-shim.js): `javascripts/es5-shim.js`
- [Dashboard assets](https://github.com/smashing/smashing/tree/master/templates/project/assets): `templates/project/assets`

### Other components

- **Dashboard builder**
- **GitHub Gists**
- **Dashboard viewer**

## Connections

- Dashboard builder → Smashing CLI: creates or starts (evidence: `README.md`)
- Smashing CLI → Project template: generates project (evidence: `lib/dashing/cli.rb`)
- Smashing CLI → Resource templates: generates resources (evidence: `lib/dashing/cli.rb`)
- Smashing CLI → Gist downloader: requests Gist (evidence: `lib/dashing/cli.rb`)
- Gist downloader → GitHub Gists: fetches Gist (evidence: `lib/dashing/downloader.rb`)
- Smashing CLI → Sinatra app: starts server (evidence: `lib/dashing/cli.rb`)
- Sinatra app → Dashboard views: renders dashboard (evidence: `lib/dashing/app.rb`)
- Sinatra app → Widget views: serves widget view (evidence: `lib/dashing/app.rb`)
- Scheduled jobs → Event dispatch: publishes events (evidence: `templates/project/jobs/sample.rb`)
- Sinatra app → Event dispatch: routes event posts (evidence: `lib/dashing/app.rb`)
- Event dispatch → Event history: stores events (evidence: `lib/dashing/app.rb`)
- Event dispatch → Dashboard viewer: streams events (evidence: `lib/dashing/app.rb`)
- Dashboard viewer → Dashboard layout: views dashboard (evidence: `README.md`)
- Dashboard layout → Widget components: presents widgets
- Project JavaScript → Batman framework: uses framework
- jQuery adapter → Batman framework: extends DOM (evidence: `javascripts/batman.jquery.js`)
- jQuery adapter → jQuery: uses AJAX and DOM (evidence: `javascripts/batman.jquery.js`)
- Dashboard layout → Dashboard assets: uses assets
- ES5 shim → Dashboard viewer: supports compatibility
