{"id":28646921,"url":"https://github.com/patrick204nqh/dbwatcher","last_synced_at":"2026-01-20T17:57:15.924Z","repository":{"id":298746755,"uuid":"1000284207","full_name":"patrick204nqh/dbwatcher","owner":"patrick204nqh","description":"Track and visualize database changes in Rails applications","archived":false,"fork":false,"pushed_at":"2025-09-29T13:27:38.000Z","size":2126,"stargazers_count":19,"open_issues_count":16,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-07T15:40:20.574Z","etag":null,"topics":["activerecord","database","database-visualization","debugging","debugging-tool","developer-tools","development-tools","devtools","monitoring","rails","rails-development","ruby","ruby-on-rails","sql","visualization"],"latest_commit_sha":null,"homepage":"https://rubydoc.info/gems/dbwatcher","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/patrick204nqh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-06-11T14:39:14.000Z","updated_at":"2025-09-29T10:19:48.000Z","dependencies_parsed_at":"2025-06-12T17:24:50.822Z","dependency_job_id":"cdf46123-5623-4583-87c2-620349ec6af0","html_url":"https://github.com/patrick204nqh/dbwatcher","commit_stats":null,"previous_names":["patrick204nqh/dbwatcher"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/patrick204nqh/dbwatcher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrick204nqh%2Fdbwatcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrick204nqh%2Fdbwatcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrick204nqh%2Fdbwatcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrick204nqh%2Fdbwatcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patrick204nqh","download_url":"https://codeload.github.com/patrick204nqh/dbwatcher/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrick204nqh%2Fdbwatcher/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279014675,"owners_count":26085554,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-13T02:00:06.723Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["activerecord","database","database-visualization","debugging","debugging-tool","developer-tools","development-tools","devtools","monitoring","rails","rails-development","ruby","ruby-on-rails","sql","visualization"],"created_at":"2025-06-13T02:08:27.977Z","updated_at":"2025-10-13T22:17:30.929Z","avatar_url":"https://github.com/patrick204nqh.png","language":"Ruby","readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://raw.githubusercontent.com/patrick204nqh/dbwatcher/master/public/images/dbwatcher_512x512.png\" alt=\"dbwatcher Logo\" width=\"120\" height=\"120\"\u003e\n\n  \u003ch1 align=\"center\"\u003edbwatcher\u003c/h1\u003e\n\n  \u003cp align=\"center\"\u003e\n    \u003cem\u003e🔍 Track, visualize, and debug database operations in your Rails applications\u003c/em\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n[![CI](https://github.com/patrick204nqh/dbwatcher/actions/workflows/ci.yml/badge.svg)](https://github.com/patrick204nqh/dbwatcher/actions/workflows/ci.yml)\n[![Release Gem](https://github.com/patrick204nqh/dbwatcher/actions/workflows/release.yml/badge.svg)](https://github.com/patrick204nqh/dbwatcher/actions/workflows/release.yml)\n[![Gem Version](https://badge.fury.io/rb/dbwatcher.svg)](https://badge.fury.io/rb/dbwatcher)\n[![RubyGems Downloads](https://img.shields.io/gem/dt/dbwatcher?color=blue)](https://rubygems.org/gems/dbwatcher)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Maintainability](https://qlty.sh/gh/patrick204nqh/projects/dbwatcher/maintainability.svg)](https://qlty.sh/gh/patrick204nqh/projects/dbwatcher)\n[![Code Coverage](https://qlty.sh/gh/patrick204nqh/projects/dbwatcher/coverage.svg)](https://qlty.sh/gh/patrick204nqh/projects/dbwatcher)\n\nA Rails gem that tracks and visualizes database operations in your application. Built for developers who need to understand complex data flows and debug database interactions.\n\n## Why dbwatcher?\n\nWhen developing Rails applications, understanding what database operations occur during code execution can be challenging. **dbwatcher** provides a simple way to:\n\n- Track database changes within specific code blocks\n- Monitor SQL operations during HTTP requests\n- Visualize database relationships and model associations\n- Debug complex data flows with an intuitive web interface\n\n## Key Features\n\n- **Database Operation Tracking** - Capture SQL operations (INSERT, UPDATE, DELETE)\n- **Targeted Monitoring** - Track specific code blocks or entire HTTP requests\n- **Interactive Dashboard** - Clean web interface for exploring captured data\n- **Relationship Diagrams** - Visualize database relationships and model associations\n- **Simple Setup** - File-based storage with zero additional database requirements\n- **Development Ready** - Designed specifically for development environments\n\n## Screenshots\n\n### Dashboard Interface\n\n![image](https://github.com/user-attachments/assets/063e6030-c53e-4338-9332-94173542aca5)\n\n### Session View\n\n![image](https://github.com/user-attachments/assets/790b0f37-ca76-48d8-83d2-5a6fb1a1dee8)\n\n[View more screenshots in here →](docs/screenshots.md)\n\n## Installation\n\nAdd to your Gemfile:\n\n```ruby\ngem 'dbwatcher', group: :development\n```\n\nInstall the gem:\n\n```bash\nbundle install\n```\n\nThe dashboard automatically becomes available at `/dbwatcher` in your Rails application.\n\n## Usage\n\n### Track Code Blocks\n\nMonitor specific operations:\n\n```ruby\nDbwatcher.track(name: \"User Registration\") do\n  user = User.create!(name: \"John\", email: \"john@example.com\")\n  user.create_profile!(bio: \"Developer\")\n  user.posts.create!(title: \"Hello World\")\nend\n```\n\n### Track HTTP Requests\n\nAdd `?dbwatch=true` to any URL:\n\n```\nGET /users/123?dbwatch=true\nPOST /api/users?dbwatch=true\n```\n\n### View Results\n\nVisit `/dbwatcher` in your browser to explore tracked operations.\n\n## Configuration\n\n**dbwatcher** works out of the box with zero configuration - simply install the gem and visit `/dbwatcher` in your Rails application.\n\n### Configuration Options\n\n\u003cdetails\u003e\n\u003csummary\u003eView All Configuration Settings\u003c/summary\u003e\n\n| Setting                       | Type    | Default           | Description                                         |\n| ----------------------------- | ------- | ----------------- | --------------------------------------------------- |\n| **Core Settings**             |\n| `enabled`                     | Boolean | `true`            | Enable or disable DBWatcher                         |\n| `storage_path`                | String  | `\"tmp/dbwatcher\"` | Directory for session data storage                  |\n| **Session Management**        |\n| `max_sessions`                | Integer | `50`              | Maximum number of sessions to retain                |\n| `auto_clean_days`             | Integer | `7`               | Automatically delete sessions older than N days     |\n| **Query Tracking**            |\n| `track_queries`               | Boolean | `false`           | Enable full SQL query tracking (resource intensive) |\n| **System Information**        |\n| `system_info`                 | Boolean | `true`            | Collect system information for debugging            |\n| `debug_mode`                  | Boolean | `false`           | Enable detailed debug logging                       |\n| **Database Diagram Options**  |\n| `diagram_show_attributes`     | Boolean | `true`            | Display model attributes in diagrams                |\n| `diagram_show_cardinality`    | Boolean | `true`            | Show relationship cardinality indicators            |\n| `diagram_show_methods`        | Boolean | `false`           | Include model methods in diagrams                   |\n| `diagram_max_attributes`      | Integer | `10`              | Maximum attributes displayed per model              |\n| `diagram_attribute_types`     | Boolean | `true`            | Show data types for attributes                      |\n| `diagram_relationship_labels` | Boolean | `true`            | Display labels on relationship lines                |\n\n### Configuration Example\n\n```ruby\n# config/environments/development.rb\nRails.application.configure do\n  config.dbwatcher.enabled = true\n  config.dbwatcher.max_sessions = 100\n  config.dbwatcher.track_queries = true\nend\n```\n\n\u003c/details\u003e\n\n## Advanced Features\n\n### Custom Metadata\n\nAdd context to your tracking:\n\n```ruby\nDbwatcher.track(\n  name: \"Order Processing\",\n  metadata: { user_id: current_user.id, order_type: \"premium\" }\n) do\n  # Database operations here\nend\n```\n\n### Access Current Session\n\nAccess the current tracking session:\n\n```ruby\nsession = Dbwatcher.current_session\nputs \"Session ID: #{session.id}\"\nputs \"Total changes: #{session.changes.count}\"\n```\n\n### Clear All Data\n\nRemove all stored sessions and queries:\n\n```ruby\nDbwatcher.clear_all\n```\n\n## Development\n\n### Running Tests\n\n```bash\nbundle exec rake test        # All tests\nbundle exec rake unit        # Unit tests only\nbundle exec rake acceptance  # Feature tests only\n```\n\n### Code Coverage\n\nThe project uses SimpleCov for code coverage and uploads results to Qlty. To run tests with coverage locally:\n\n```bash\nCOVERAGE=true bundle exec rake test\n```\n\nCoverage reports will be generated in the `coverage/` directory.\n\n### Local Development\n\n```bash\ncd spec/dummy\nbundle exec rails server -p 3001\nopen http://localhost:3001/dbwatcher\n```\n\n### Code Quality\n\n```bash\nbundle exec rubocop    # Linting\nbundle exec brakeman   # Security analysis\n```\n\n[Changelog →](CHANGELOG.md)\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch: `git checkout -b my-feature`\n3. Make changes and add tests\n4. Run tests: `bundle exec rake test`\n5. Run linter: `bundle exec rubocop`\n6. Commit changes: `git commit -am 'Add feature'`\n7. Push branch: `git push origin my-feature`\n8. Open a Pull Request\n\n[Contributing guidelines →](CONTRIBUTING.md)\n\n## Resources\n\n- [Documentation](https://rubydoc.info/gems/dbwatcher)\n- [Changelog](CHANGELOG.md)\n- [Report Bug](https://github.com/patrick204nqh/dbwatcher/issues/new)\n- [Request Feature](https://github.com/patrick204nqh/dbwatcher/issues/new)\n\n## License\n\nReleased under the [MIT License](https://opensource.org/licenses/MIT).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrick204nqh%2Fdbwatcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatrick204nqh%2Fdbwatcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrick204nqh%2Fdbwatcher/lists"}