# Pagy

> Agnostic pagination in plain ruby

Source: https://talira.ai/catalog/pagy-qf6njkb4
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [libraries / pagination](https://talira.ai/categories/libraries/pagination), [languages / ruby](https://talira.ai/categories/languages/ruby)
- Licence: MIT[^1]
- Pricing: Free and open source[^1]
- Free tier: yes[^1]
- Self-hostable: yes[^2]
- API: yes[^3]
- Creator: Domizio Demichelis (ddnexus)

Pagy paginates Ruby collections in any environment, Rails or not: `pagy(:offset, Product.all)` (or `:keyset`, `:countless`, `:calendar` and others) returns a `@pagy` object and the page of records. It offers offset, count-free, keyset, keyset navigation, search and calendar pagination, renders navigation as plain HTML, Bootstrap or Bulma or with small client-side JavaScript helpers, and gives JSON:API links or a data hash for APIs. Version 43, released in November 2025 after 9.4, was a complete redesign of the API: the old extras became part of the core and the helpers became `@pagy` methods, with an upgrade guide for the move. Domizio Demichelis created it in 2018.

## Links

- Website: https://ddnexus.github.io/pagy/
- GitHub: https://github.com/ddnexus/pagy
- Docs: https://ddnexus.github.io/pagy/guides/quick-start

## Problems it solves

- paginate a list in my Ruby app with a fast, light gem that doesn't need Rails
- page through millions of rows without a slow COUNT query and huge OFFSETs
- infinite scroll for an API that uses the last record's values instead of page numbers
- records shift between pages when new rows are inserted while someone is browsing
- paginate Elasticsearch, Meilisearch or Typesense search results with the same page links
- add JSON:API page[number] and page[size] links to a Rails API response
- browse records by year, month, week or day with page links inside each period
- Bootstrap or Bulma styled page links in a Ruby app without writing the markup
- page links that fit the container width on narrow mobile screens
- let API clients choose the page size but cap how many records they can ask for
- switch away from an older Rails pagination gem without rewriting every view

## Features

- paginators: offset, countish, countless, keyset, keynav_js and calendar
- search paginators for elasticsearch_rails, meilisearch, rails_active_search, searchkick and typesense_rails
- keyset pagination for ActiveRecord::Relation and Sequel::Dataset
- server-rendered series_nav and info_tag; JavaScript series_nav_js, input_nav_js and limit_tag_js
- pagy, Bootstrap and Bulma styles
- JSON:API pagination and a data hash for JSON clients
- I18n locales autoloaded when used
- Pagy Wand dev tool to match your app's theme
- Pagy NEXT entry point to try the next major version early
- 100% test coverage for Ruby, HTML and JavaScript

## Capabilities

- Has an API: plan not known

## Trust

Overall: 0.36 out of 1.
Signals: backing 0.40, extensibility 0.20.

- created by Domizio Demichelis (ddnexus)
- used by DocuSeal, OpenProject, Spree, Gumroad

Warnings:

- GitHub activity not fetched yet

## Alternatives

- [Kaminari](https://talira.ai/catalog/kaminari-e66mmj05.md): A Scope & Engine based, clean, powerful, customizable and sophisticated paginator for modern web app frameworks and ORMs

## Sources

[^1]: https://github.com/ddnexus/pagy/blob/master/LICENSE.txt (checked 20 Nov 2026)
[^2]: https://github.com/ddnexus/pagy (checked 20 Nov 2026)
[^3]: https://ddnexus.github.io/pagy/guides/quick-start (checked 20 Nov 2026)
