{"id":13533283,"url":"https://github.com/Perivel/solid-pod","last_synced_at":"2025-04-01T21:32:10.447Z","repository":{"id":42533446,"uuid":"449085693","full_name":"Perivel/solid-pod","owner":"Perivel","description":"Plug-and-Play SSR for SolidJS","archived":false,"fork":false,"pushed_at":"2023-02-24T07:52:24.000Z","size":1793,"stargazers_count":19,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-29T18:05:55.473Z","etag":null,"topics":["solidjs"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/Perivel.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}},"created_at":"2022-01-18T00:06:59.000Z","updated_at":"2023-02-07T19:07:36.000Z","dependencies_parsed_at":"2024-01-14T02:17:53.251Z","dependency_job_id":null,"html_url":"https://github.com/Perivel/solid-pod","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Perivel%2Fsolid-pod","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Perivel%2Fsolid-pod/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Perivel%2Fsolid-pod/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Perivel%2Fsolid-pod/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Perivel","download_url":"https://codeload.github.com/Perivel/solid-pod/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246563376,"owners_count":20797448,"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":["solidjs"],"created_at":"2024-08-01T07:01:18.348Z","updated_at":"2025-04-01T21:32:09.856Z","avatar_url":"https://github.com/Perivel.png","language":"TypeScript","funding_links":[],"categories":["📦 Components \u0026 Libraries"],"sub_categories":["SSR"],"readme":"# Solid Pod\nSolid Pod is a plug-and-play Server-Side Rendering solution for SolidJS.\n\n## Installation\nTODO\n\n## Usage\nAt its most basic form, all you have to do to run Solid Pod is change one line in your `src/index.tsx` file.\n\n```ts\nimport { runApp, Middleware } from 'solid-pod';\nimport App from './App';\n\nrunApp(App);\n```\nNotice that the only change we made to our `index.ts` file is we change SolidJS' `render()` call to Solid Pod's `runApp()` call.\n\nAt its most simplest form, this is all we need to do. We can now run the application by running `pod start` at the root of our project directory. This will run our application in SSR mode.\n\n## Helper Primitives\nSolid Pod comes with some pre-built primitives to give you access to different pieces of information.\n\n### useServerRequestContext()\nThe `useServerRequestContext()` primitive will give you access to the server request information. Below is an example of how we may use this primitive to pass routing information from the server to our app.\n```ts\n// App,tsx\nimport { Component } from 'solid-js';\nimport { useServerRequestContext } from 'solid-pod';\nimport { Router, useRoutes } from 'solid-app-router';\nimport { routes } from './routes';\n\nconst App: Component = () =\u003e {\n    const req = useServerRequestContext();\n    const Routes = useRoutes(routes);\n\n    return (\n        \u003cRouter url={req()?.url}\u003e\n            \u003cRoutes /\u003e\n        \u003c/Router\u003e\n    );\n}\n\nexport default App;\n```\n\n### useEnvironment()\nThe `useEnvironment()` primitive tells us whether our application is in a production or development environment. We can use this to enable or disable features and components that are only meant for use in development. \n\nSuppose we have an `\u003cInspect\u003e` componet which lets us inspect our app's HTML during development. We propbably do not want this to be available during production. Below is an example of how we might restrict this using the `useEnvironment()` primitive.\n```ts\n// MyComponent.tsx\nimport { Component } from 'solid-js';\nimport { useEnvironment } from 'solid-pod';\nimport Inspect from './Inspect';\n\nconst MyComponent: Component = () =\u003e {\n    const env = useEnvironment();\n\n    return (\n        \u003cInspect disable={() =\u003e env() == 'production'}\u003e\n            ....\n        \u003c/Inspect\u003e\n    );\n}\n\nexport default MyComponent;\n```\n\n### useIsServer() and useIsClient()\nThe `useIsServer()` and `useIsClient()` primitives are used to determine if we are currently running on the client or on the server.\n\n# License\nSolid Pod is provided under the [MIT](LICENSE) License.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPerivel%2Fsolid-pod","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPerivel%2Fsolid-pod","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPerivel%2Fsolid-pod/lists"}