{"id":23377987,"url":"https://github.com/beyondjs/ssr","last_synced_at":"2026-01-25T17:02:15.258Z","repository":{"id":156892171,"uuid":"538584866","full_name":"beyondjs/ssr","owner":"beyondjs","description":"Essential tools and configurations to seamlessly integrate SSR","archived":false,"fork":false,"pushed_at":"2024-08-15T17:41:59.000Z","size":18,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-10T20:16:56.422Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/beyondjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-09-19T16:05:31.000Z","updated_at":"2024-08-15T17:42:02.000Z","dependencies_parsed_at":"2024-08-15T19:36:02.456Z","dependency_job_id":"65113c5b-2d76-4eec-86f6-9f9efe513a70","html_url":"https://github.com/beyondjs/ssr","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/beyondjs/ssr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyondjs%2Fssr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyondjs%2Fssr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyondjs%2Fssr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyondjs%2Fssr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beyondjs","download_url":"https://codeload.github.com/beyondjs/ssr/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beyondjs%2Fssr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28755561,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T16:32:25.380Z","status":"ssl_error","status_checked_at":"2026-01-25T16:32:09.189Z","response_time":113,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-12-21T18:33:44.333Z","updated_at":"2026-01-25T17:02:15.242Z","avatar_url":"https://github.com/beyondjs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Welcome to @beyond-js/ssr\n\nBeyondJS implements Server-Side Rendering (SSR) via an HTTP server with three endpoints: widget and page. It allows the\nimplementation of SSR solutions in web projects by generating the HTML of a component or widget on the server side\nbefore sending it to the client. This enables quick loading of the component's data structure without the need for\nadditional packages, dependencies, or client-side frameworks to load it.\n\n## Key Features\n\n`Server-Side Rendering (SSR)`: Pre-render content on the server to deliver a fully rendered page to the client,\nimproving initial load times and SEO.\n\n`Client-Side Rendering (CSR)`: Render content entirely on the client-side, ideal for dynamic and interactive\napplications.\n\n`Static Rendering (SR)`: Pre-render specific routes as static content, balancing between SSR and CSR for optimized\nperformance.\n\n## Installation\n\nInstall `@beyond-js/ssr` it as a dependency in your project:\n\n```code\nnpm install @beyond-js/ssr\n```\n\n## Usage\n\nTo enable SSR in a module or widget, add an ssr property in the bundle configuration (widget) of the module's\nmodule.json file. This property must be a boolean indicating whether server-side rendering is active.\n\nAdditionally, define a createStore property in the view's Controller, which is a getter returning an object of type\nIWidgetStore. This object must contain three main methods:\n\n`toJSON`: Returns the data that the widget will consume from the server, serializing the HTML response so it can be sent\nto the client and displayed on the screen.\n\n`hydrate`: Hydrates or updates the HTML on the client, ensuring the state rendered on the server matches the client\nstate. This process synchronizes the client state with the server state.\n\n`fetch`: Used in both SSR and CSR strategies, responsible for processing the Store data and making it available. This\nmethod executes on both the client and server, depending on the strategy used.\n\n### Example Configuration\n\nHere’s an example of how to configure the widget bundle in the module.json file:\n\n`SSR`:\n\n```json\n{\n\t\"widget\": {\n\t\t\"name\": \"my-widget\",\n\t\t\"type\": \"page\",\n\t\t\"route\": \"/my-route\",\n\t\t\"render\": {\n\t\t\t\"ssr\": true,\n\t\t\t\"sr\": false,\n\t\t\t\"csr\": false\n\t\t}\n\t}\n}\n```\n\n`CSR`:\n\n```json\n{\n\t\"widget\": {\n\t\t\"name\": \"my-widget\",\n\t\t\"type\": \"page\",\n\t\t\"route\": \"/my-route\",\n\t\t\"render\": {\n\t\t\t\"ssr\": false,\n\t\t\t\"sr\": false,\n\t\t\t\"csr\": true\n\t\t}\n\t}\n}\n```\n\n`SR`:\n\n```json\n{\n\t\"widget\": {\n\t\t\"name\": \"my-widget\",\n\t\t\"type\": \"page\",\n\t\t\"route\": \"/my-page/${entry}\",\n\t\t\"element\": {\n\t\t\t\"name\": \"sr-page\"\n\t\t},\n\t\t\"render\": {\n\t\t\t\"csr\": false,\n\t\t\t\"sr\": [\"/my-page/example\", \"/my-page/other-example\"]\n\t\t}\n\t}\n}\n```\n\nThis setup provides developers with the flexibility to choose the appropriate rendering strategy based on the specific\nneeds of their application, ensuring optimal performance and user experience across different scenarios.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeyondjs%2Fssr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeyondjs%2Fssr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeyondjs%2Fssr/lists"}