{"id":20206541,"url":"https://github.com/useflyyer/flyyer-variables","last_synced_at":"2026-05-02T08:32:34.177Z","repository":{"id":42655638,"uuid":"361593328","full_name":"useflyyer/flyyer-variables","owner":"useflyyer","description":"Helper module to create a `schema` that enables Flyyer.io to display template's variables on https://flyyer.io/dashboard for decks and templates.","archived":false,"fork":false,"pushed_at":"2023-01-08T00:05:19.000Z","size":2859,"stargazers_count":1,"open_issues_count":9,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-04-08T13:04:20.285Z","etag":null,"topics":["ajv","flyyer","json-schema","react","seo","static-types","typescript"],"latest_commit_sha":null,"homepage":"https://flyyer.io","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/useflyyer.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}},"created_at":"2021-04-26T02:28:01.000Z","updated_at":"2022-01-15T14:45:42.000Z","dependencies_parsed_at":"2023-02-08T03:30:47.194Z","dependency_job_id":null,"html_url":"https://github.com/useflyyer/flyyer-variables","commit_stats":null,"previous_names":["flayyer/flayyer-variables"],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/useflyyer/flyyer-variables","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/useflyyer%2Fflyyer-variables","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/useflyyer%2Fflyyer-variables/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/useflyyer%2Fflyyer-variables/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/useflyyer%2Fflyyer-variables/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/useflyyer","download_url":"https://codeload.github.com/useflyyer/flyyer-variables/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/useflyyer%2Fflyyer-variables/sbom","scorecard":{"id":402924,"data":{"date":"2025-08-11","repo":{"name":"github.com/useflyyer/flyyer-variables","commit":"2cf3588720a3644c5af7c1f8ec5cad2408b228ee"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.5,"checks":[{"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":"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":"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":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"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":"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/node.js.yml:1","Info: no jobLevel write permissions found"],"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:20: update your workflow using https://app.stepsecurity.io/secureworkflow/useflyyer/flyyer-variables/node.js.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/useflyyer/flyyer-variables/node.js.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned"],"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":"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":"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":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"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"}},{"name":"Vulnerabilities","score":0,"reason":"37 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-434g-2637-qmqr","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq","Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488","Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-qrpm-p2h7-hrv2","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-rp65-9cf3-cjxr","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-4rq4-32rv-6wp6","Warn: Project is vulnerable to: GHSA-64g7-mvw6-v9qj","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T20:30:08.044Z","repository_id":42655638,"created_at":"2025-08-18T20:30:08.044Z","updated_at":"2025-08-18T20:30:08.044Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31893973,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T11:36:10.202Z","status":"ssl_error","status_checked_at":"2026-04-16T11:36:09.652Z","response_time":69,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["ajv","flyyer","json-schema","react","seo","static-types","typescript"],"created_at":"2024-11-14T05:24:41.665Z","updated_at":"2026-05-02T08:32:34.128Z","avatar_url":"https://github.com/useflyyer.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @flyyer/variables\n\nHelper module to create a `schema` that enables Flyyer to display template's variables on https://flyyer.io for decks and templates.\n\n```sh\nnpm install --save @flyyer/variables\n\n# if you prefer yarn:\nyarn add @flyyer/variables\n```\n\nSome of our official free templates are using `@flyyer/variables`:\n\n* 🌠 flyyer.io/@/flyyer/simple-products\n  * Source-code: github.com/useflyyer/flyyer-marketplace-simpleproducts\n* 🌠 flyyer.io/@/flyyer/nice-typography\n  * Source-code: github.com/useflyyer/flyyer-marketplace-nicetypography\n* 🌠 flyyer.io/@/flyyer/branded\n  * Source-code: github.com/useflyyer/flyyer-marketplace-brand\n\nHere is what a template with an exported `schema` looks like:\n\n![Final result on flyyer.io dashboard](.github/assets/dashboard.png)\n\n\u003e Note: Not every JSON-Schema is supported on Flyyer UI, try to use a plain object and avoid complex types such as Union, Object, Array, etc.\n\n## Usage\n\n```tsx\nimport { Variable as V, Static, Validator } from \"@flyyer/variables\";\n\n/**\n * Export `const schema = V.Object({})` to make variables visible on https://flyyer.io/\n */\nexport const schema = V.Object({\n  title: V.String({ description: \"Displayed on https://flyyer.io\" }),\n  price: V.Nullable(V.Number()),\n  image: V.Optional(V.Image({\n    description: \"Image URL\",\n    examples: [\"https://flyyer.io/logo.png\"],\n  })),\n  font: V.Optional(V.Font({\n    default: \"Inter\", // https://github.com/useflyyer/use-googlefonts\n  })),\n});\nconst validator = new Validator(schema);\n\n// Remove line and TemplateProps\u003cVariables\u003e if using plain Javascript\ntype Variables = Static\u003ctypeof schema\u003e;\n\nexport default function Template({ variables }: TemplateProps\u003cVariables\u003e) {\n  if (validator.validate(variables)) {\n    const title = variables[\"title\"]; // type is `string`\n    const price = variables[\"price\"]; // type is `number | null`\n    const image = variables[\"image\"]; // type is `string | undefined` and has URL format.\n    const font = variables[\"font\"]; // type is `string | undefined`, use with @flyyer/use-googlefonts\n    // ...\n  }\n}\n```\n\n## Optimistic usage\n\nUsing the same schema from the previous example, if you prefer a more optimistic validation you can use:\n\n```ts\nconst {\n  data: { title, price, image }\n} = validator.parse(variables);\n\n// Optimistic path but variables might not be compliant with the schema.\n```\n\nInstead of (strict validation):\n\n```ts\nif (validator.validate(variables)) {\n  // Happy path with compliant variables\n} else {\n  // Show empty or error to the user.\n}\n```\n\n## Useful types\n\nMost common types with full flyyer.io UI support are:\n\n* `V.String()`\n* `V.Integer()`\n* `V.Number()` for floats\n* `V.Boolean()`\n* `V.DateTime()`, `V.Date()`, and `V.Time()` (`V.DateTime()` has the best compatibility)\n* `V.URL()`\n* `V.Image()`\n* `V.Font()`\n* `V.ColorHex()`\n* `V.Enum()`\n* `V.EnumKeys()`\n\nModifiers:\n\n* `V.Optional()`\n* `V.Null()`\n* `V.Optional(V.Null())`\n\nYou should be able to cover most cases with these types.\n\n## Provide default value\n\nDefault values are used when incoming variable is undefined.\n\n```tsx\nexport const schema = V.Object({\n  title: V.String({ default: \"Hello world\" }),\n});\n```\n\n## Provide example values\n\nOn flyyer.io many template previews are rendered using the first provided `examples` value of each property with fallback to `default`.\n\n**🚨 The `examples` property must be an array**\n\n```tsx\nexport const schema = V.Object({\n  image: V.Image({ examples: [\"https://flyyer.io/logo.png\"] }),\n});\n```\n\n## E-commerce\n\nFor E-commerce templates you probably want to display the price and currency of a product. **Currently we haven't defined a proper `V.Price` and `V.Currency` methods yet. We recommended sticking with `price: V.Number` and `currency: V.String` until we have enough information to create those methods.**\n\n\u003e Production example: https://github.com/useflyyer/flyyer-marketplace-simpleproducts\n\nExample:\n\n```tsx\nimport { Variable as V, Validator } from '@flyyer/variables';\n\nexport const schema = V.Object({\n  currency: V.Optional(\n    V.String({ default: 'USD', examples: ['USD', 'EUR'] }),\n  ),\n  price: V.Optional(\n    V.Number({ examples: ['59.99'] }),\n  ),\n});\nconst validator = new Validator(schema);\n\n// props are provided by our systems\nexport default function Template({ variables, locale }) {\n  const {\n    data: {\n      currency, // type is `string | undefined`\n      price, // type is `number | undefined`\n    }\n  } = validator.parse(variables);\n\n  const formatter = new Intl.NumberFormat(locale, {\n    style: 'currency',\n    currency: currency,\n    currencyDisplay: 'symbol'\n  });\n\n  if (Number.isFinite(price) \u0026\u0026 price === 0) {\n    return \u003cp\u003eFree\u003c/p\u003e;\n  } else (Number.isFinite(price)) {\n    return \u003cp\u003e{formatter.format(price)}\u003c/p\u003e\n  } else {\n    return null; // Do not display price if user sets input to null or blank,\n  }\n}\n```\n\n## Enums\n\nTypeScript has the `enum` type. This library can create a schema for these enums based on their _keys_ or their _values_.\n\n* Create enum schema with keys: `V.EnumKeys`\n* Create enum schema with values: `V.Enum`\n\n```ts\nenum Alignment {\n  Y = \"flex flex-col justify-center\",\n  X = \"flex flex-row justify-center\",\n}\nconst schema = V.Object({\n  keys: V.EnumKeys(Alignment, { default: \"X\" }),\n  values: V.Enum(Alignment, { default: Alignment.X }),\n});\n```\n\nWhat is the difference? If you want to display the enum's key on the UI at flyyer.io you should use `V.EnumKeys` which is more clear to the user.\n\n```ts\n// Let the user pick between \"X\" or \"Y\" on flyyer.io UI.\nconst schema = V.Object({\n  alignment: V.EnumKeys(Alignment, { default: \"X\" }),\n});\n```\n\n## Recommendations\n\nJSON Schemas can be super complex and allow a lot of custom settings. At Flyyer.io we recommend sticking to a simple 1-level object for the better final user experience.\n\n```ts\n// ⚠️ Works via @flyyer/flyyer and API but not handled by Flyyer.io UI (dashboard)\nexport const schema = V.Object({\n  title: V.Object({\n    text: V.String(),\n    color: V.ColorHex({ default: \"#FFFFFF\" }),\n    font: V.Font({ default: \"Inter\" }),\n  })\n});\n/* https://cdn.flyyer.io/render/v2/tenant/deck/template?title[text]=Hello\u0026title[font]=Roboto */\n/* https://cdn.flyyer.io/v2/project/_/title[text]=Hello\u0026title[font]=Roboto/path */\n\n// ✅ Recommended! works via @flyyer/flyyer, API, and Flyyer.io UI (dashboard)\nexport const schema = V.Object({\n  title: V.String(),\n  titleColor: V.ColorHex({ default: \"#FFFFFF\" }),\n  titleFont: V.Font({ default: \"Inter\" }),\n});\n/* https://cdn.flyyer.io/render/v2/tenant/deck/template?title=Hello\u0026titleFont=Roboto */\n/* https://cdn.flyyer.io/v2/project/_/title=Hello\u0026titleFont=Roboto/path */\n// It also produces shorter URLs to generate images which is good.\n```\n\n---\n\nCredits to https://github.com/sinclairzx81/typebox to enable creating a JSON Schema with an amazing developer experience.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuseflyyer%2Fflyyer-variables","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuseflyyer%2Fflyyer-variables","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuseflyyer%2Fflyyer-variables/lists"}