{"id":34995236,"url":"https://github.com/harmon25/node_ssr","last_synced_at":"2026-05-19T21:05:59.132Z","repository":{"id":78978201,"uuid":"327501205","full_name":"harmon25/node_ssr","owner":"harmon25","description":" NodeJS Server side rendering service manager for Elixir.","archived":false,"fork":false,"pushed_at":"2021-01-11T22:31:21.000Z","size":31,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-28T15:01:30.524Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","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/harmon25.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-01-07T04:19:17.000Z","updated_at":"2022-12-21T20:00:12.000Z","dependencies_parsed_at":"2023-04-20T15:33:08.232Z","dependency_job_id":null,"html_url":"https://github.com/harmon25/node_ssr","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/harmon25/node_ssr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harmon25%2Fnode_ssr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harmon25%2Fnode_ssr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harmon25%2Fnode_ssr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harmon25%2Fnode_ssr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harmon25","download_url":"https://codeload.github.com/harmon25/node_ssr/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harmon25%2Fnode_ssr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33233144,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-19T15:49:41.270Z","status":"ssl_error","status_checked_at":"2026-05-19T15:49:22.917Z","response_time":58,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":"2025-12-27T02:02:54.902Z","updated_at":"2026-05-19T21:05:59.127Z","avatar_url":"https://github.com/harmon25.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NodeSsr\n\nElixir Application for managing nodejs http server cluster, and communicating to it from elixir.\nSince this is an application - it can be used easily at compile time by simply calling `Application.ensure_all_started(:node_ssr)` before any calls to `NodeSsr.render/2`.\n\nNodeSsr was designed to be used at compile time - but could be used to provide SSR at runtime for a Phoenix application.\n\nIPC between Nodejs and Elixir is done through a simple nodejs http api running in a [nodejs cluster](https://nodejs.org/api/cluster.html#cluster_cluster).\n\n## Usage Instructions\n\n1. Install node dependencies alongside your assets\n2. Create an SSR script(see example) in your assets directory\n3. Setup necessary config.exs values \n4. Run `NodeSsr.render/2` \n\n## Node dependencies\n\nRequires babel (default phoenix setup is fine), and @babel/register as `devDependencies` (if used at runtime might need to be actual `dependencies`)\n```sh\nnpm i @babel/core @babel/register --save-dev\n```\n\nIn package.json add the following dependency:\n\n```\n\"elixir-node-ssr\": \"file:../deps/node_ssr\"\n```\n\n\n## Configuration \n```elixir\nconfig :node_ssr,\n   assets_path: \"#{File.cwd!()}/assets\", # REQUIRED - This be the folder with assets, and a package.json file - passed to erlexec `:cd` option\n   script_name: \"test.js\" # this is the name of the script to be invoked - defaults to \"ssr.js\", can change it here.\n```\n\nOptional requirements:\n``` elixir\n  component_path: \"js/components\" # this is the default, relative path to your components directory from assets/.\n  component_ext: \".js\" # this is the default, used with nodejs require statements\n  count: 1 # this is the number of workers in the nodejs cluster - likely not necessary to have more than 1, unless rendering lots of components\n```\n\n## Example SSR script\nThis script is launched by `erlexec`, and should be able to resolve and render your components \n\n```javascript\n#!/bin/env node\n\nrequire(\"@babel/register\")({ cwd: __dirname });\n// starts local http service to perform Node SSR\nconst startService = require(\"elixir-node-ssr\");\n// a render function that takes a component name + props and returns a json response\n// this should include rendered html as markup, and whatever else you like that can be serialized to JSON\nconst render = (componentName, props = {}) =\u003e {\n  return {markup: \"\u003ch1\u003eHi From NodeJS\u003c/h1\u003e\", extra: {}, error: null}\n}\nconst opts = {\n  debug: false,\n};\n\n// service is forked by nodejs and runs one master, and N workers based on the `:count` optional application env option.\n// if nil count is supplied runs as many workers as CPU cores.\nstartService(render, opts);\n```\n\n## Installation\n\nIf [available in Hex](https://hex.pm/docs/publish), the package can be installed\nby adding `node_ssr` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:node_ssr, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\nVia github\n\n```elixir\ndef deps do\n  [\n    {:node_ssr, github: \"harmon25/node_ssr\", branch: \"main\"}\n  ]\nend\n```\n\nDocumentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)\nand published on [HexDocs](https://hexdocs.pm). Once published, the docs can\nbe found at [https://hexdocs.pm/node_ssr](https://hexdocs.pm/node_ssr).\n\n## Used by:\n\n- [ReactSurface](https://github.com/harmon25/react_surface) to provide the SSR macro.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharmon25%2Fnode_ssr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharmon25%2Fnode_ssr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharmon25%2Fnode_ssr/lists"}