{"id":18962271,"url":"https://github.com/lipp/now-is-production","last_synced_at":"2026-02-24T02:03:18.352Z","repository":{"id":138884792,"uuid":"70786066","full_name":"lipp/now-is-production","owner":"lipp","description":"Checks if your `now` deployment is the production deployment","archived":false,"fork":false,"pushed_at":"2016-10-13T08:54:33.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-02T06:13:08.586Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"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/lipp.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":"2016-10-13T08:36:10.000Z","updated_at":"2016-10-13T08:36:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"0d162866-3698-4b81-b204-ff89c4980808","html_url":"https://github.com/lipp/now-is-production","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lipp/now-is-production","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lipp%2Fnow-is-production","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lipp%2Fnow-is-production/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lipp%2Fnow-is-production/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lipp%2Fnow-is-production/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lipp","download_url":"https://codeload.github.com/lipp/now-is-production/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lipp%2Fnow-is-production/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29768401,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T01:40:24.820Z","status":"online","status_checked_at":"2026-02-24T02:00:07.497Z","response_time":75,"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-11-08T14:15:48.330Z","updated_at":"2026-02-24T02:03:18.347Z","avatar_url":"https://github.com/lipp.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# The problem\n\nDepending if your deployment is staging or production, your service might behave differently.\n\nWhen using [now](https://zeit.co/now), your deployment gets a \"random\" url when deployed initially. \nIf you want your deployment to go production, a `now alias` is created.\nAfter re-eploying your service, the old deployment may have to do some cleanup or shutdown (e.g. closing socket connections).\n\n# The solution\n\nThis module periodically polls if the running deployment (NOW_URL env) has an alias to the production url.\n\n```js\nconst nowIsProduction = require('now-is-production')\nconst now = nowClient('YOUR TOKEN')\n\nconst listener = nowIsProduction({\n  api: now,\n  productionUrl: 'live.yourservice.com',\n  checkInterval: 30000 // 30secs\n})\n\nlistener.on('staging', (wasProduction) =\u003e {\n  if (wasProduction) {\n    // close real DB connection\n    // process.exit(0)\n  } else {\n    // connect dummy DB\n  }\n})\n\nlistener.on('production', (wasStaging) =\u003e {\n  if (wasStaging) {\n    // close dummy DB\n  }\n  // connect real DB\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flipp%2Fnow-is-production","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flipp%2Fnow-is-production","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flipp%2Fnow-is-production/lists"}