{"id":15397028,"url":"https://github.com/ryanhefner/next-proper","last_synced_at":"2026-04-10T22:39:30.920Z","repository":{"id":54544353,"uuid":"333500465","full_name":"ryanhefner/next-proper","owner":"ryanhefner","description":"⛓ Easily compile NextJS props via composed methods for getServerSideProps and getStaticProps.","archived":false,"fork":false,"pushed_at":"2021-03-15T19:55:01.000Z","size":2591,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-25T22:42:52.377Z","etag":null,"topics":["getserversideprops","getstaticprops","nextjs","react"],"latest_commit_sha":null,"homepage":"https://www.pkgstats.com/pkg:next-proper","language":"JavaScript","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/ryanhefner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"ryanhefner","patreon":"ryanhefner","open_collective":"ryanhefner","ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2021-01-27T17:05:30.000Z","updated_at":"2021-03-15T19:55:03.000Z","dependencies_parsed_at":"2022-08-13T19:10:54.120Z","dependency_job_id":null,"html_url":"https://github.com/ryanhefner/next-proper","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanhefner%2Fnext-proper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanhefner%2Fnext-proper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanhefner%2Fnext-proper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanhefner%2Fnext-proper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryanhefner","download_url":"https://codeload.github.com/ryanhefner/next-proper/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245944108,"owners_count":20697960,"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":["getserversideprops","getstaticprops","nextjs","react"],"created_at":"2024-10-01T15:35:55.351Z","updated_at":"2025-10-24T21:13:04.568Z","avatar_url":"https://github.com/ryanhefner.png","language":"JavaScript","funding_links":["https://github.com/sponsors/ryanhefner","https://patreon.com/ryanhefner","https://opencollective.com/ryanhefner"],"categories":[],"sub_categories":[],"readme":"# ⛓ next-proper\n\n[![npm](https://img.shields.io/npm/v/next-proper?style=flat-square)](https://www.pkgstats.com/pkg:next-proper)\n[![NPM](https://img.shields.io/npm/l/next-proper?style=flat-square)](LICENSE)\n[![npm](https://img.shields.io/npm/dt/next-proper?style=flat-square)](https://www.pkgstats.com/pkg:next-proper)\n\nEasily compile NextJS props via composed methods for `getServerSideProps` and `getStaticProps`.\n\n## Install\n\nVia [npm](https://npmjs.com/package/next-proper)\n\n```\nnpm install --save next-proper\n```\n\nVia [Yarn](https://yarn.fyi/next-proper)\n\n```\nyarn add next-proper\n```\n\n## How to use\n\nThe goal of this package is to make it easy to compose NextJS props logic for either `getServerSideProps` or `getStaticProps`, so that you don’t have to copy that same code through all your pages.\n\nDepending on your needs, or your apps logic, as you compose your prop methods, you can internally either exit early with `{ notFound: true }` or `{ redirect: ... }`, or continue the chain by calling, `next({ props: {...} })`;\n\nHere’s a basic example using some simplified auth logic:\n\n_`props/getAuthProps.js`_\n\n```\nexport const getAuthProps = async (props, next, ctx) =\u003e {\n  ...Do auth stuff...\n  const user = getUser(...)\n\n  if (!user) {\n    return {\n      redirect: {\n        destination: '/login',\n        permanent: false,\n      }\n    }\n  }\n\n  return next({\n    ...props,\n    props: {\n      ...props.props,\n      user,\n    }\n  })\n}\n```\n\n_`pages/secure-page.js`_\n\n```\nimport nextProps from 'next-proper'\nimport { getAuthProps } from 'props/getAuthProps'\nimport { getFetchPageProps } from 'props/getServerSideFetchPageProps'\n\nexport const getServerSideProps = nextProps([\n  getAuthProps,\n  getFetchPageProps,\n])\n```\n\n## License\n\n[MIT](LICENSE) © [Ryan Hefner](https://www.ryanhefner.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanhefner%2Fnext-proper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanhefner%2Fnext-proper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanhefner%2Fnext-proper/lists"}