{"id":14979101,"url":"https://github.com/nazmulnnb/fastapi-paginate","last_synced_at":"2025-10-28T14:30:51.119Z","repository":{"id":42056469,"uuid":"480645580","full_name":"nazmulnnb/fastapi-paginate","owner":"nazmulnnb","description":"Fastapi pagination with meta endpoint links(first, last, next, previous)","archived":false,"fork":false,"pushed_at":"2022-09-26T02:56:27.000Z","size":758,"stargazers_count":10,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-09-29T02:22:12.285Z","etag":null,"topics":["fastapi","fastapi-paginate","fastapi-pagination","pagination","pagination-library","python","sqlalchemy-paginate"],"latest_commit_sha":null,"homepage":"https://fastapi-paginate.netlify.app","language":"Python","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/nazmulnnb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-04-12T03:56:23.000Z","updated_at":"2023-12-26T19:03:19.000Z","dependencies_parsed_at":"2022-08-12T03:31:45.707Z","dependency_job_id":null,"html_url":"https://github.com/nazmulnnb/fastapi-paginate","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nazmulnnb%2Ffastapi-paginate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nazmulnnb%2Ffastapi-paginate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nazmulnnb%2Ffastapi-paginate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nazmulnnb%2Ffastapi-paginate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nazmulnnb","download_url":"https://codeload.github.com/nazmulnnb/fastapi-paginate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219859520,"owners_count":16556036,"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":["fastapi","fastapi-paginate","fastapi-pagination","pagination","pagination-library","python","sqlalchemy-paginate"],"created_at":"2024-09-24T13:59:13.754Z","updated_at":"2025-10-28T14:30:50.784Z","avatar_url":"https://github.com/nazmulnnb.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FastAPI Pagination\n\n[![License](https://img.shields.io/badge/License-MIT-lightgrey)](/LICENSE)\n[![codecov](https://github.com/nazmulnnb/fastapi-paginate/workflows/Test/badge.svg)](https://github.com/nazmulnnb/fastapi-paginate/actions)\n[![PYPI](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![PYPI](https://img.shields.io/pypi/v/fastapi-paginate)](https://pypi.org/project/fastapi-paginate/)\n\n\nfastapi-paginate is an extended work of fastapi-pagination. \nfastapi-paginate returns following extra meta information:\n* next: endpoint of the next page.\n* previous: endpoint of the previous page. \n* first: endpoint of the first page.\n* last: endpoint of the last page.\n\nAll of these meta keeps all the filter parameters passed by the client and returns as it is.\nIf any of these meta is not available, it will return null.\n\nexample:\n![OpenAPI](docs/img/openapi_example.png)\n\n## Installation\n\n```bash\n# Basic version\npip install fastapi-paginate\n\n# All available integrations\npip install fastapi-paginate[all]\n```\n\nAvailable integrations:\n\n* [sqlalchemy](https://github.com/sqlalchemy/sqlalchemy)\n* [gino](https://github.com/python-gino/gino)\n* [databases](https://github.com/encode/databases)\n* [ormar](http://github.com/collerek/ormar)\n* [orm](https://github.com/encode/orm)\n* [tortoise](https://github.com/tortoise/tortoise-orm)\n* [django](https://github.com/django/django)\n* [piccolo](https://github.com/piccolo-orm/piccolo)\n* [sqlmodel](https://github.com/tiangolo/sqlmodel)\n* [motor](https://github.com/mongodb/motor)\n* [mongoengine](https://github.com/MongoEngine/mongoengine)\n\n## Example\n\n```python\nfrom fastapi import FastAPI\nfrom pydantic import BaseModel\n\nfrom fastapi_paginate import Page, add_pagination, paginate\n\napp = FastAPI()\n\n\nclass User(BaseModel):\n    name: str\n    surname: str\n\n\nusers = [\n    User(name='Yurii', surname='Karabas'),\n    # ...\n]\n\n\n@app.get('/users', response_model=Page[User])\nasync def get_users():\n    return paginate(users)\n\n\nadd_pagination(app)\n```\n\n## sqlalchemy example\n```python\nfrom fastapi import FastAPI, Depends\nfrom pydantic import BaseModel\n\nfrom fastapi_paginate import Page, add_pagination\nfrom fastapi_paginate.ext.sqlalchemy import paginate\n\nfrom sqlalchemy.orm import Session\n\napp = FastAPI()\n\nclass UserModel(Base):\n    name = Column(String)\n    surname = Column(String)\n    age = Column(Integer)\n\nclass User(BaseModel):\n    name: str\n    surname: str\n    age: int\n\n@app.get('/users', response_model=Page[User])\nasync def get_users(db_session: Session = Depends(get_db_session)):\n    stmt = db_session.query(UserModel)\n    \n    # add filters \n    stmt = stmt.filter(UserModel.age \u003c 30)\n    \n    # sort\n    stmt = stmt.order_by(asc(UserModel.age))\n    \n    return paginate(stmt)\n\n\nadd_pagination(app)\n```\n\n\nThis repo is forked from [fastapi-pagination](https://github.com/uriyyo/fastapi-pagination).\nAlthough original repository is already good enough, but I modified it according to my needs and published thinking it might be helpful for some.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnazmulnnb%2Ffastapi-paginate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnazmulnnb%2Ffastapi-paginate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnazmulnnb%2Ffastapi-paginate/lists"}