{"id":19900115,"url":"https://github.com/m-lab/piecewise-saas","last_synced_at":"2026-07-10T01:31:10.552Z","repository":{"id":52462793,"uuid":"283569731","full_name":"m-lab/piecewise-saas","owner":"m-lab","description":"Software-as-a-service deployment and authentication portal for M-Lab's Piecewise.","archived":false,"fork":false,"pushed_at":"2023-08-22T23:08:42.000Z","size":538,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-20T06:08:51.052Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/m-lab.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}},"created_at":"2020-07-29T18:09:42.000Z","updated_at":"2021-04-29T12:33:12.000Z","dependencies_parsed_at":"2024-02-23T05:45:50.327Z","dependency_job_id":null,"html_url":"https://github.com/m-lab/piecewise-saas","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/m-lab/piecewise-saas","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-lab%2Fpiecewise-saas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-lab%2Fpiecewise-saas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-lab%2Fpiecewise-saas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-lab%2Fpiecewise-saas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/m-lab","download_url":"https://codeload.github.com/m-lab/piecewise-saas/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m-lab%2Fpiecewise-saas/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35317805,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-09T02:00:07.329Z","response_time":57,"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-12T20:11:13.825Z","updated_at":"2026-07-10T01:31:10.521Z","avatar_url":"https://github.com/m-lab.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Piecewise SaaS\n\nSoftware-as-a-service deployment and authentication portal for M-Lab's\nPiecewise.\n\n## Requirements\n\n- [Node.js](https://nodejs.org) of version `\u003e=12`\n- `npm`\n\n## Structure\n\nPiecewise SaaS is composed of 2 different parts:\n\n- A [React](https://reactjs.org/)-based **frontend**.\n- A [Koa](https://koajs.com)-based **backend** that renders \u0026 serves the\n  frontend and exposes an API used by the frontend.\n\nThese parts are located here in this repository:\n\n```\nsrc/backend  # The backend components\nsrc/common   # Common code and assets\nsrc/frontend # The React frontend\n```\n\n## Configuration\n\nPiecewise SaaS is configured via variables either specified in the environment\nor defined in a `.env` file (see `env.example` for an example configuration that\nmay be edited and copied to `.env`).\n\nThe backend parses the following configuration variables:\n\n```\nPIECEWISE_SAAS_LOG_LEVEL       # Logging level (default: error)\nPIECEWISE_SAAS_DOMAIN          # The domain at which Piecewise SaaS is being hosted\nPIECEWISE_SAAS_HOST            # The host Piecewise runs on (default: localhost)\nPIECEWISE_SAAS_PORT            # The port to bind to (default: 3000)\nPIECEWISE_SAAS_DB_HOST         # Postgres database host (default: localhost)\nPIECEWISE_SAAS_DB_PORT         # Postgres port (default: 5432)\nPIECEWISE_SAAS_DB_DATABASE     # Postgres database name (default: piecewise)\nPIECEWISE_SAAS_DB_USERNAME     # Postgres user (default: piecewise)\nPIECEWISE_SAAS_DB_PASSWORD     # Postgres password\nPIECEWISE_SAAS_DB_POOL_MIN     # Postgres minimum connections (default: 0)\nPIECEWISE_SAAS_DB_POOL_MAX     # Postgres max connections (default: 10)\nPIECEWISE_SAAS_DB_TIMEOUT      # Postgres connection timeout (default: 0)\nPIECEWISE_SAAS_MAPBOX_KEY      # The Mapbox API key to which to default Piecewise instances\n```\n\nAdditionally, we use the semi-standard `NODE_ENV` variable for defining test,\nstaging, and production.In development mode Piecewise SaaS uses sqlite3, but\nuses Postgres in production.\n\n## Deployment\n\n### Standalone\n\nFirst, clone this repository and from the root of the resulting directory\ninstall Piecewise SaaS's dependencies:\n\n```\nnpm install\n```\n\nThen, build all components:\n\n```\nnpm run build\n```\n\nCreate the database:\n\n```\nnpm run db:migrations\n```\n\nand to optionally populate it with test data:\n\n```\nnpm run db:seeds\n```\n\nAnd start the running processes (with necessary environment variables if not\ndefined in `.env`):\n\n```\nnpm run start\n```\n\n(use `npm run start:dev` to run in development mode)\n\nAdditionally, components can be built or started individually using for example\n`npm run build:backend`, `npm run start:worker`, etc.\n\n### Docker\n\nYou can deploy this tool using [Docker](https://docker.io). There is an included\n`docker-compose.yml` file that will allow you to run it in a production\nconfiguration. First, clone the repo and from this directory run docker-compose:\n\n```\ndocker-compose up --build -d\n```\n\nThis will build the docker container from the current repository, download the\nofficial Postgres docker image, and configure them both (the `-d` flag will\ndetach from the current shell so that you can leave it running, but you can omit\nit in order to leave the log output attached).\n\nIf this is the first time you've run it on this system, you'll want to run the\ndatabase migrations to initialize the database:\n\n```\ndocker-compose run piecewise-saas db:migrations\n```\n\nand then optionally seed the database with a default admin user:\n\n```\ndocker-compose run piecewise-saas db:seeds\n```\n\nBy default, it runs behind [Traefik](https://traefik.io) on ports 80 \u0026 443, and Traefik will take care of issuing certificates via Letsencrypt.\n\n## OAuth2 Support\n\nPiecewise SaaS maintains Piecewise instances with OAuth2 for authentication. **This support was made and tested for use with [Piecewise](https://github.com/m-lab/piecewise), YMMV when using a different backend.**\n\nPiecewise-SaaS takes care of configuring the OAuth2 parameters for the Piecewise instances it manages.\n\n## Backups\nTo backup an instance of Piecewise running in a Docker container, run the following command:\n\n```\ndocker exec \u003cname of postgres container\u003e pg_dumpall -c -U \u003cdatabase user, default piecewise\u003e dump_`date +%d-%m-%Y\"_\"%H_%M_%S`.sql\n```\n\nTo restore:\n```\ncat \u003cbackup file\u003e.sql | docker exec -t \u003cname of postgres container\u003e pg_dumpall -c -U \u003cdatabase user, default piecewise \u003e dump_`date +%d-%m-%Y\"_\"%H_%M_%S`.sql\n```\n\n\n## License\n\nPiecewise SaaS is an open-source software project licensed under the Apache\nLicense v2.0 by [Measurement Lab](https://measurementlab.net) and\n[Throneless Tech](https://throneless.tech).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm-lab%2Fpiecewise-saas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm-lab%2Fpiecewise-saas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm-lab%2Fpiecewise-saas/lists"}