A fast, lightweight, and agnostic pagination gem for Ruby applications with multiple pagination techniques and frontend helpers.
Pagy is a pagination library for Ruby that provides efficient, framework-agnostic tools for splitting large datasets into manageable pages. It solves the performance and complexity issues of traditional pagination gems by offering multiple pagination techniques, minimal configuration, and a lightweight footprint. It supports everything from basic offset pagination to advanced keyset and calendar-based pagination.
Ruby developers building web applications with Rails, Sinatra, or other frameworks who need fast, flexible pagination for ActiveRecord collections, search results, JSON APIs, or time-based data.
Developers choose Pagy for its exceptional speed (up to 40x faster than alternatives), minimal memory usage, and comprehensive feature set without bloat. Its agnostic design, zero-configuration defaults, and built-in frontend helpers reduce boilerplate and improve maintainability.
🏆 The Best Pagination Ruby Gem 🥇
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Benchmarks show Pagy is up to 40x faster and 36x lighter than alternatives like Kaminari and WillPaginate, with minimal memory overhead and object allocation.
Supports seven pagination methods including OFFSET, keyset for performance, and calendar for time-based data, catering to diverse use cases from databases to search engines.
Works seamlessly with any Ruby framework (Rails, Sinatra) and data source like ActiveRecord, JSON:API, and search engines like Elasticsearch and Meilisearch.
Version 43 reduces setup requirements by 99% with automatic I18n loading, method autoloading, and near-zero initial configuration, conserving resources.
Built-in styles are only available for Pagy, Bootstrap, and Bulma, requiring custom CSS work or tooling like Pagy Wand for other frameworks such as Tailwind.
Version 43 is a complete redesign with a new API, necessitating a migration guide and potential code rewrites, which can be disruptive for existing projects.
Client-side rendering helpers like series_nav_js require JavaScript setup and dependencies, adding complexity for server-heavy or JavaScript-light applications.
Pagy is an open-source alternative to the following products: