rails_error_dashboard 0.1.0 โ†’ 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +305 -703
  3. data/app/assets/stylesheets/rails_error_dashboard/_catppuccin_mocha.scss +107 -0
  4. data/app/assets/stylesheets/rails_error_dashboard/_components.scss +625 -0
  5. data/app/assets/stylesheets/rails_error_dashboard/_layout.scss +257 -0
  6. data/app/assets/stylesheets/rails_error_dashboard/_theme_variables.scss +203 -0
  7. data/app/assets/stylesheets/rails_error_dashboard/application.css +926 -15
  8. data/app/assets/stylesheets/rails_error_dashboard/application.css.map +7 -0
  9. data/app/assets/stylesheets/rails_error_dashboard/application.scss +61 -0
  10. data/app/controllers/rails_error_dashboard/application_controller.rb +18 -0
  11. data/app/controllers/rails_error_dashboard/errors_controller.rb +140 -4
  12. data/app/helpers/rails_error_dashboard/application_helper.rb +55 -0
  13. data/app/helpers/rails_error_dashboard/backtrace_helper.rb +91 -0
  14. data/app/helpers/rails_error_dashboard/overview_helper.rb +78 -0
  15. data/app/helpers/rails_error_dashboard/user_agent_helper.rb +118 -0
  16. data/app/jobs/rails_error_dashboard/application_job.rb +19 -0
  17. data/app/jobs/rails_error_dashboard/async_error_logging_job.rb +48 -0
  18. data/app/jobs/rails_error_dashboard/baseline_alert_job.rb +263 -0
  19. data/app/jobs/rails_error_dashboard/discord_error_notification_job.rb +4 -8
  20. data/app/jobs/rails_error_dashboard/email_error_notification_job.rb +2 -1
  21. data/app/jobs/rails_error_dashboard/pagerduty_error_notification_job.rb +5 -5
  22. data/app/jobs/rails_error_dashboard/slack_error_notification_job.rb +10 -6
  23. data/app/jobs/rails_error_dashboard/webhook_error_notification_job.rb +5 -6
  24. data/app/mailers/rails_error_dashboard/application_mailer.rb +1 -1
  25. data/app/mailers/rails_error_dashboard/error_notification_mailer.rb +1 -1
  26. data/app/models/rails_error_dashboard/cascade_pattern.rb +74 -0
  27. data/app/models/rails_error_dashboard/error_baseline.rb +100 -0
  28. data/app/models/rails_error_dashboard/error_comment.rb +27 -0
  29. data/app/models/rails_error_dashboard/error_log.rb +471 -3
  30. data/app/models/rails_error_dashboard/error_occurrence.rb +49 -0
  31. data/app/views/layouts/rails_error_dashboard.html.erb +816 -178
  32. data/app/views/layouts/rails_error_dashboard_old_backup.html.erb +383 -0
  33. data/app/views/rails_error_dashboard/error_notification_mailer/error_alert.html.erb +3 -10
  34. data/app/views/rails_error_dashboard/error_notification_mailer/error_alert.text.erb +1 -2
  35. data/app/views/rails_error_dashboard/errors/_error_row.html.erb +78 -0
  36. data/app/views/rails_error_dashboard/errors/_pattern_insights.html.erb +209 -0
  37. data/app/views/rails_error_dashboard/errors/_stats.html.erb +34 -0
  38. data/app/views/rails_error_dashboard/errors/_timeline.html.erb +167 -0
  39. data/app/views/rails_error_dashboard/errors/analytics.html.erb +152 -56
  40. data/app/views/rails_error_dashboard/errors/correlation.html.erb +373 -0
  41. data/app/views/rails_error_dashboard/errors/index.html.erb +294 -138
  42. data/app/views/rails_error_dashboard/errors/overview.html.erb +253 -0
  43. data/app/views/rails_error_dashboard/errors/platform_comparison.html.erb +399 -0
  44. data/app/views/rails_error_dashboard/errors/show.html.erb +781 -65
  45. data/config/routes.rb +9 -0
  46. data/db/migrate/20251225071314_add_optimized_indexes_to_error_logs.rb +66 -0
  47. data/db/migrate/20251225074653_remove_environment_from_error_logs.rb +26 -0
  48. data/db/migrate/20251225085859_add_enhanced_metrics_to_error_logs.rb +12 -0
  49. data/db/migrate/20251225093603_add_similarity_tracking_to_error_logs.rb +9 -0
  50. data/db/migrate/20251225100236_create_error_occurrences.rb +31 -0
  51. data/db/migrate/20251225101920_create_cascade_patterns.rb +33 -0
  52. data/db/migrate/20251225102500_create_error_baselines.rb +38 -0
  53. data/db/migrate/20251226020000_add_workflow_fields_to_error_logs.rb +27 -0
  54. data/db/migrate/20251226020100_create_error_comments.rb +18 -0
  55. data/lib/generators/rails_error_dashboard/install/install_generator.rb +276 -1
  56. data/lib/generators/rails_error_dashboard/install/templates/initializer.rb +272 -37
  57. data/lib/generators/rails_error_dashboard/solid_queue/solid_queue_generator.rb +36 -0
  58. data/lib/generators/rails_error_dashboard/solid_queue/templates/queue.yml +55 -0
  59. data/lib/rails_error_dashboard/commands/batch_delete_errors.rb +1 -1
  60. data/lib/rails_error_dashboard/commands/batch_resolve_errors.rb +2 -2
  61. data/lib/rails_error_dashboard/commands/log_error.rb +272 -7
  62. data/lib/rails_error_dashboard/commands/resolve_error.rb +16 -0
  63. data/lib/rails_error_dashboard/configuration.rb +90 -5
  64. data/lib/rails_error_dashboard/error_reporter.rb +15 -7
  65. data/lib/rails_error_dashboard/logger.rb +105 -0
  66. data/lib/rails_error_dashboard/middleware/error_catcher.rb +17 -10
  67. data/lib/rails_error_dashboard/plugin.rb +6 -3
  68. data/lib/rails_error_dashboard/plugin_registry.rb +2 -2
  69. data/lib/rails_error_dashboard/plugins/audit_log_plugin.rb +0 -1
  70. data/lib/rails_error_dashboard/plugins/jira_integration_plugin.rb +3 -4
  71. data/lib/rails_error_dashboard/plugins/metrics_plugin.rb +1 -3
  72. data/lib/rails_error_dashboard/queries/analytics_stats.rb +44 -6
  73. data/lib/rails_error_dashboard/queries/baseline_stats.rb +107 -0
  74. data/lib/rails_error_dashboard/queries/co_occurring_errors.rb +86 -0
  75. data/lib/rails_error_dashboard/queries/dashboard_stats.rb +242 -2
  76. data/lib/rails_error_dashboard/queries/error_cascades.rb +74 -0
  77. data/lib/rails_error_dashboard/queries/error_correlation.rb +375 -0
  78. data/lib/rails_error_dashboard/queries/errors_list.rb +106 -10
  79. data/lib/rails_error_dashboard/queries/filter_options.rb +0 -1
  80. data/lib/rails_error_dashboard/queries/platform_comparison.rb +254 -0
  81. data/lib/rails_error_dashboard/queries/similar_errors.rb +93 -0
  82. data/lib/rails_error_dashboard/services/backtrace_parser.rb +113 -0
  83. data/lib/rails_error_dashboard/services/baseline_alert_throttler.rb +88 -0
  84. data/lib/rails_error_dashboard/services/baseline_calculator.rb +269 -0
  85. data/lib/rails_error_dashboard/services/cascade_detector.rb +95 -0
  86. data/lib/rails_error_dashboard/services/pattern_detector.rb +268 -0
  87. data/lib/rails_error_dashboard/services/similarity_calculator.rb +144 -0
  88. data/lib/rails_error_dashboard/value_objects/error_context.rb +27 -1
  89. data/lib/rails_error_dashboard/version.rb +1 -1
  90. data/lib/rails_error_dashboard.rb +57 -7
  91. metadata +69 -10
  92. data/app/models/rails_error_dashboard/application_record.rb +0 -5
  93. data/lib/rails_error_dashboard/queries/developer_insights.rb +0 -277
  94. data/lib/rails_error_dashboard/queries/errors_list_v2.rb +0 -149
  95. data/lib/tasks/rails_error_dashboard_tasks.rake +0 -4
data/README.md CHANGED
@@ -4,840 +4,438 @@
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
  [![Tests](https://github.com/AnjanJ/rails_error_dashboard/workflows/Tests/badge.svg)](https://github.com/AnjanJ/rails_error_dashboard/actions)
6
6
 
7
- > **โš ๏ธ BETA SOFTWARE**: This gem is currently in beta and under active development. While functional and tested, the API and features may change before v1.0.0. Use in production at your own discretion.
7
+ ## Self-hosted Rails error monitoring โ€” free, forever.
8
8
 
9
- > **A beautiful error tracking dashboard for Rails applications and their frontends**
9
+ **Own your errors. Own your stack. Zero monthly fees.**
10
10
 
11
- Rails Error Dashboard provides a complete error tracking and alerting solution for Rails backends AND frontend/mobile apps (React, React Native, Vue, Angular, Flutter, etc.). Features include: modern UI, multi-channel notifications (Slack + Email), real-time analytics, platform detection (iOS/Android/Web/API), and optional separate database support. Built with Rails 7+ error reporting and following Service Objects + CQRS principles.
11
+ A fully open-source, self-hosted error dashboard for solo founders, indie hackers, and small teams who want complete control without the SaaS bills.
12
12
 
13
- **Tested on**: Rails 7.0, 7.1, 7.2, 8.0 | Ruby 3.2, 3.3+
13
+ ```ruby
14
+ gem 'rails_error_dashboard'
15
+ ```
14
16
 
15
- ![Dashboard Screenshot](https://via.placeholder.com/800x400?text=Error+Dashboard+Screenshot)
17
+ **5-minute setup** ยท **Works out-of-the-box** ยท **100% Rails + Postgres** ยท **No vendor lock-in**
16
18
 
17
- ## ๐Ÿ“– Table of Contents
18
-
19
- - [Features](#-features)
20
- - [Installation](#-installation)
21
- - [Configuration](#๏ธ-configuration)
22
- - [Usage](#-usage)
23
- - [Automatic Error Tracking](#automatic-error-tracking)
24
- - [Manual Error Logging](#manual-error-logging)
25
- - [Frontend & Mobile Error Reporting](#frontend--mobile-error-reporting)
26
- - [Optional Separate Database](#๏ธ-optional-separate-database)
27
- - [Advanced Features](#-advanced-features)
28
- - [Notification System](#-notification-system)
29
- - [Platform Detection](#platform-detection)
30
- - [Architecture Details](#-architecture-details)
31
- - [Documentation](#-documentation)
32
- - [Contributing](#-contributing)
33
- - [License](#-license)
19
+ ---
34
20
 
35
- ## โœจ Features
21
+ ### โš ๏ธ BETA SOFTWARE
22
+ This Rails Engine is in beta and under active development. While functional and tested (850+ tests passing), the API may change before v1.0.0. Use in production at your own discretion.
36
23
 
37
- ### ๐ŸŽฏ Complete Error Tracking
38
- - **Automatic error capture** from Rails controllers, jobs, services, and middleware
39
- - **Frontend & mobile support** - React, React Native, Vue, Angular, Flutter, and more
40
- - **Platform detection** (iOS/Android/Web/API) using user agent parsing
41
- - **User context tracking** with optional user associations
42
- - **Request context** including URL, params, IP address, component/screen
43
- - **Full stack traces** for debugging (Ruby + JavaScript)
44
-
45
- ### ๐Ÿ“Š Beautiful Dashboard
46
- - **Modern UI** with Bootstrap 5
47
- - **Dark/Light mode** with theme switcher
48
- - **Responsive design** for mobile and desktop
49
- - **Real-time statistics** and error counts
50
- - **Search and filtering** by type, platform, environment
51
- - **Fast pagination** with Pagy (40x faster than Kaminari)
52
-
53
- ### ๐Ÿ“ˆ Analytics & Insights
54
- - **Time-series charts** showing error trends
55
- - **Breakdown by type**, platform, and environment
56
- - **Resolution rate tracking**
57
- - **Top affected users**
58
- - **Mobile vs API analysis**
59
- - **Customizable date ranges** (7, 14, 30, 90 days)
60
-
61
- ### โœ… Resolution Tracking
62
- - Mark errors as resolved
63
- - Add resolution comments
64
- - Link to PRs, commits, or issues
65
- - Track resolver name and timestamp
66
- - View related errors
67
- - **Batch operations** - resolve or delete multiple errors at once
68
-
69
- ### ๐Ÿšจ Multi-Channel Alerting
70
- - **5 notification backends**: Email, Slack, Discord, PagerDuty, Webhooks
71
- - **Slack notifications** with beautifully formatted messages
72
- - **Discord notifications** with rich embeds and color-coded severity
73
- - **PagerDuty integration** for critical errors (on-call escalation)
74
- - **Custom webhooks** for integration with any monitoring service
75
- - **Email alerts** with HTML templates to multiple recipients
76
- - **Instant notifications** when errors occur (async background jobs)
77
- - **Rich context** including user, platform, environment, stack trace
78
- - **Direct links** to view full error details in dashboard
79
- - **Customizable** - enable/disable channels independently
80
-
81
- See [NOTIFICATION_CONFIGURATION.md](NOTIFICATION_CONFIGURATION.md) for detailed setup.
82
-
83
- ### ๐Ÿ”’ Security & Configuration
84
- - **HTTP Basic Auth** (configurable)
85
- - **Environment-based settings**
86
- - **Optional separate database** for performance isolation
87
-
88
- ### ๐Ÿ”Œ Plugin System
89
- - **Extensible architecture** for custom integrations
90
- - **Event hooks** throughout error lifecycle
91
- - **Built-in examples**: Metrics tracking, Audit logging, Jira integration
92
- - **Easy to create** custom plugins for any service
93
- - **Safe execution** - plugin errors don't break the app
94
-
95
- Common plugin use cases:
96
- - ๐Ÿ“Š Send metrics to StatsD, Datadog, Prometheus
97
- - ๐ŸŽซ Create tickets in Jira, Linear, GitHub Issues
98
- - ๐Ÿ“ Log audit trails for compliance
99
- - ๐Ÿ“ข Send custom notifications
100
- - ๐Ÿ’พ Archive errors to data warehouses
101
-
102
- See [PLUGIN_SYSTEM_GUIDE.md](PLUGIN_SYSTEM_GUIDE.md) for detailed documentation.
103
-
104
- ### ๐Ÿ—๏ธ Architecture
105
- Built with **Service Objects + CQRS Principles**:
106
- - **Commands**: LogError, ResolveError, BatchResolveErrors, BatchDeleteErrors (write operations)
107
- - **Queries**: ErrorsList, DashboardStats, AnalyticsStats (read operations)
108
- - **Value Objects**: ErrorContext (immutable data)
109
- - **Services**: PlatformDetector (business logic)
110
- - **Plugins**: Extensible event-driven architecture
111
-
112
- ### โœ… Multi-Version Testing
113
- - **Rails Support**: 7.0, 7.1, 7.2, 8.0
114
- - **Ruby Support**: 3.2, 3.3+
115
- - **CI/CD**: 8 version combinations tested automatically
116
- - **Compatibility**: 100% feature parity across all versions
117
-
118
- See [MULTI_VERSION_TESTING.md](MULTI_VERSION_TESTING.md) for testing guide.
119
-
120
- ## ๐Ÿงช Implementation Status
121
-
122
- ### โœ… Phase 1: Core Error Tracking (COMPLETE & TESTED)
123
- - Error logging and deduplication
124
- - Automatic tracking via middleware
125
- - Controller/action context
126
- - Request metadata capture
127
- - User tracking
128
- - Dashboard UI with search/filter
129
- - Stack trace viewer
130
- - Mark errors as resolved
131
- - **Test Coverage**: 111 RSpec examples passing
132
-
133
- ### โœ… Phase 2: Multi-Channel Notifications (COMPLETE)
134
- - Slack integration
135
- - Email notifications
136
- - Discord webhooks
137
- - PagerDuty integration
138
- - Custom webhooks
139
- - **Test Coverage**: Needs additional tests (functional but not extensively tested)
140
-
141
- ### โœ… Phase 3: Batch Operations (COMPLETE)
142
- - Bulk resolve errors
143
- - Bulk delete errors
144
- - API endpoints
145
- - **Test Coverage**: Needs additional tests (functional but not extensively tested)
146
-
147
- ### โœ… Phase 4: Analytics & Insights (COMPLETE)
148
- - Error trends over time
149
- - Platform breakdown
150
- - Developer insights
151
- - Dashboard statistics
152
- - **Test Coverage**: Needs additional tests (functional but not extensively tested)
153
-
154
- ### โœ… Phase 5: Plugin System (COMPLETE)
155
- - Plugin architecture
156
- - Event hooks
157
- - Built-in plugins (Jira, Metrics, Audit Log)
158
- - **Test Coverage**: Needs additional tests (functional but not extensively tested)
159
-
160
- ### ๐Ÿ”œ What's Next
161
- - Expand test coverage for Phases 2-5
162
- - Real-world production testing
163
- - Performance optimizations
164
- - Additional integrations based on feedback
165
-
166
- ## ๐Ÿ“ฆ Installation
24
+ **Supports**: Rails 7.0 - 8.1 | Ruby 3.2+
167
25
 
168
- ### 1. Add to Gemfile
26
+ ---
169
27
 
170
- ```ruby
171
- gem 'rails_error_dashboard'
172
- ```
28
+ ## ๐ŸŽฏ Who This Is For
173
29
 
174
- ### 2. Install the gem
30
+ โœ“ **Solo bootstrappers** who need professional error tracking without recurring costs
175
31
 
176
- ```bash
177
- bundle install
178
- ```
32
+ โœ“ **Indie SaaS founders** building profitable apps on tight budgets
179
33
 
180
- ### 3. Run the installer
34
+ โœ“ **Small dev teams** (2-5 people) who hate SaaS bloat
181
35
 
182
- ```bash
183
- rails generate rails_error_dashboard:install
184
- ```
36
+ โœ“ **Privacy-conscious apps** that need to keep error data on their own servers
185
37
 
186
- This will:
187
- - Create `config/initializers/rails_error_dashboard.rb`
188
- - Copy migrations to your app
189
- - Mount the engine at `/error_dashboard`
38
+ โœ“ **Side projects** that might become real businesses
190
39
 
191
- ### 4. Run migrations
40
+ ---
192
41
 
193
- ```bash
194
- rails db:migrate
195
- ```
42
+ ## ๐Ÿ’ฐ What It Replaces
196
43
 
197
- ### 5. (Optional) Configure queue for notifications
44
+ | Before | After |
45
+ |--------|-------|
46
+ | Pay $29-99/month for error monitoring | $0/month - runs on your existing Rails server |
47
+ | Send sensitive error data to third parties | Keep all data on your infrastructure |
48
+ | Fight with SaaS pricing tiers and limits | Unlimited errors, unlimited projects |
49
+ | Vendor lock-in with proprietary APIs | 100% open source, fully portable |
50
+ | Complex setup with SDKs and external services | 5-minute Rails Engine installation |
198
51
 
199
- If you're using **Sidekiq**, add the notification queue to your config:
52
+ ---
200
53
 
201
- ```yaml
202
- # config/sidekiq.yml
203
- :queues:
204
- - error_notifications
205
- - default
206
- - mailers
207
- ```
54
+ ## ๐Ÿš€ Why Choose Rails Error Dashboard
208
55
 
209
- If you're using **Solid Queue** (Rails 8.1+), add to your config:
210
-
211
- ```yaml
212
- # config/queue.yml
213
- workers:
214
- - queues: error_notifications
215
- threads: 3
216
- processes: 1
217
- - queues: default
218
- threads: 5
219
- processes: 1
220
- ```
56
+ **"Install once, own it forever"**
221
57
 
222
- **Note:** If you're using the default `async` adapter or other backends, no additional configuration is needed. The gem works with all ActiveJob adapters out of the box.
58
+ - โœ… **Zero recurring costs** - One-time setup, runs on your existing infrastructure
59
+ - โœ… **5-minute installation** - Mount the Rails Engine, run migrations, done
60
+ - โœ… **Works immediately** - Automatic error capture from Rails controllers, jobs, models
61
+ - โœ… **Beautiful UI** - Professional dashboard you can show to clients
62
+ - โœ… **Full control** - Your data stays on your server, modify anything you want
63
+ - โœ… **No surprises** - Open source MIT license, no hidden fees or limits
223
64
 
224
- ### 6. Visit the dashboard
65
+ **Built for developers who:**
66
+ - Want professional error monitoring without the SaaS tax
67
+ - Need to debug production issues without paying per error
68
+ - Value data privacy and server ownership
69
+ - Prefer simple, Rails-native solutions
225
70
 
226
- Start your server and visit:
227
- ```
228
- http://localhost:3000/error_dashboard
229
- ```
71
+ ---
230
72
 
231
- **Default credentials** (change in the initializer):
232
- - Username: `admin`
233
- - Password: `password`
73
+ ![Dashboard Screenshot](https://via.placeholder.com/800x400?text=Error+Dashboard+Screenshot)
234
74
 
235
- ## โš™๏ธ Configuration
75
+ ---
236
76
 
237
- Edit `config/initializers/rails_error_dashboard.rb`:
77
+ ## โœจ Features
238
78
 
239
- ```ruby
240
- RailsErrorDashboard.configure do |config|
241
- # Dashboard authentication
242
- config.dashboard_username = ENV.fetch('ERROR_DASHBOARD_USER', 'admin')
243
- config.dashboard_password = ENV.fetch('ERROR_DASHBOARD_PASSWORD', 'password')
244
- config.require_authentication = true
245
- config.require_authentication_in_development = false
79
+ ### Core Features (Always Enabled)
246
80
 
247
- # User model for associations
248
- config.user_model = 'User'
81
+ #### ๐ŸŽฏ Complete Error Tracking
82
+ Automatic error capture from Rails controllers, jobs, and middleware. Frontend & mobile support for React, React Native, Vue, Angular, Flutter. Platform detection (iOS/Android/Web/API), user context tracking, full stack traces.
249
83
 
250
- # === Notification Settings ===
84
+ #### ๐Ÿ“Š Beautiful Dashboard
85
+ Modern Bootstrap 5 UI with dark/light mode, responsive design, real-time statistics, search and filtering, fast pagination. Overview dashboard with critical alerts, error trend charts, and platform health summary.
251
86
 
252
- # Slack notifications
253
- config.enable_slack_notifications = true
254
- config.slack_webhook_url = ENV['SLACK_WEBHOOK_URL']
87
+ #### ๐Ÿ“ˆ Analytics & Insights
88
+ 7-day trend charts, severity breakdown, spike detection, resolution rate tracking, user impact analysis. Comprehensive analytics page with hourly patterns, mobile vs API breakdowns, and top affected users.
255
89
 
256
- # Email notifications
257
- config.enable_email_notifications = true
258
- config.notification_email_recipients = ENV.fetch('ERROR_NOTIFICATION_EMAILS', '').split(',').map(&:strip)
259
- config.notification_email_from = ENV.fetch('ERROR_NOTIFICATION_FROM', 'errors@example.com')
90
+ #### ๐Ÿ”ง Workflow Management
91
+ Error assignment and status tracking, priority levels (critical/high/medium/low), snooze functionality, comment threads, batch operations (bulk resolve/delete), resolution tracking with references.
260
92
 
261
- # Dashboard base URL (for notification links)
262
- config.dashboard_base_url = ENV['DASHBOARD_BASE_URL']
93
+ #### ๐Ÿ”’ Security & Privacy
94
+ HTTP Basic Auth, environment-based settings, optional separate database for isolation. Your data stays on your server - no third-party access.
263
95
 
264
- # Separate database (optional - for high-volume apps)
265
- config.use_separate_database = ENV.fetch('USE_SEPARATE_ERROR_DB', 'false') == 'true'
96
+ ### Optional Features (Choose During Install)
266
97
 
267
- # Retention policy
268
- config.retention_days = 90
98
+ #### ๐Ÿšจ Multi-Channel Notifications
269
99
 
270
- # Error catching
271
- config.enable_middleware = true
272
- config.enable_error_subscriber = true
273
- end
274
- ```
100
+ - **Slack** - Rich formatted messages with error context and direct dashboard links
101
+ - **Email** - HTML formatted alerts with full error details
102
+ - **Discord** - Embedded messages with severity color coding
103
+ - **PagerDuty** - Critical error escalation with incident management
104
+ - **Webhooks** - Custom integrations with any service (JSON payloads)
275
105
 
276
- ### Environment Variables
106
+ #### โšก Performance Optimizations
277
107
 
278
- ```bash
279
- # .env
280
- ERROR_DASHBOARD_USER=admin
281
- ERROR_DASHBOARD_PASSWORD=your_secure_password
108
+ - **Async Logging** - Non-blocking error capture using ActiveJob (Sidekiq/SolidQueue/Async)
109
+ - **Error Sampling** - Reduce storage by sampling high-frequency errors
110
+ - **Backtrace Limiting** - Save 70-90% storage with smart truncation
111
+ - **Separate Database** - Isolate error data for better performance
112
+ - **Database Indexes** - Composite indexes and PostgreSQL GIN full-text search
282
113
 
283
- # Slack notifications
284
- SLACK_WEBHOOK_URL=https://hooks.slack.com/services/YOUR/WEBHOOK/URL
114
+ #### ๐Ÿง  Advanced Analytics (8 Powerful Features)
285
115
 
286
- # Email notifications (comma-separated list)
287
- ERROR_NOTIFICATION_EMAILS=dev-team@example.com,ops@example.com
288
- ERROR_NOTIFICATION_FROM=errors@myapp.com
116
+ **1. Baseline Anomaly Alerts** ๐Ÿ””
117
+ Automatically detect unusual error rate spikes using statistical analysis (mean + std dev). Get proactive notifications when errors exceed expected baselines with intelligent cooldown to avoid alert fatigue.
289
118
 
290
- # Dashboard URL (used in notification links)
291
- DASHBOARD_BASE_URL=https://myapp.com
119
+ **2. Fuzzy Error Matching** ๐Ÿ”
120
+ Find similar errors across different error hashes using Jaccard similarity (70%) and Levenshtein distance (30%). Discover related errors that share common root causes even when they manifest differently.
292
121
 
293
- USE_SEPARATE_ERROR_DB=false # Set to true for separate database
294
- ```
122
+ **3. Co-occurring Errors** ๐Ÿ”—
123
+ Detect errors that happen together within configurable time windows (default: 5 minutes). Identify patterns where one error frequently triggers another, helping you prioritize fixes.
295
124
 
296
- ## ๐Ÿš€ Usage
125
+ **4. Error Cascade Detection** โ›“๏ธ
126
+ Identify error chains (A causes B causes C) with probability calculations and average delays. Visualize parentโ†’child relationships to understand cascading failures and fix root causes.
297
127
 
298
- ### Automatic Error Tracking
128
+ **5. Error Correlation Analysis** ๐Ÿ“Š
129
+ Correlate errors with app versions, git commits, and users. Find problematic releases, identify users affected by multiple error types, and detect time-based patterns.
299
130
 
300
- The gem automatically tracks errors from:
301
- - **Controllers** (via Rails error reporting)
302
- - **Background jobs** (ActiveJob, Sidekiq)
303
- - **Rack middleware** (catches everything else)
131
+ **6. Platform Comparison** ๐Ÿ“ฑ
132
+ Compare iOS vs Android vs Web health metrics side-by-side. Platform-specific error rates, severity distributions, resolution times, and stability scores (0-100).
304
133
 
305
- No code changes needed! Just install and go.
134
+ **7. Occurrence Pattern Detection** ๐Ÿ“ˆ
135
+ Detect cyclical patterns (business hours, nighttime, weekend rhythms) and error bursts (many errors in short time). Understand when and how your errors happen.
306
136
 
307
- ### Manual Error Logging
137
+ **8. Developer Insights** ๐Ÿ’ก
138
+ AI-powered insights with severity detection, platform stability scoring, actionable recommendations, and recent error activity summaries.
139
+
140
+ #### ๐Ÿ”Œ Plugin System
141
+ Extensible architecture with event hooks (`on_error_logged`, `on_error_resolved`, `on_threshold_exceeded`). Built-in examples for Jira integration, metrics tracking, audit logging. Easy to create custom plugins - just drop a file in `config/initializers/error_dashboard_plugins/`.
142
+
143
+ **๐Ÿ“š [View complete feature list with examples โ†’](docs/FEATURES.md)**
144
+
145
+ ---
308
146
 
309
- You can also manually log errors:
147
+ ## ๐Ÿ“ฆ Quick Start
148
+
149
+ ### 1. Add to Gemfile
310
150
 
311
151
  ```ruby
312
- begin
313
- # Your code
314
- rescue => e
315
- Rails.error.report(e,
316
- handled: true,
317
- severity: :error,
318
- context: {
319
- current_user: current_user,
320
- custom_data: "anything you want"
321
- }
322
- )
323
- end
152
+ gem 'rails_error_dashboard'
324
153
  ```
325
154
 
326
- ### Frontend & Mobile Error Reporting
155
+ ### 2. Install with Interactive Setup
156
+
157
+ ```bash
158
+ bundle install
159
+ rails generate rails_error_dashboard:install
160
+ rails db:migrate
161
+ ```
327
162
 
328
- Rails Error Dashboard can track errors from **any frontend or mobile application** - not just your Rails backend!
163
+ The installer will guide you through optional feature selection:
164
+ - **Notifications** (Slack, Email, Discord, PagerDuty, Webhooks)
165
+ - **Performance** (Async Logging, Error Sampling, Separate Database)
166
+ - **Advanced Analytics** (8 powerful features including baseline alerts, fuzzy matching, platform comparison)
329
167
 
330
- **Supported platforms:**
331
- - ๐Ÿ“ฑ **React Native** (iOS & Android)
332
- - โš›๏ธ **React** (Web)
333
- - ๐Ÿ…ฐ๏ธ **Angular**
334
- - ๐Ÿ’š **Vue.js**
335
- - ๐Ÿ“ฑ **Flutter** (via HTTP)
336
- - ๐Ÿ“ฑ **Swift/Kotlin** (Native apps)
337
- - ๐ŸŒ **Any JavaScript/TypeScript** application
168
+ **All features are opt-in** - choose what you need during installation, or enable/disable them later in the initializer.
338
169
 
339
- #### Quick Setup
170
+ This will:
171
+ - Create `config/initializers/rails_error_dashboard.rb` with your selected features
172
+ - Copy database migrations
173
+ - Mount the engine at `/error_dashboard`
340
174
 
341
- **1. Create an API endpoint in your Rails app:**
175
+ ### 3. Visit your dashboard
342
176
 
343
- ```ruby
344
- # app/controllers/api/v1/mobile_errors_controller.rb
345
- module Api
346
- module V1
347
- class MobileErrorsController < BaseController
348
- def create
349
- mobile_error = MobileError.new(error_params)
350
-
351
- RailsErrorDashboard::Commands::LogError.call(
352
- mobile_error,
353
- {
354
- current_user: current_user,
355
- request: request,
356
- source: :mobile_app # or :react, :vue, :angular, etc.
357
- }
358
- )
359
-
360
- render json: { success: true }, status: :created
361
- end
362
-
363
- private
364
-
365
- def error_params
366
- params.require(:error).permit(:error_type, :message, :stack, :component)
367
- end
368
-
369
- class MobileError < StandardError
370
- attr_reader :mobile_data
371
- def initialize(data)
372
- @mobile_data = data
373
- super(data[:message])
374
- end
375
- def backtrace
376
- @mobile_data[:stack]&.split("\n") || []
377
- end
378
- end
379
- end
380
- end
381
- end
177
+ Start your server and visit:
178
+ ```
179
+ http://localhost:3000/error_dashboard
382
180
  ```
383
181
 
384
- **2. Report errors from your frontend:**
182
+ **Default credentials:**
183
+ - Username: `gandalf`
184
+ - Password: `youshallnotpass`
385
185
 
386
- ```javascript
387
- // React/React Native/Vue/Angular
388
- async function reportError(error, component) {
389
- try {
390
- await fetch('/api/v1/mobile_errors', {
391
- method: 'POST',
392
- headers: {
393
- 'Content-Type': 'application/json',
394
- 'Authorization': `Bearer ${authToken}`
395
- },
396
- body: JSON.stringify({
397
- error: {
398
- error_type: error.name,
399
- message: error.message,
400
- stack: error.stack,
401
- component: component
402
- }
403
- })
404
- });
405
- } catch (e) {
406
- console.error('Failed to report error:', e);
407
- }
408
- }
186
+ โš ๏ธ **Change these before production!** Edit `config/initializers/rails_error_dashboard.rb`
409
187
 
410
- // Usage in React component
411
- try {
412
- // Your code
413
- } catch (error) {
414
- reportError(error, 'UserProfile');
415
- // Handle error in UI
416
- }
188
+ ### 4. Test it out
189
+
190
+ Trigger a test error to see it in action:
191
+
192
+ ```ruby
193
+ # In Rails console or any controller
194
+ raise "Test error from Rails Error Dashboard!"
417
195
  ```
418
196
 
419
- **3. Add Error Boundary (React/React Native):**
197
+ The error will appear instantly in your dashboard with full context, backtrace, and platform information.
420
198
 
421
- ```jsx
422
- class ErrorBoundary extends React.Component {
423
- componentDidCatch(error, errorInfo) {
424
- reportError(error, errorInfo.componentStack);
425
- }
199
+ **๐Ÿ“˜ [Full installation guide โ†’](docs/QUICKSTART.md)**
426
200
 
427
- render() {
428
- return this.props.children;
429
- }
430
- }
431
- ```
201
+ ---
432
202
 
433
- **Benefits:**
434
- - โœ… **Single dashboard** for all errors (backend + frontend + mobile)
435
- - โœ… **Platform detection** - errors automatically tagged by source
436
- - โœ… **User tracking** - errors associated with logged-in users
437
- - โœ… **Real-time notifications** - Slack/Email alerts for frontend errors too
438
- - โœ… **Component tracking** - know which component/screen errored
439
- - โœ… **Stack traces** - full JavaScript stack traces
203
+ ## โš™๏ธ Configuration
440
204
 
441
- **๐Ÿ“š Complete Integration Guide:**
205
+ ### Opt-in Feature System
442
206
 
443
- For detailed setup instructions including:
444
- - Offline support and retry logic
445
- - Batch error reporting
446
- - React Native integration
447
- - Error filtering and deduplication
448
- - Best practices
207
+ Rails Error Dashboard uses an **opt-in architecture** - core features (error capture, dashboard UI, analytics) are always enabled, while everything else is disabled by default.
449
208
 
450
- See: [MOBILE_APP_INTEGRATION.md](MOBILE_APP_INTEGRATION.md)
209
+ **Tier 1 Features (Always ON)**:
210
+ - โœ… Error capture (controllers, jobs, middleware)
211
+ - โœ… Dashboard UI with search and filtering
212
+ - โœ… Real-time updates
213
+ - โœ… Analytics and trend charts
451
214
 
452
- ### Accessing the Dashboard
215
+ **Optional Features (Choose During Install)**:
216
+ - ๐Ÿ“ง Multi-channel notifications (Slack, Email, Discord, PagerDuty, Webhooks)
217
+ - โšก Performance optimizations (Async logging, Error sampling)
218
+ - ๐Ÿ“Š Advanced analytics (Baseline alerts, Fuzzy matching, Platform comparison, and more)
453
219
 
454
- Navigate to `/error_dashboard` to view:
455
- - **Overview**: Recent errors, statistics, quick filters
456
- - **All Errors**: Paginated list with filtering and search
457
- - **Analytics**: Charts, trends, and insights
458
- - **Error Details**: Full stack trace, context, and resolution tracking
220
+ ### Basic Configuration
459
221
 
460
- ### Resolution Workflow
222
+ Edit `config/initializers/rails_error_dashboard.rb`:
461
223
 
462
- 1. Click on an error to view details
463
- 2. Investigate the stack trace and context
464
- 3. Fix the issue in your code
465
- 4. Mark as resolved with:
466
- - Resolution comment (what was the fix)
467
- - Reference link (PR, commit, issue)
468
- - Your name
224
+ ```ruby
225
+ RailsErrorDashboard.configure do |config|
226
+ # ============================================================================
227
+ # AUTHENTICATION (Always Required)
228
+ # ============================================================================
229
+ config.dashboard_username = ENV.fetch('ERROR_DASHBOARD_USER', 'gandalf')
230
+ config.dashboard_password = ENV.fetch('ERROR_DASHBOARD_PASSWORD', 'youshallnotpass')
469
231
 
470
- ## ๐Ÿ—„๏ธ Optional Separate Database
232
+ # ============================================================================
233
+ # OPTIONAL FEATURES (Enable as needed)
234
+ # ============================================================================
471
235
 
472
- For high-volume applications, you can use a separate database for error logs:
236
+ # Slack notifications (if enabled during install)
237
+ config.enable_slack_notifications = true
238
+ config.slack_webhook_url = ENV['SLACK_WEBHOOK_URL']
473
239
 
474
- ### Benefits
475
- - **Performance isolation** - error logging doesn't slow down main DB
476
- - **Independent scaling** - different hardware for different workloads
477
- - **Different retention policies** - auto-delete old errors
478
- - **Security isolation** - separate access controls
240
+ # Email notifications (if enabled during install)
241
+ config.enable_email_notifications = true
242
+ config.notification_email_recipients = ["dev@yourapp.com"]
243
+ config.notification_email_from = "errors@yourapp.com"
479
244
 
480
- ### Setup
245
+ # Async logging for better performance (if enabled during install)
246
+ config.async_logging = true
247
+ config.async_adapter = :sidekiq # or :solid_queue, :async
481
248
 
482
- 1. **Enable in config**:
483
- ```ruby
484
- config.use_separate_database = true
249
+ # Advanced analytics features (if enabled during install)
250
+ config.enable_baseline_alerts = true
251
+ config.enable_similar_errors = true
252
+ config.enable_platform_comparison = true
253
+ end
485
254
  ```
486
255
 
487
- 2. **Configure database.yml**:
488
- ```yaml
489
- production:
490
- primary:
491
- database: myapp_production
492
- # ... your main DB config
493
-
494
- error_logs:
495
- database: myapp_error_logs_production
496
- username: <%= ENV['ERROR_LOGS_DATABASE_USER'] %>
497
- password: <%= ENV['ERROR_LOGS_DATABASE_PASSWORD'] %>
498
- migrations_paths: db/error_logs_migrate
499
- ```
256
+ All features can be toggled on/off at any time by editing the initializer.
257
+
258
+ ### Environment Variables
500
259
 
501
- 3. **Create and migrate**:
502
260
  ```bash
503
- rails db:create:error_logs
504
- rails db:migrate:error_logs
261
+ # .env
262
+ ERROR_DASHBOARD_USER=your_username
263
+ ERROR_DASHBOARD_PASSWORD=your_secure_password
264
+ SLACK_WEBHOOK_URL=https://hooks.slack.com/services/YOUR/WEBHOOK/URL
265
+ DASHBOARD_BASE_URL=https://yourapp.com
505
266
  ```
506
267
 
507
- ### Migrating Existing Data
508
-
509
- If you already have error logs in your primary database and want to move them to the separate database:
268
+ **๐Ÿ“– [Complete configuration guide โ†’](docs/guides/CONFIGURATION.md)**
510
269
 
511
- **๐Ÿ“š Complete Migration Guide:** See [MIGRATION_TO_SEPARATE_DATABASE.md](MIGRATION_TO_SEPARATE_DATABASE.md)
270
+ ---
512
271
 
513
- The guide covers:
514
- - Step-by-step migration process
515
- - Data integrity verification
516
- - Safe cleanup of old data
517
- - Rollback procedures
518
- - Performance considerations
519
- - Troubleshooting common issues
272
+ ## ๐Ÿš€ Usage
520
273
 
521
- **Quick summary:**
522
- ```bash
523
- # 1. Configure separate database in database.yml
524
- # 2. Create the new database
525
- rails db:create:error_logs
526
- rails db:migrate:error_logs
274
+ ### Automatic Error Tracking
527
275
 
528
- # 3. Copy data (use rake task from migration guide)
529
- rake error_logs:migrate_to_separate_db
276
+ Rails Error Dashboard automatically tracks errors from:
277
+ - **Controllers** (via Rails error reporting)
278
+ - **Background jobs** (ActiveJob, Sidekiq)
279
+ - **Rack middleware** (catches everything else)
530
280
 
531
- # 4. Verify migration
532
- rake error_logs:verify_migration
281
+ No additional code needed! Just install and it works.
533
282
 
534
- # 5. Enable in config and restart app
535
- # 6. Clean up primary database
536
- rake error_logs:cleanup_primary_db
537
- ```
283
+ ### Manual Error Logging
538
284
 
539
- ## ๐Ÿ”ง Advanced Features
540
-
541
- ### ๐Ÿ“ง Notification System
542
-
543
- Rails Error Dashboard includes a powerful multi-channel notification system to alert your team when errors occur.
544
-
545
- #### Slack Notifications
546
-
547
- Get instant alerts in Slack with rich, formatted messages including:
548
- - Error type and message
549
- - Environment (Production, Staging, etc.)
550
- - Platform (iOS, Android, API)
551
- - User information
552
- - Request details
553
- - Direct link to view full error in dashboard
554
-
555
- **Setup:**
556
-
557
- 1. Create a Slack webhook URL:
558
- - Go to https://api.slack.com/messaging/webhooks
559
- - Create a new webhook for your channel
560
- - Copy the webhook URL
561
-
562
- 2. Configure in your app:
563
- ```bash
564
- # .env
565
- SLACK_WEBHOOK_URL=https://hooks.slack.com/services/YOUR/WEBHOOK/URL
566
- DASHBOARD_BASE_URL=https://myapp.com
567
- ```
568
-
569
- 3. Enable in initializer (enabled by default):
570
- ```ruby
571
- config.enable_slack_notifications = true
572
- config.slack_webhook_url = ENV['SLACK_WEBHOOK_URL']
573
- ```
574
-
575
- **Slack Message Features:**
576
- - ๐ŸŽจ Beautifully formatted with color-coded blocks
577
- - ๐Ÿ“ฑ Platform emoji indicators (iOS ๐Ÿ“ฑ, Android ๐Ÿค–, API ๐Ÿ”Œ)
578
- - ๐Ÿ‘ค User and IP address tracking
579
- - ๐Ÿ”— Direct "View Details" button linking to dashboard
580
- - โฐ Timestamp with timezone
581
-
582
- #### Email Notifications
583
-
584
- Send detailed email alerts to your team with HTML and plain text versions.
585
-
586
- **Email Features:**
587
- - ๐Ÿ“จ Beautiful HTML email template with your app's branding
588
- - ๐Ÿ“„ Plain text fallback for email clients
589
- - ๐ŸŽฏ Send to multiple recipients
590
- - ๐Ÿ“Š Full error context including stack trace
591
- - ๐Ÿ”— One-click link to view in dashboard
592
- - ๐Ÿท๏ธ Environment and platform badges
593
-
594
- **Setup:**
595
-
596
- 1. Configure recipients and sender:
597
- ```bash
598
- # .env
599
- ERROR_NOTIFICATION_EMAILS=dev-team@example.com,ops@example.com,alerts@example.com
600
- ERROR_NOTIFICATION_FROM=errors@myapp.com
601
- DASHBOARD_BASE_URL=https://myapp.com
602
- ```
603
-
604
- 2. Enable in initializer (enabled by default):
605
- ```ruby
606
- config.enable_email_notifications = true
607
- config.notification_email_recipients = ENV.fetch('ERROR_NOTIFICATION_EMAILS', '').split(',').map(&:strip)
608
- config.notification_email_from = ENV.fetch('ERROR_NOTIFICATION_FROM', 'errors@example.com')
609
- ```
610
-
611
- 3. Ensure your Rails app has ActionMailer configured:
612
- ```ruby
613
- # config/environments/production.rb
614
- config.action_mailer.delivery_method = :smtp
615
- config.action_mailer.smtp_settings = {
616
- address: 'smtp.sendgrid.net',
617
- port: 587,
618
- domain: 'myapp.com',
619
- user_name: ENV['SENDGRID_USERNAME'],
620
- password: ENV['SENDGRID_PASSWORD'],
621
- authentication: 'plain',
622
- enable_starttls_auto: true
623
- }
624
- ```
625
-
626
- **Email Template Includes:**
627
- - Error type and full message
628
- - Environment badge (Production/Staging/Development)
629
- - Platform badge (iOS/Android/API)
630
- - Timestamp with timezone
631
- - User email and IP address
632
- - Request URL and parameters
633
- - First 10 lines of stack trace
634
- - Prominent "View Full Details" button
635
-
636
- #### Disabling Notifications
637
-
638
- You can selectively disable notifications:
285
+ For frontend/mobile apps or custom error logging:
639
286
 
640
287
  ```ruby
641
- # Disable Slack only
642
- config.enable_slack_notifications = false
643
-
644
- # Disable email only
645
- config.enable_email_notifications = false
646
-
647
- # Disable both
648
- config.enable_slack_notifications = false
649
- config.enable_email_notifications = false
288
+ # From your Rails API
289
+ RailsErrorDashboard::Commands::LogError.call(
290
+ error_type: "TypeError",
291
+ message: "Cannot read property 'name' of null",
292
+ backtrace: ["App.js:42", "index.js:12"],
293
+ platform: "iOS",
294
+ app_version: "2.1.0",
295
+ user_id: current_user.id,
296
+ context: {
297
+ component: "ProfileScreen",
298
+ device_model: "iPhone 14 Pro"
299
+ }
300
+ )
650
301
  ```
651
302
 
652
- #### Notification Workflow
303
+ ### Frontend Integration
653
304
 
654
- When an error occurs:
655
- 1. Error is logged to database
656
- 2. Notifications are sent **asynchronously** via background jobs
657
- 3. Your team receives alerts via configured channels
658
- 4. Team clicks link in notification to view full details
659
- 5. Error can be investigated and marked as resolved in dashboard
305
+ ```javascript
306
+ // React Native example
307
+ try {
308
+ // Your code
309
+ } catch (error) {
310
+ fetch('https://yourapp.com/api/errors', {
311
+ method: 'POST',
312
+ headers: { 'Content-Type': 'application/json' },
313
+ body: JSON.stringify({
314
+ error_type: error.name,
315
+ message: error.message,
316
+ backtrace: error.stack.split('\n'),
317
+ platform: Platform.OS, // 'ios' or 'android'
318
+ app_version: VERSION
319
+ })
320
+ });
321
+ }
322
+ ```
660
323
 
661
- #### Queue Configuration
324
+ **๐Ÿ“ฑ [Mobile app integration guide โ†’](docs/guides/MOBILE_APP_INTEGRATION.md)**
662
325
 
663
- Notification jobs use the `:error_notifications` queue by default. This allows you to:
664
- - Prioritize error notifications over other jobs
665
- - Monitor notification delivery separately
666
- - Configure different concurrency/workers for notifications
326
+ ---
667
327
 
668
- **Works with all ActiveJob backends:**
669
- - โœ… **Solid Queue** (Rails 8.1+ default)
670
- - โœ… **Sidekiq** (most popular)
671
- - โœ… **Delayed Job**
672
- - โœ… **Resque**
673
- - โœ… **Async** (Rails default for development)
674
- - โœ… **Inline** (for testing)
328
+ ## ๐Ÿ”” Notifications
675
329
 
676
- **Setup for Sidekiq:**
330
+ Set up multi-channel notifications in minutes:
677
331
 
332
+ ### Slack
678
333
  ```ruby
679
- # config/sidekiq.yml
680
- :queues:
681
- - default
682
- - error_notifications # Add this queue
683
- - mailers
684
-
685
- # Optional: Higher priority for error notifications
686
- :queues:
687
- - [error_notifications, 5] # Process 5x more often
688
- - [default, 1]
689
- - [mailers, 1]
334
+ config.enable_slack_notifications = true
335
+ config.slack_webhook_url = ENV['SLACK_WEBHOOK_URL']
690
336
  ```
691
337
 
692
- **Setup for Solid Queue (Rails 8.1+):**
693
-
338
+ ### Discord
694
339
  ```ruby
695
- # config/queue.yml
696
- dispatchers:
697
- batch_size: 500
698
-
699
- workers:
700
- - queues: error_notifications
701
- threads: 3
702
- processes: 1
703
- polling_interval: 1
704
- - queues: default
705
- threads: 5
706
- processes: 1
707
- polling_interval: 5
340
+ config.enable_discord_notifications = true
341
+ config.discord_webhook_url = ENV['DISCORD_WEBHOOK_URL']
708
342
  ```
709
343
 
710
- **No additional setup needed for:**
711
- - Async adapter (Rails default in development)
712
- - Inline adapter (synchronous, for testing)
713
- - Other adapters use the queue name automatically
714
-
715
- **Background Jobs:**
716
- - Notifications use `ActiveJob` and run in background
717
- - Use dedicated `:error_notifications` queue
718
- - Won't block or slow down your application
719
- - Failed notifications are logged but don't raise errors
720
- - Retries handled by your ActiveJob backend (Sidekiq, Solid Queue, etc.)
721
-
722
- ### Platform Detection
723
-
724
- Automatically detects:
725
- - **iOS** - iPhone, iPad apps
726
- - **Android** - Android apps
727
- - **API** - Backend services, web requests
728
-
729
- ### User Association
344
+ ### PagerDuty (Critical Errors Only)
345
+ ```ruby
346
+ config.enable_pagerduty_notifications = true
347
+ config.pagerduty_integration_key = ENV['PAGERDUTY_INTEGRATION_KEY']
348
+ ```
730
349
 
731
- Errors are automatically associated with the current user (if signed in). Configure the user model name if it's not `User`.
350
+ ### Custom Webhooks
351
+ ```ruby
352
+ config.enable_webhook_notifications = true
353
+ config.webhook_urls = ['https://yourapp.com/hooks/errors']
354
+ ```
732
355
 
733
- ### Retention Policy
356
+ **๐Ÿ”• [Notification setup guide โ†’](docs/guides/NOTIFICATIONS.md)**
734
357
 
735
- Old errors are automatically cleaned up based on `retention_days` configuration.
358
+ ---
736
359
 
737
- ## ๐Ÿ“Š Architecture Details
360
+ ## ๐Ÿ“š Documentation
738
361
 
739
- ### Service Objects Pattern
362
+ ### Getting Started
363
+ - **[Quickstart Guide](docs/QUICKSTART.md)** - Complete 5-minute setup
364
+ - **[Configuration](docs/guides/CONFIGURATION.md)** - All configuration options
365
+ - **[Mobile App Integration](docs/guides/MOBILE_APP_INTEGRATION.md)** - React Native, Flutter, etc.
740
366
 
741
- **Commands** (Write Operations):
742
- ```ruby
743
- # Create an error log
744
- RailsErrorDashboard::Commands::LogError.call(exception, context)
367
+ ### Features
368
+ - **[Complete Feature List](docs/FEATURES.md)** - Every feature explained
369
+ - **[Notifications](docs/guides/NOTIFICATIONS.md)** - Multi-channel alerting
370
+ - **[Batch Operations](docs/guides/BATCH_OPERATIONS.md)** - Bulk resolve/delete
371
+ - **[Real-Time Updates](docs/guides/REAL_TIME_UPDATES.md)** - Live dashboard
372
+ - **[Error Trend Visualizations](docs/guides/ERROR_TREND_VISUALIZATIONS.md)** - Charts & analytics
745
373
 
746
- # Mark error as resolved
747
- RailsErrorDashboard::Commands::ResolveError.call(error_id, resolution_data)
748
- ```
374
+ ### Advanced
375
+ - **[Plugin System](docs/PLUGIN_SYSTEM.md)** - Build custom integrations
376
+ - **[API Reference](docs/API_REFERENCE.md)** - Complete API documentation
377
+ - **[Customization Guide](docs/CUSTOMIZATION.md)** - Customize everything
378
+ - **[Database Options](docs/guides/DATABASE_OPTIONS.md)** - Separate database setup
379
+ - **[Database Optimization](docs/guides/DATABASE_OPTIMIZATION.md)** - Performance tuning
749
380
 
750
- **Queries** (Read Operations):
751
- ```ruby
752
- # Get filtered errors
753
- RailsErrorDashboard::Queries::ErrorsList.call(filters)
381
+ ### Development
382
+ - **[Testing](docs/development/TESTING.md)** - Multi-version testing
754
383
 
755
- # Get dashboard stats
756
- RailsErrorDashboard::Queries::DashboardStats.call
384
+ **๐Ÿ“– [View all documentation โ†’](docs/README.md)**
757
385
 
758
- # Get analytics
759
- RailsErrorDashboard::Queries::AnalyticsStats.call(days: 30)
760
- ```
386
+ ---
761
387
 
762
- ### Database Schema
388
+ ## ๐Ÿ—๏ธ Architecture
763
389
 
764
- ```ruby
765
- create_table :rails_error_dashboard_error_logs do |t|
766
- # Error details
767
- t.string :error_type, null: false
768
- t.text :message, null: false
769
- t.text :backtrace
770
-
771
- # Context
772
- t.integer :user_id
773
- t.text :request_url
774
- t.text :request_params
775
- t.text :user_agent
776
- t.string :ip_address
777
- t.string :environment, null: false
778
- t.string :platform
779
-
780
- # Resolution tracking
781
- t.boolean :resolved, default: false
782
- t.text :resolution_comment
783
- t.string :resolution_reference
784
- t.string :resolved_by_name
785
- t.datetime :resolved_at
786
-
787
- # Timestamps
788
- t.datetime :occurred_at, null: false
789
- t.timestamps
790
- end
791
- ```
390
+ Built with **Service Objects + CQRS Principles**:
391
+ - **Commands**: LogError, ResolveError, BatchOperations (write operations)
392
+ - **Queries**: ErrorsList, DashboardStats, Analytics (read operations)
393
+ - **Value Objects**: ErrorContext (immutable data)
394
+ - **Services**: PlatformDetector, SimilarityCalculator (business logic)
395
+ - **Plugins**: Event-driven extensibility
792
396
 
793
- ## ๐Ÿ“š Documentation
397
+ Clean, maintainable, testable architecture you can understand and modify.
794
398
 
795
- ### User Guides
796
- - **[README.md](README.md)** - Main documentation (you are here!)
797
- - **[NOTIFICATION_CONFIGURATION.md](NOTIFICATION_CONFIGURATION.md)** - Multi-channel notifications setup (Slack, Email, Discord, PagerDuty, Webhooks)
798
- - **[MOBILE_APP_INTEGRATION.md](MOBILE_APP_INTEGRATION.md)** - Complete guide for integrating with React Native, Expo, and other mobile frameworks
799
- - **[BATCH_OPERATIONS_GUIDE.md](BATCH_OPERATIONS_GUIDE.md)** - Bulk resolve/delete errors guide
800
- - **[PLUGIN_DEVELOPMENT_GUIDE.md](PLUGIN_DEVELOPMENT_GUIDE.md)** - Create custom plugins for Jira, metrics, etc.
801
-
802
- ### Operations & Deployment
803
- - **[MIGRATION_TO_SEPARATE_DATABASE.md](MIGRATION_TO_SEPARATE_DATABASE.md)** - Step-by-step guide for migrating to a separate error logs database
804
- - **[MULTI_VERSION_TESTING.md](MULTI_VERSION_TESTING.md)** - Testing across Rails 7.0-8.0 and Ruby 3.2-3.3
805
- - **[CI_TROUBLESHOOTING.md](CI_TROUBLESHOOTING.md)** - Complete guide to CI issues and solutions (for contributors)
806
-
807
- ### Topics Covered
808
- - โœ… Rails backend error tracking (automatic + manual)
809
- - โœ… Frontend/mobile error reporting (React, React Native, Vue, Angular, Flutter)
810
- - โœ… Multi-channel notifications (Slack, Email, Discord, PagerDuty, Webhooks)
811
- - โœ… Analytics and dashboard usage
812
- - โœ… Separate database setup and migration
813
- - โœ… Queue configuration (Sidekiq, Solid Queue, etc.)
814
- - โœ… Plugin system and custom integrations
815
- - โœ… Batch operations (bulk resolve/delete)
816
- - โœ… Multi-version compatibility (Rails 7.0-8.0, Ruby 3.2-3.3)
817
- - โœ… Security and authentication
818
- - โœ… Service Objects + CQRS architecture
399
+ ---
819
400
 
820
401
  ## ๐Ÿค Contributing
821
402
 
822
- Contributions are welcome! Please:
403
+ We welcome contributions! Here's how to get started:
823
404
 
824
405
  1. Fork the repository
825
- 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
826
- 3. Commit your changes (`git commit -m 'Add amazing feature'`)
827
- 4. Push to the branch (`git push origin feature/amazing-feature`)
828
- 5. Open a Pull Request
406
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
407
+ 3. Write tests for your changes
408
+ 4. Ensure all tests pass (`bundle exec rspec`)
409
+ 5. Commit your changes (`git commit -m 'Add amazing feature'`)
410
+ 6. Push to the branch (`git push origin feature/amazing-feature`)
411
+ 7. Open a Pull Request
829
412
 
830
413
  ### Development Setup
831
414
 
832
415
  ```bash
833
416
  git clone https://github.com/AnjanJ/rails_error_dashboard.git
834
417
  cd rails_error_dashboard
418
+
419
+ # Automated setup (installs deps, hooks, runs tests)
420
+ bin/setup
421
+
422
+ # Or manual setup
835
423
  bundle install
424
+ bundle exec lefthook install # Installs git hooks
425
+ bundle exec rspec
836
426
  ```
837
427
 
428
+ **Git Hooks:** We use [Lefthook](https://github.com/evilmartians/lefthook) to run quality checks before commit/push. This ensures CI passes and saves GitHub Actions minutes!
429
+
430
+ **๐Ÿ”ง [Development guide โ†’](DEVELOPMENT.md)** | **๐Ÿงช [Testing guide โ†’](docs/development/TESTING.md)**
431
+
432
+ ---
433
+
838
434
  ## ๐Ÿ“ License
839
435
 
840
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
436
+ Rails Error Dashboard is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
437
+
438
+ ---
841
439
 
842
440
  ## ๐Ÿ™ Acknowledgments
843
441
 
@@ -845,14 +443,18 @@ The gem is available as open source under the terms of the [MIT License](https:/
845
443
  - UI powered by [Bootstrap 5](https://getbootstrap.com/)
846
444
  - Charts by [Chart.js](https://www.chartjs.org/)
847
445
  - Pagination by [Pagy](https://github.com/ddnexus/pagy)
848
- - Platform detection by [Browser](https://github.com/fnando/browser)
446
+ - Platform detection by [Browser gem](https://github.com/fnando/browser)
849
447
 
850
- ## ๐Ÿ“ฎ Support
448
+ ---
851
449
 
852
- - **Issues**: [GitHub Issues](https://github.com/AnjanJ/rails_error_dashboard/issues)
853
- - **Discussions**: [GitHub Discussions](https://github.com/AnjanJ/rails_error_dashboard/discussions)
854
- - **Repository**: [https://github.com/AnjanJ/rails_error_dashboard](https://github.com/AnjanJ/rails_error_dashboard)
450
+ ## ๐Ÿ’ฌ Support
451
+
452
+ - **๐Ÿ“– Documentation**: [docs/](docs/README.md)
453
+ - **๐Ÿ› Issues**: [GitHub Issues](https://github.com/AnjanJ/rails_error_dashboard/issues)
454
+ - **๐Ÿ’ก Discussions**: [GitHub Discussions](https://github.com/AnjanJ/rails_error_dashboard/discussions)
855
455
 
856
456
  ---
857
457
 
858
458
  **Made with โค๏ธ by Anjan for the Rails community**
459
+
460
+ *One Gem to rule them all, One Gem to find them, One Gem to bring them all, and in the dashboard bind them.* ๐Ÿง™โ€โ™‚๏ธ