{"id":23891453,"url":"https://github.com/fana-io/fana-node-sdk","last_synced_at":"2026-04-20T14:02:42.016Z","repository":{"id":57714743,"uuid":"512347467","full_name":"fana-io/fana-node-sdk","owner":"fana-io","description":"Software development kit for NodeJS apps using the Fana feature flagging platform","archived":false,"fork":false,"pushed_at":"2022-08-18T22:13:21.000Z","size":483,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-09T06:06:49.339Z","etag":null,"topics":["featureflags","javascript","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/fana-io.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}},"created_at":"2022-07-10T04:51:38.000Z","updated_at":"2022-08-16T19:32:46.000Z","dependencies_parsed_at":"2022-08-30T11:32:20.542Z","dependency_job_id":null,"html_url":"https://github.com/fana-io/fana-node-sdk","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fana-io/fana-node-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fana-io%2Ffana-node-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fana-io%2Ffana-node-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fana-io%2Ffana-node-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fana-io%2Ffana-node-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fana-io","download_url":"https://codeload.github.com/fana-io/fana-node-sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fana-io%2Ffana-node-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32050451,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T11:35:06.609Z","status":"ssl_error","status_checked_at":"2026-04-20T11:34:48.899Z","response_time":94,"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":["featureflags","javascript","nodejs"],"created_at":"2025-01-04T12:06:17.878Z","updated_at":"2026-04-20T14:02:41.971Z","avatar_url":"https://github.com/fana-io.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Using the Node SDK\n\n1. Install the Fana Node SDK in your project by running `npm i fana-node-sdk`\n2. Import the `FanaConfig` file into whichever files you will be evaluating flags in\n\n`const { FanaConfig } = require('fana-node-sdk');`\n\n3. Use the `FanaConfig` class constructor to instantiate a `config` object. This constructor takes three arguments:\n\n- (string) **SDK key** (from your dashboard's settings page)\n- (string) The **address** of your Flag Bearer\n- (number, optional) Desired **Reinitialization Interval**\n  - You can leave this blank if you do not wish for the SDK to reinitialize. You can find more information about this in the [Node SDK Reference](node-sdk-reference.md)\n\n```javascript\n// the sdk key is hard-coded here, but you should have it as an environment variable for security purposes\nconst config = new FanaConfig('sdk_key_0', 'http://localhost:3001', 3600000)\n                                   ^SDK Key  ^Flag Bearer Address   ^Reinitialization Interval\n```\n\n4. Next, instantiate a `FanaClient` instance by calling `config.connect()`. Note that this is an asynchronous action, so you will need to use `async/await` or promises to perform this step:\n\n```javascript\n// with async/await\nlet client;\n\nconst initializeFanaSDK = async () =\u003e {\n  client = await config.connect();\n};\n\ninitializeFanaSDK();\n\n// with promises\nlet client;\n\nconfig.connect().then((c) =\u003e {\n  client = c;\n});\n```\n\nNow you can use the `FanaClient.prototype.evaluateFlag()` method. It takes three arguments:\n\n- (string) The flag key that you wish to evaluate\n- (object) The user context object\n- (boolean) An optional argument for a default value\n\n```javascript\napp.get(\"/\", (req, res) =\u003e {\n  // note that the context object is hard-coded here.\n  // you will most likely be generating this dynamically\n  const userContext = { userId: \"jjuy\", beta: true };\n\n  if (client.evaluateFlag(\"beta_processor\", userContext, true)) {\n    // execute beta processing\n  } else {\n    // execute regular processing\n  }\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffana-io%2Ffana-node-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffana-io%2Ffana-node-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffana-io%2Ffana-node-sdk/lists"}