{"id":15288739,"url":"https://github.com/rameerez/dashboards","last_synced_at":"2025-04-13T06:52:15.187Z","repository":{"id":257804062,"uuid":"862676814","full_name":"rameerez/dashboards","owner":"rameerez","description":"🍱 Ruby gem to create customizable bento-style admin dashboards in your Rails app","archived":false,"fork":false,"pushed_at":"2024-09-28T22:26:24.000Z","size":84,"stargazers_count":6,"open_issues_count":3,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T23:11:42.521Z","etag":null,"topics":["admin","admin-dashboard","admin-panel","bento","business","business-analytics","business-intelligence","dashboard","data-analysis","gem","rails","ruby"],"latest_commit_sha":null,"homepage":"","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/rameerez.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-25T02:15:49.000Z","updated_at":"2025-03-04T08:48:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"086ad49a-b836-4692-bdff-22f09edf8159","html_url":"https://github.com/rameerez/dashboards","commit_stats":{"total_commits":33,"total_committers":1,"mean_commits":33.0,"dds":0.0,"last_synced_commit":"9bdffc56fca8ada59caa19b33f7ea5b3400083cd"},"previous_names":["rameerez/dashboards"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rameerez%2Fdashboards","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rameerez%2Fdashboards/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rameerez%2Fdashboards/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rameerez%2Fdashboards/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rameerez","download_url":"https://codeload.github.com/rameerez/dashboards/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248675455,"owners_count":21143767,"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","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":["admin","admin-dashboard","admin-panel","bento","business","business-analytics","business-intelligence","dashboard","data-analysis","gem","rails","ruby"],"created_at":"2024-09-30T15:52:43.691Z","updated_at":"2025-04-13T06:52:15.163Z","avatar_url":"https://github.com/rameerez.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🍱 `dashboards` - Ruby gem to create customizable bento-style admin dashboards in your Rails app\n\n`dashboards` is a Ruby gem that allows you to create beautiful admin dashboards in your Rails application with a very simple and straightforward DSL.\n\nCreating a dashboard looks something like this:\n```ruby\ndashboard \"Admin Dashboard\" do\n  box \"Total Users\" do\n    metric value: -\u003e { User.count }\n  end\n\n  box \"Posts over time\" do\n    chart type: :line, data: -\u003e { Post.group_by_day(:created_at).count }\n  end\nend\n```\n\nWhich automatically creates a beautiful bento-style dashboard like this:\n\n![Dashboard](/dashboards.webp)\n\n`dashboards` has a minimal setup so you can quickly build dashboards with metrics, charts, tables, summaries, and change-over-period indicators.\n\nIt uses [Chartkick](https://github.com/ankane/chartkick) for charts, and [groupdate](https://github.com/ankane/groupdate) for time-based grouping.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n```ruby\ngem 'dashboards'\n```\n\nAnd then execute:\n```bash\nbundle install\n```\n\n## Usage\n\n1. Create a file `config/dashboards.rb` in your Rails application, and define your dashboard using the Dashboards DSL:\n```ruby\ndashboard \"Admin Dashboard\" do\n  box \"User Statistics\" do\n    metric value: -\u003e { User.count }\n    summary data: -\u003e { User }\n    chart \"User Signups\", type: :line, data: -\u003e { User.group_by_day(:created_at).count }\n    change_over_period -\u003e { User }\n  end\n\n  box \"Post Statistics\" do\n    chart \"Posts by Category\", type: :pie, data: -\u003e { Post.group(:category).count }\n    table \"Recent Posts\", data: -\u003e { Post.order(created_at: :desc).limit(5) }\n  end\nend\n```\n\n2. Mount the Dashboards engine in your `config/routes.rb`:\n```ruby\nmount Dashboards::Engine, at: \"/admin/dashboard\"\n```\n\nIt's a good idea to make sure you're adding some authentication to the `dashboards` route to avoid exposing sensitive information:\n```ruby\nauthenticate :user, -\u003e(user) { user.admin? } do\n  mount Dashboards::Engine, at: \"/admin/dashboard\"\nend\n```\n\n3. Visit `/admin/dashboard` in your browser to see your new dashboard!\n\n## Available Components\n\n### Metrics\n\n```ruby\nmetric value: -\u003e { User.count }\n```\n\nMetrics display a single value, a big number inside the box.\n\nMetrics can be either a generic number or a currency:\n\n```ruby\nmetric value: -\u003e { Order.sum(:total) }, currency: \"$\"\n```\n\nYou can also display a percentage:\n\n```ruby\n# This will show, for example, a percentage of users that have posted at least one time.\nmetric value: -\u003e { (Post.group(:user_id).count.uniq.count.to_f / User.count * 100).round(0) }, percentage: true\n```\n\nYou can also pretty print big numbers:\n\n```ruby\n# This will display 1.2B, 1.2M, or 1.2K for 1.2 billion, million, or thousand.\nmetric value: -\u003e { 1234567890 }, format_big_numbers: true\n```\n\n### Charts\n\n```ruby\nchart type: :line, data: -\u003e { User.group_by_day(:created_at).count }\n```\n\nSupported chart types: `:line`, `:bar`, `:column`, `:area`, `:pie`\n\nCharts can be customized with colors, height, and other options:\n\n```ruby\nchart type: :line, data: -\u003e { Order.group_by_month(:created_at).sum(:total) }, \n      color: \"#4CAF50\", height: \"300px\"\n```\n\nYou can also add a title to the chart:\n\n```ruby\nchart \"Order Totals\", type: :line, data: -\u003e { Order.group_by_month(:created_at).sum(:total) }, \n      color: \"#4CAF50\", height: \"300px\", title: \"Monthly Order Totals\"\n```\n\n### Tables\n\n```ruby\ntable data: -\u003e { { \"US\" =\u003e 100, \"UK\" =\u003e 200, \"CA\" =\u003e 300 } }\n```\n\nTables display data in a tabular format.\n\nCurrently, only two-column tables are supported. The data input should be a hash, like this:\n\n```ruby\n# This will display a table of the 5 most recent users that have confirmed their email address.\n\ntable value: -\u003e {\n  User.order(created_at: :desc).limit(5).pluck(:email, :confirmed_at).map do |email, confirmed_at|\n    {\n      email: email,\n      confirmed_at: ActionController::Base.helpers.time_ago_in_words(confirmed_at) + \" ago\"\n    }\n  end\n}\n```\n\nYou can leverage [`hightop`](https://github.com/ankane/hightop) to, for example, display a table of the top most sold products:\n\n```ruby\ntable data: -\u003e { Product.top(:sales, 5) }\n```\n\n### Summaries\n\n```ruby\nsummary data: -\u003e { User }\n```\n\nSummaries show quick statistics for the last 24 hours, 7 days, and 30 days. The periods can be customized:\n\n```ruby\nsummary data: -\u003e { User }, periods: [\n  { name: '1h', duration: 1.hour },\n  { name: '12h', duration: 12.hours },\n  { name: '24h', duration: 24.hours }\n]\n```\n\n### Change Over Period\n\n```ruby\nchange_over_period -\u003e { User }\nchange_over_period -\u003e { Post }, period: 30.days, date_column: :published_at\n```\n\nThis component shows the percentage change over a specified period (default is 7 days). You can customize the period and the date column used for comparison.\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`.\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/rameerez/dashboards. Our code of conduct is: just be nice and make your mom proud of what you do and post online.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frameerez%2Fdashboards","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frameerez%2Fdashboards","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frameerez%2Fdashboards/lists"}