Repolode
ddnexus

ddnexus/pagy

Agnostic pagination library for plain Ruby that supports offset, keyset, search and calendar paginators across Rails, Sinatra and other frameworks.

Stars
4,998
Forks
447
Open issues
3
Last commit
15 hours ago

What is it?

Pagy is a pagination gem for Ruby that works with any collection type and environment, not only Rails. It offers several paginator strategies, including OFFSET, COUNTISH, COUNTLESS, KEYSET, KEYNAV, SEARCH and CALENDAR, so developers can choose the approach that fits their data size and access pattern.

On the rendering side, Pagy can produce server-side navigation helpers styled for Bootstrap, Bulma or its own default style, as well as client-side navigation components that fill the container width. It also supports JSON:API nested query strings and JSON responses that carry pagination metadata for API clients.

Pagy includes adapters for search backends such as Elasticsearch Rails, Meilisearch, Searchkick and Typesense Rails. Its README describes autoloading only the methods a project uses, and a built-in dev tools panel for previewing styles inside a running app.

Key features

  • 01Supports OFFSET, KEYSET, COUNTLESS, CALENDAR and other pagination techniques.
  • 02Provides server-side nav helpers for Bootstrap, Bulma and a default style.
  • 03Offers client-side navigation components that adapt to container width.
  • 04Outputs JSON:API link structures and JSON metadata for API clients.
  • 05Adapters for Elasticsearch Rails, Meilisearch, Searchkick and Typesense Rails.

Use cases

  • Adding paginated lists to a Rails application with Bootstrap or Bulma styling.
  • Building a JSON API that returns JSON:API-style pagination links.
  • Paginating search results from Elasticsearch, Meilisearch or Typesense in Ruby.
  • Paginating time-based data by year, month, week or day with calendar navigation.

Quick start

  1. 1

    Include Pagy::Method in your controller (e.g. application_controller.rb)

  2. 2

    Paginate a collection with pagy(:offset, Product.all)

In collections

Topics

#ruby#pagination#rails#jsonapi#search#web-framework#bootstrap#bulma#elasticsearch-rails#hanami

FAQ

What is pagy?
Agnostic pagination library for plain Ruby that supports offset, keyset, search and calendar paginators across Rails, Sinatra and other frameworks. Pagy is a pagination gem for Ruby that works with any collection type and environment, not only Rails. It offers several paginator strategies, including OFFSET, COUNTISH, COUNTLESS, KEYSET, KEYNAV, SEARCH and CALENDAR, so developers can choose the approach that fits their data size and access pattern.
Is pagy free to use? What license does it have?
pagy is open source under the MIT license. Check the license terms before using it in commercial products.
Is pagy still maintained?
Actively maintained. The last commit to pagy was on Nov 6, 2026.
What can I use pagy for?
Adding paginated lists to a Rails application with Bootstrap or Bulma styling. Building a JSON API that returns JSON:API-style pagination links. Paginating search results from Elasticsearch, Meilisearch or Typesense in Ruby. Paginating time-based data by year, month, week or day with calendar navigation.
How do I install pagy?
Include Pagy::Method in your controller (e.g. application_controller.rb) Paginate a collection with pagy(:offset, Product.all)
Where can I get pagy?
The source code and installation instructions are on GitHub: https://github.com/ddnexus/pagy

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects