{"id":18062808,"url":"https://github.com/ded/express-it","last_synced_at":"2025-09-12T04:46:09.616Z","repository":{"id":66101815,"uuid":"37795309","full_name":"ded/express-it","owner":"ded","description":"Serve custom translation variants for your Express app","archived":false,"fork":false,"pushed_at":"2024-08-20T05:30:28.000Z","size":54,"stargazers_count":8,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-09T05:54:52.108Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ded.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}},"created_at":"2015-06-21T03:38:25.000Z","updated_at":"2024-10-02T17:43:29.000Z","dependencies_parsed_at":"2025-04-11T15:04:53.221Z","dependency_job_id":"33117ed8-0d0d-4298-bc78-d5f44ec1a25a","html_url":"https://github.com/ded/express-it","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/ded/express-it","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ded%2Fexpress-it","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ded%2Fexpress-it/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ded%2Fexpress-it/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ded%2Fexpress-it/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ded","download_url":"https://codeload.github.com/ded/express-it/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ded%2Fexpress-it/sbom","scorecard":{"id":331622,"data":{"date":"2025-08-11","repo":{"name":"github.com/ded/express-it","commit":"773fdbf46dc3b1db64e36754680b84f83a9d1aa1"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Warn: project license file does not contain an FSF or OSI license."],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-18T03:47:04.568Z","repository_id":66101815,"created_at":"2025-08-18T03:47:04.568Z","updated_at":"2025-08-18T03:47:04.568Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274756341,"owners_count":25343500,"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","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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-10-31T05:08:29.853Z","updated_at":"2025-09-12T04:46:09.571Z","avatar_url":"https://github.com/ded.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Express it\nServe custom translation variants for your `Express 4.x` app.\n\n``` sh\n$ npm install express-it --save\n```\n\nPeer dependencies required\n - `express`: For translation center \u0026 middleware integration.\n - `redis`: For storing persistent translations in memory.\n\n### Purpose\nIf you’ve ever wanted to serve different message copy to a user based on varying cirumstances, this is the right tool.\n\nThis tool *can also be used* as a light-weight solution to `i18n` (internationalization), however be mindful that the scope of this project is **not** aimed at creating custom routing, dealing with pluralisation, or custom number formatting. It can, however, live along side your existing `i18n` framework (if this is your desire).\n\n### How it works\nThe idea is to put the user into a custom translation variant based on any arbitrary data you see fitting. For example, several websites will use different messaging based on the users demographic, or if they were invited through a specific campaign or community.\n\nThus, instead of having to do this everywhere throughout your code...\n\n``` js\nif (user.age \u003e 18 \u0026\u0026 user.age \u003c 24 \u0026\u0026 user.gender == 'female') {\n  render('\u003cp\u003eLike, hello {name}. Your totes welcome to the fridge\u003c/p\u003e')\n}\nelse if (user.age \u003e= 21 \u0026\u0026 user.gender == 'male') {\n  render('\u003cp\u003eYo {name}. The beer is in the fridge.\u003c/p\u003e')\n} else {\n  render('\u003cp\u003eWelcome {name}. Here is the fridge.\u003c/p\u003e')\n}\n```\n\nYou could do something like this (we’ll show you how to setup a user in a variant later):\n\n``` jade\n.welcome\n  p!= t('welcome.fridge.msg', { name: user.first_name }).backup('Welcome {name}. Here is the fridge.')\n```\n\n### A fully managed translation center\nThis tool comes with an administration interface (integration required) allowing you to update message copy in real-time.\n\n![http://f.cl.ly/items/1u263H1O3X0z3H2r2y3T/Screen%20Shot%202015-06-23%20at%205.42.42%20PM.png](http://f.cl.ly/items/1u263H1O3X0z3H2r2y3T/Screen%20Shot%202015-06-23%20at%205.42.42%20PM.png)\n\n\n### Integration\n\n ``` javascript\nvar client = require('redis').createClient()\nvar VARIANTS = ['en.default', 'en.tech', 'en.millenials', 'en.fb_mom_campaign', 'en.pinterest_users']\nYOUR_APP.use('/path/to/translation-center', require('express-it').init({\n  express: YOUR_EXPRESS,\n  redis: client,\n  variants: VARIANTS\n}))\n\n\nYOUR_APP.use(function (req, res, next) {\n  // this introspection can be async\n  req.variant = 'en.default' // or some other variant based on user data\n  next()\n})\n\nYOUR_APP.use(require('express-it').middleware({\n  redis: client,\n  variants: VARIANTS\n}))\n```\n\n### Usage\nBoth client and server templates can take advantage of the `t()` function. The usage of the `backup()` method is *required* in all circumstances in cases where redis fails, or if a key is not found.\n\n``` jade\n.welcome\n  p= t('welcome.msg', { name: user.first_name }).backup('Hello {name}. Welcome to our website')\n```\n\n Usage from pure client-side\n\n``` jade\n// use the \"E\" view local to load your translations and \"t()\" function\nhtml\n  head\n    title example\n    != E.getLoader()\n    // etc...\n```\n\n``` html\n// call `t` from anywhere...\n\u003cscript\u003e\n  window.t('welcome.msg', { name: user.username }).backup('Welcome to Example.com')\n\u003c/script\u003e\n```\n\n### Cascading variations\nOne great feature *ExpressIt* provides is the ability to cascade a user with multiple variations. For example one user might be part of both a Pinterest Campaign variant, and millenial (age group) variant. You can set your `req.variant` as such in your integrated middleware.\n\n``` js\nYOUR_APP.use(function (req, res, next) {\n  req.variant = ['en.pinterest_campaign', 'en.millenial', 'en.default']\n  next()\n})\n```\n\nIn the example above, you may have a translation key for `welcome.msg` in the `en.pinterest_campaign` variant.\n\nHowever in the absense of a translation for the `tutorial.step.1` translation key for `en.pinterest_campaign`, it will *cascade* to the next variant — which in this case is `en.millenial`.\n\nThe advantage of this is that not every variant requires a translation for each key, allowing you to fallback onto other (perhaps more appropriate) messaging.\n\n### Tests\nsee `tests/index.js`\n\n``` sh\n$ npm test\n```\n\n### Contributions\nYes please, and always welcome! Please consider the primary goals too. This is not intended to be a full `i18n` replacement. However performance improvements, bug fixes, and minor feature additions are fully welcomed!\n\n#### Licence MIT\n\n`express-it` is © 2015 Dustin Diaz and licensed under MIT. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fded%2Fexpress-it","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fded%2Fexpress-it","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fded%2Fexpress-it/lists"}