{"id":15653153,"url":"https://github.com/jaydenseric/next-server-context","last_synced_at":"2025-08-23T01:46:53.114Z","repository":{"id":58113809,"uuid":"243237611","full_name":"jaydenseric/next-server-context","owner":"jaydenseric","description":"A Next.js App or page decorator, React context object, and React hook to access Node.js HTTP server context when rendering components.","archived":false,"fork":false,"pushed_at":"2023-11-22T06:04:37.000Z","size":107,"stargazers_count":31,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-01T00:20:02.640Z","etag":null,"topics":["esm","graphql","maintained","mjs","next","node","npm","react"],"latest_commit_sha":null,"homepage":"https://npm.im/next-server-context","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/jaydenseric.png","metadata":{"files":{"readme":"readme.md","changelog":"changelog.md","contributing":null,"funding":".github/funding.yml","license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"jaydenseric"}},"created_at":"2020-02-26T10:40:24.000Z","updated_at":"2024-06-10T19:43:32.000Z","dependencies_parsed_at":"2024-06-19T11:23:27.632Z","dependency_job_id":"5645c50b-d46c-4091-b60f-648224b6bfc7","html_url":"https://github.com/jaydenseric/next-server-context","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/jaydenseric/next-server-context","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaydenseric%2Fnext-server-context","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaydenseric%2Fnext-server-context/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaydenseric%2Fnext-server-context/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaydenseric%2Fnext-server-context/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaydenseric","download_url":"https://codeload.github.com/jaydenseric/next-server-context/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaydenseric%2Fnext-server-context/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263671770,"owners_count":23494037,"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":["esm","graphql","maintained","mjs","next","node","npm","react"],"created_at":"2024-10-03T12:44:49.589Z","updated_at":"2025-07-05T09:05:07.440Z","avatar_url":"https://github.com/jaydenseric.png","language":"JavaScript","readme":"# next-server-context\n\nA [Next.js](https://nextjs.org) [`App` or page decorator](./withServerContext.mjs), [React context object](./ServerContextContext.mjs), and [React hook](./useServerContext.mjs) to access [Node.js](https://nodejs.org) HTTP server context when rendering components.\n\nSome uses:\n\n- Setting the HTTP response status code for the server side rendered page according to [GraphQL](https://graphql.org) query results in components.\n- Isomorphically accessing cookies within components.\n\n## Installation\n\nTo install [`next-server-context`](https://npm.im/next-server-context) with [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm), run:\n\n```sh\nnpm install next-server-context\n```\n\nDecorate either the entire [Next.js](https://nextjs.org) app or individual pages using the function [`withServerContext`](./withServerContext.mjs) to be able to use the [React](https://reactjs.org) hook [`useServerContext`](./useServerContext.mjs).\n\n## Requirements\n\nSupported runtime environments:\n\n- [Node.js](https://nodejs.org) versions `^18.17.0 || \u003e=20.4.0`.\n- Browsers matching the [Browserslist](https://browsersl.ist) query [`\u003e 0.5%, not OperaMini all, not dead`](https://browsersl.ist/?q=%3E+0.5%25%2C+not+OperaMini+all%2C+not+dead).\n\nProjects must configure [TypeScript](https://www.typescriptlang.org) to use types from the ECMAScript modules that have a `// @ts-check` comment:\n\n- [`compilerOptions.allowJs`](https://www.typescriptlang.org/tsconfig#allowJs) should be `true`.\n- [`compilerOptions.maxNodeModuleJsDepth`](https://www.typescriptlang.org/tsconfig#maxNodeModuleJsDepth) should be reasonably large, e.g. `10`.\n- [`compilerOptions.module`](https://www.typescriptlang.org/tsconfig#module) should be `\"node16\"` or `\"nodenext\"`.\n\n## Exports\n\nThe [npm](https://npmjs.com) package [`next-server-context`](https://npm.im/next-server-context) features [optimal JavaScript module design](https://jaydenseric.com/blog/optimal-javascript-module-design). It doesn’t have a main index module, so use deep imports from the ECMAScript modules that are exported via the [`package.json`](./package.json) field [`exports`](https://nodejs.org/api/packages.html#exports):\n\n- [`ServerContextContext.mjs`](./ServerContextContext.mjs)\n- [`useServerContext.mjs`](./useServerContext.mjs)\n- [`withServerContext.mjs`](./withServerContext.mjs)\n","funding_links":["https://github.com/sponsors/jaydenseric"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaydenseric%2Fnext-server-context","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaydenseric%2Fnext-server-context","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaydenseric%2Fnext-server-context/lists"}