{"id":28934012,"url":"https://github.com/verygoodsecurity/netlify-plugin-vgs","last_synced_at":"2025-07-31T23:33:43.763Z","repository":{"id":43344265,"uuid":"451608440","full_name":"verygoodsecurity/netlify-plugin-vgs","owner":"verygoodsecurity","description":null,"archived":false,"fork":false,"pushed_at":"2024-01-09T15:52:59.000Z","size":54,"stargazers_count":6,"open_issues_count":7,"forks_count":2,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-05-21T07:43:50.100Z","etag":null,"topics":["team-developer-experience"],"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/verygoodsecurity.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-01-24T19:43:11.000Z","updated_at":"2025-01-28T21:26:30.000Z","dependencies_parsed_at":"2022-07-20T15:02:27.917Z","dependency_job_id":null,"html_url":"https://github.com/verygoodsecurity/netlify-plugin-vgs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/verygoodsecurity/netlify-plugin-vgs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/verygoodsecurity%2Fnetlify-plugin-vgs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/verygoodsecurity%2Fnetlify-plugin-vgs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/verygoodsecurity%2Fnetlify-plugin-vgs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/verygoodsecurity%2Fnetlify-plugin-vgs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/verygoodsecurity","download_url":"https://codeload.github.com/verygoodsecurity/netlify-plugin-vgs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/verygoodsecurity%2Fnetlify-plugin-vgs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261344850,"owners_count":23144939,"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":["team-developer-experience"],"created_at":"2025-06-22T18:39:28.327Z","updated_at":"2025-07-31T23:33:43.751Z","avatar_url":"https://github.com/verygoodsecurity.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# VGS Plugin for Netlify\n\nThis plugin streamlines your integration with VGS and Netlify by auto-configuring your VGS vault with the settings required to work with both systems.\n\n[Example project](https://github.com/verygoodsecurity/netlify-plugin-example)\n\n## Prerequisites\n1. [VGS Dashboard account](https://dashboard.verygoodsecurity.com)\n2. [VGS CLI service account](https://www.verygoodsecurity.com/docs/development/vgs-git-flow/#1-provision-a-service-account)\n3. [Netlify Account](https://www.netlify.com/)\n4. [Netlify CLI](https://docs.netlify.com/cli/get-started/)\n\n## Overview\nIn this guide, we cover:\n- How to install and use vgs-netlify-plugin\n- How to set up a local development environment and work with netlify/VGS collect\n\n## Implementation Instructions\n\n### Configure Netlify\n\nFirst, create a folder and initialize netlify site by running:\n```bash\nnetlify init\n```\n\nThen, get `clientId` and `clientSecret` credentials by following [this guide](https://www.verygoodsecurity.com/docs/development/vgs-git-flow/#1-provision-a-service-account).\nNow, get the ID of your vault or `vaultId`, you can find it in the [VGS Vault Dashboard](https://dashboard.verygoodsecurity.com)\n\nFinally, let's create environment variables on the Netlify side, so they will be available during each build\n```bash\nnetlify env:set VGS_CLIENT_ID \u003cclientId\u003e\nnetlify env:set VGS_CLIENT_SECRET \u003cclientSecret\u003e\nnetlify env:set VGS_VAULT_ID \u003cvaultId\u003e\n```\n\n### Configure your website\n\nCreate a simple `src/index.html` file with a form:\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n  \u003cmeta charset=\"UTF-8\"\u003e\n  \u003cmeta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"\u003e\n  \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"\u003e\n  \u003ctitle\u003eVGS \u003c-\u003e Netlify Plugin demo\u003c/title\u003e\n  \u003clink rel=\"stylesheet\" href=\"style.css\" /\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n  \u003cform id=\"vgs-collect-form\"\u003e\n    \u003clabel\u003eEmail\u003c/label\u003e\n    \u003cdiv id=\"email\" class=\"form-field\"\u003e\u003c/div\u003e\n    \u003clabel\u003ePassword\u003c/label\u003e\n    \u003cdiv id=\"password\" class=\"form-field\"\u003e\u003c/div\u003e\n    \u003cbutton type=\"submit\"\u003eLog in\u003c/button\u003e\n  \u003c/form\u003e\n  \u003cscript src=\"https://js.verygoodvault.com/vgs-collect/2.14.0/vgs-collect.js\"\u003e\u003c/script\u003e\n  \u003cscript type=\"module\" src=\"app.js\"\u003e\u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\nAdd some styles to `src/style.css` file\n```css\n* {\n  box-sizing: border-box;\n}\n\nhtml {\n  font-size: 10px;\n  font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\";\n}\n\niframe {\n  width: 100%;\n  height: 100%;\n}\n\nform {\n  width: 400px;\n  margin: 20px auto;\n}\n\nlabel {\n  display: inline-block;\n  font-size: 1.2rem;\n  margin-bottom: .6rem;\n  text-transform: uppercase;\n}\n\n.form-field {\n  width: 100%;\n  height: 4rem;\n  position: relative;\n  margin-bottom: 1.6rem;\n  border-radius: 4px;\n  box-shadow: 0 0 3px 0px #bcbcbc;\n  padding: 0 10px;\n  border: 1px solid transparent;\n}\n\n.form-field-group {\n  display: flex;\n  flex-flow: wrap;\n}\n\n.form-field-group div {\n  flex: 0 0 50%;\n}\n\n.form-field-group div:first-child div {\n  border-radius: 4px 0 0 4px;\n  clip-path: inset(-3px 0px -3px -3px);\n}\n\n.form-field-group div:last-child div {\n  border-radius: 0 4px 4px 0;\n}\n\nbutton[type=\"submit\"] {\n  width: 100%;\n  color: white;\n  background-color: #1890FF;\n  margin-top: 1.6rem;\n  text-transform: uppercase;\n  font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\";\n  font-size: 1.4rem;\n  height: 4rem;\n  font-weight: 400;\n  text-align: center;\n  border: 1px solid transparent;\n  padding: 0.375rem 0.75rem;\n  border-radius: 0.25rem;\n}\n\n.form-field.vgs-collect-container__focused {\n  border-color: #1890FF;\n}\n\n.form-field-group .form-field.vgs-collect-container__focused {\n  clip-path: none;\n}\n```\n\nand `src/app.js`, which initializes the collect.js library. Take a look at env vars:\n- `process.env.VGS_VAULT_ID` - it contains vaultId we've added to netlify previously\n- `process.env.VGS_ROUTE_ID` - this one will be created automatically by the plugin during deployment.\n\n```js\nconst vgsForm = VGSCollect.create(\n  process.env.VGS_VAULT_ID,\n  'sandbox',\n  (state) =\u003e {}).setRouteId(process.env.VGS_ROUTE_ID);\n\nconst css = {\n  boxSizing: 'border-box',\n  fontFamily: '-apple-system, BlinkMacSystemFont, \"Segoe UI\"',\n  color: '#000000',\n  '\u0026::placeholder': {\n    color: '#bcbcbc'\n  }\n};\n\nvgsForm.field('#email', {\n  type: 'text',\n  name: 'login_email',\n  placeholder: 'e.g. test@example.com',\n  validations: ['required'],\n  css\n});\n\nvgsForm.field('#password', {\n  type: 'password',\n  name: 'login_password',\n  validations: ['required'],\n  placeholder: 'password',\n  css\n});\n\ndocument.getElementById('vgs-collect-form').addEventListener('submit', (e) =\u003e {\n  e.preventDefault();\n  vgsForm.tokenize((status, response) =\u003e {\n    if (status === 200) {\n      /**\n       * Retrieve tokens from the response and send them to your server.\n       */\n      console.log(response);\n    }\n  }, (error) =\u003e {\n    console.log(error);\n  });\n});\n```\n\nNow, create `netlify.toml` file with the following contents:\n```toml\n[build]\n  publish = \"dist/\"\n  command = \"npm run build\"\n\n[dev]\n  command = \"npm start\"\n\n[[plugins]]\n  package = \"@vgs/netlify-plugin-vgs\"\n```\n\n\nAnd the last thing, create a `package.json` file, it should contain:\n- the plugin itself `@vgs/netlify-plugin-vgs`\n- `parcel` to help with the build process\n- an entry point declaration `\"source\": \"src/index.html\"`:\n```json\n{\n  \"name\": \"netlify-plugin-example\",\n  \"version\": \"1.0.0\",\n  \"source\": \"src/index.html\",\n  \"scripts\": {\n    \"start\": \"parcel\",\n    \"build\": \"parcel build\"\n  },\n  \"devDependencies\": {\n    \"@vgs/netlify-plugin-vgs\": \"0.0.6\",\n    \"parcel\": \"^2.6.2\"\n  }\n}\n```\n\nand install dependencies by running\n```bash\nnpm install\n```\n\n\nNow, your directory structure should look like this:\n\n```\nyour-app\n├─ ...\n├─ src\n| |─ index.html\n| |─ style.css\n| └─ app.js\n├─ netlify.toml\n└─ package.json\n```\n## Start local server\nNow, you are ready to start the development server, you can do it by running. It will build your app and open the browser with your running app at `http://localhost:8888`\n```bash\nnetlify build \u0026\u0026 netlify dev\n```\n\n## Deploy to production\nThis command will build and deploy your code to production. In the output you will find a public URL with your app. \n```bash\nnetlify build \u0026\u0026 netlify deploy --production\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fverygoodsecurity%2Fnetlify-plugin-vgs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fverygoodsecurity%2Fnetlify-plugin-vgs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fverygoodsecurity%2Fnetlify-plugin-vgs/lists"}