{"id":21334006,"url":"https://github.com/purinx/next-server-components","last_synced_at":"2025-07-14T16:34:42.603Z","repository":{"id":117984891,"uuid":"325998857","full_name":"purinx/next-server-components","owner":"purinx","description":null,"archived":false,"fork":false,"pushed_at":"2021-01-01T14:55:15.000Z","size":145,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-27T13:54:30.585Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/purinx.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-01T14:55:07.000Z","updated_at":"2023-03-04T03:00:00.000Z","dependencies_parsed_at":"2024-08-13T09:15:43.733Z","dependency_job_id":null,"html_url":"https://github.com/purinx/next-server-components","commit_stats":null,"previous_names":["purinx/next-server-components"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/purinx/next-server-components","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purinx%2Fnext-server-components","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purinx%2Fnext-server-components/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purinx%2Fnext-server-components/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purinx%2Fnext-server-components/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/purinx","download_url":"https://codeload.github.com/purinx/next-server-components/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/purinx%2Fnext-server-components/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265319494,"owners_count":23746361,"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":[],"created_at":"2024-11-21T23:17:01.389Z","updated_at":"2025-07-14T16:34:42.584Z","avatar_url":"https://github.com/purinx.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Server Components in Next.js\n\nExperimental app of React Server Components with Next.js, based on [React Server Components Demo](https://github.com/reactjs/server-components-demo).  \n**It's not ready for adoption. Use this in your projects at your own risk.**\n\n## Development\n\n### Prepare\n\nYou need these environment variables to run this app (you can create a `.env` file):\n\n```\nREDIS_URL='rediss://:\u003cpassword\u003e@\u003curl\u003e:\u003cport\u003e' // or `redis://` if no TLS\nENDPOINT='http://localhost:3000'              // need to be absolute url to run in prod/local\nNEXT_PUBLIC_ENDPOINT='http://localhost:3000'  // same as above\nSESSION_KEY='\u003crandom key for cookie-based session\u003e'\nOAUTH_CLIENT_KEY='github oauth app id'\nOAUTH_CLIENT_SECRET='github oauth app secret'\n```\n\n### Start\n\n1. `yarn install` (this will trigger the postinstall command)\n2. `yarn dev`\n\nGo to `localhost:3000` to view the application.\n\n### Deploy\n\n[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https%3A%2F%2Fgithub.com%2Fvercel%2Fnext-server-components\u0026env=REDIS_URL,ENDPOINT,NEXT_PUBLIC_ENDPOINT,SESSION_KEY,OAUTH_CLIENT_KEY,OAUTH_CLIENT_SECRET\u0026project-name=next-server-components\u0026repo-name=next-server-components\u0026demo-title=React%20Server%20Components%20(Experimental%20Demo)\u0026demo-description=Experimental%20demo%20of%20React%20Server%20Components%20with%20Next.js.%20\u0026demo-url=https%3A%2F%2Fnext-server-components.vercel.app\u0026demo-image=https%3A%2F%2Fnext-server-components.vercel.app%2Fog.png)\n\n## Caveats\n\n- Only `.js` extension is supported.\n- Client / server components should be under the `components` directory.\n- Some React Hooks are not supported in server components, such as `useContext`.\n- You have to manually import `React` in your server components.\n\n## How does it work?\n\nApplication APIs:\n\n- `GET, POST /api/notes` (Get all notes, Create a new note)\n- `GET, PUT, DELETE /api/notes/\u003cnote_id\u003e` (Action for a specific note)\n\nReact Server Components API (`pages/api/index.js`):\n\n- `GET /api` (render application and return the serialized components)\n\nNote: Some of the application APIs (`POST`, `PUT`, `DELETE`) will render and return the serialized components as well. The render logic is handled by `libs/send-res.js`.\n\n`libs/send-res.js` accepts the props (from `req.query.location` and `req.session.login`) that needs to be rendered by `components/App.server.js` (the component tree entry). Then, it renders the tree and streams it to `res` using:\n\n```js\npipeToNodeWritable(React.createElement(App, props), res, moduleMap)\n```\n\n`moduleMap` is generated by client-side Webpack (through Next.js). It traverses both `.server.js` and `.client.js` and generates the full module map from the `react-server-dom-webpack/plugin` Webpack plugin (see `next.config.js`).\nThen, we use a custom plugin to copy it to `libs/react-client-manifest.json` and include it from the lambdas (see `libs/send-res-with-module-map.js`).\n\n`App` is a special build of `components/App.server.js`, which removes all the client components (marked as special modules) because they're not accessible from the server. We bundled it together with `libs/send-res.js` with another Webpack loader into `libs/send-res.build.js`. The Webpack script and loader are under `scripts/`. It should run whenever a server component is updated.\n\nFinally, everything related to OAuth is inside `pages/api/auth.js`. It's a cookie-based session using GitHub for login.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurinx%2Fnext-server-components","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpurinx%2Fnext-server-components","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpurinx%2Fnext-server-components/lists"}