{"id":24059882,"url":"https://github.com/danielres/yarn-workspaces-unified-env-example","last_synced_at":"2026-05-07T01:05:20.691Z","repository":{"id":37907382,"uuid":"217286427","full_name":"danielres/yarn-workspaces-unified-env-example","owner":"danielres","description":"Example boilerplate of unified env vars management using yarn workspaces, works on Heroku","archived":false,"fork":false,"pushed_at":"2023-01-11T02:41:24.000Z","size":806,"stargazers_count":1,"open_issues_count":20,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-09T06:39:49.446Z","etag":null,"topics":["envalid","environment-variables","example-app","graphql","graphql-yoga","heroku","monorepo","parceljs","react","tutorial","yarn-workspaces"],"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/danielres.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":"2019-10-24T11:49:36.000Z","updated_at":"2020-06-12T14:32:09.000Z","dependencies_parsed_at":"2023-02-08T23:31:16.845Z","dependency_job_id":null,"html_url":"https://github.com/danielres/yarn-workspaces-unified-env-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielres%2Fyarn-workspaces-unified-env-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielres%2Fyarn-workspaces-unified-env-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielres%2Fyarn-workspaces-unified-env-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielres%2Fyarn-workspaces-unified-env-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielres","download_url":"https://codeload.github.com/danielres/yarn-workspaces-unified-env-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240865328,"owners_count":19870107,"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","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":["envalid","environment-variables","example-app","graphql","graphql-yoga","heroku","monorepo","parceljs","react","tutorial","yarn-workspaces"],"created_at":"2025-01-09T06:37:04.228Z","updated_at":"2026-05-07T01:05:20.658Z","avatar_url":"https://github.com/danielres.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"This simple example app demonstrates a number of techniques that I've been researching in order to improve developers experience:\n\n## [Yarn workspaces](https://yarnpkg.com/lang/en/docs/workspaces/) are used to:\n\n1. break down the monorepo into smaller, easy to compose modules\n1. simplify build steps and hosting\n\n## In particular, the [env](https://github.com/danielres/yarn-workspaces-unified-env-example/tree/master/env) workspace\n\n1. handles all env vars for both API and UI\n1. centralize and greatly simplify env vars management\n1. automatically validates all env vars, using the amazing [envalid](https://github.com/af/envalid)\n\nTo validate all env vars, for example during prebuild, and ensure the build is cancelled if any is missing:\n\n- `node -r esm env`\n\n## Using the [esm](https://github.com/standard-things/esm) loader\n\n1. Enables ES6 features in node, like `import` statements instead of `requires` \\o/ \\o/ \\o/\n1. Provides a more smooth \u0026 consistent coding experience\n1. Makes it possible to have a unified env vars management, shared seamlessly by both UI and API. \\\n   For example, these commands allow validate the env vars, then pass them to the scripts:\n   - `node -r esm -r env api/server.js`\n   - `node -r esm -r env ui/build.js`\n\n## What is this boilerplate good for?\n\n- Projects in early stages\n- Company internal tools: intranets, ...\n- Basically, small projects where having a more unified frontend + backend served together (on 1 dyno in the Heroku case) is all you need.\n\n## Usage\n\nRuning locally (in development):\n\n`yarn dev` starts both UI and API server in parallel, in dev mode\n\nHosting on Heroku:\n\nShoud work out of the box, just normally deploy to Heroku.\nAfter build, the backend will both serve the UI and API (under `/graphql`)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielres%2Fyarn-workspaces-unified-env-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielres%2Fyarn-workspaces-unified-env-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielres%2Fyarn-workspaces-unified-env-example/lists"}