{"id":17739024,"url":"https://github.com/pierrekieffer/mgate","last_synced_at":"2026-04-16T04:32:18.696Z","repository":{"id":120128922,"uuid":"260518147","full_name":"PierreKieffer/mgate","owner":"PierreKieffer","description":"Schema validation layer and metadata management tool built for mongodb","archived":false,"fork":false,"pushed_at":"2020-05-18T07:14:04.000Z","size":203,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-08T12:06:13.988Z","etag":null,"topics":["akka","akka-http","json-schema","mongodb","schema-registry","schema-validation"],"latest_commit_sha":null,"homepage":"","language":"Scala","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/PierreKieffer.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}},"created_at":"2020-05-01T17:28:25.000Z","updated_at":"2020-05-18T07:14:06.000Z","dependencies_parsed_at":"2024-06-12T01:20:16.100Z","dependency_job_id":null,"html_url":"https://github.com/PierreKieffer/mgate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PierreKieffer/mgate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PierreKieffer%2Fmgate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PierreKieffer%2Fmgate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PierreKieffer%2Fmgate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PierreKieffer%2Fmgate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PierreKieffer","download_url":"https://codeload.github.com/PierreKieffer/mgate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PierreKieffer%2Fmgate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31871548,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"online","status_checked_at":"2026-04-16T02:00:06.042Z","response_time":69,"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":["akka","akka-http","json-schema","mongodb","schema-registry","schema-validation"],"created_at":"2024-10-26T02:06:59.273Z","updated_at":"2026-04-16T04:32:18.676Z","avatar_url":"https://github.com/PierreKieffer.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mgate \n\n```\n\n                               \n _____ _____ _____ _____ _____ \n|     |   __|  _  |_   _|   __|\n| | | |  |  |     | | | |   __|\n|_|_|_|_____|__|__| |_| |_____|\n                               \n\n```\n                               \nmgate is a schema validation layer for mongodb, which provides : \n- Metadata management rest interface \n- Schema validation for insert and update/upsert queries \n- Production deployment workflow on kubernetes\n\n\n* [Run](#run)\n\t* [configuration](#configuration)\n\t* [Start mGate](#start-mgate)\n* [Usage](#usage)\n\t* [Upload or update a schema](#upload-or-update-a-schema)\n\t* [Routes](#routes)\n* [Build and deploy](#build-and-deploy)\n\t* [Package application](#package-application)\n\t* [Docker](#docker)\n\t* [Build and deploy on Kubernetes](#build-and-deploy-on-kubernetes)\n\t\t* [Prerequisities](#prerequisities)\n\t\t* [Deploying to kubernetes](#deploying-to-kubernetes)\n\t\t\t* [Application](#application)\n\n\n## Run \n\n```bash \ndocker pull pierrekieffer/mgate\n```\n### configuration \nYou need to edit the config.yml file with your own settings : \n\nYou must specify the names of the schemas assigned to each collection, and the database names of each collection\n```yaml \nassociatedCollectionSchema : '{\"collection1\" : \"schema_name1\",\"collection2\":\"schema_name2\"}'\nassociatedCollectionDatabase : '{\"collection1\":\"database_name\",\"collection2\":\"database_name\"}'\n```\n\n### Start mGate \n```bash \ndocker run --network host -v /.../mgate/docker/config/:/usr/local/config/ pierrekieffer/mgate\n```\n\n## Usage \n### Upload or update a schema\nYour schema name must respect the following pattern : name_version.json (user_v2.json)\n\nYour schema must respect json standard rules (http://json-schema.org/draft-04/schema#)\n\nTo easily generate json schemas, you can refer to https://github.com/coursera/autoschema \n\nTo upload a new schema or update an existing schema : \n\n\n```bash \ncurl -X POST -d @schema-name_v1.json http://localhost:8080/secured/schema-registry/admin/schema-update --header \"Content-Type:application/json\" --header \"Authorization: Bearer token\"\n```\n\n### Routes \n- Main\n\n```\nhttp://\u003cHOST\u003e:8080/secured/schema-registry\n```\n\n- Test auth\n\n```\n/test-login\n```\n\n- INSERT \n\n```\n/db-driver/insert\n```\n\nPayload : \n```\n{\n    \"collection\": \"users\",\n    \"document\": $jsonDocument\n}\n```\njsonDocument = { json associated to collection data}\n\nExample : \n```\n{\n    \"collection\": \"users\",\n    \"document\": {\n        \"email\": \"pikachu@mail.com\",\n        \"firstName\": \"Pika\",\n        \"lastName\": \"Chu\",\n        \"communications\": {\n            \"allowNewsletters\": False\n        }\n    }\n}\n```\n```bash \ncurl -X POST -d @insert-data.json http://localhost:8080/secured/schema-registry/db-driver/insert --header \"Content-Type:application/json\" --header \"Authorization: Bearer token\"\n```\n\n\n- UPDATE \n\n```\n/db-driver/update\n```\n\nPayload : \n\n```\n{\n    \"collection\":  String,  \t    \n    \"_id\" : String,    \n    \"document\": $jsonDocument\n}\n```\n\njsonDocument = { json data to update}\n\nExample : \n\n```\n{\n    \"collection\": \"users\",\n    “_id” : “592be28bf322cc152069e957”\n    \"document\": {\n        \"email\": \"pikachu-newmail@mail.com\",\n        \"communications\": {\n            \"allowNewsletters\": True, \n            \"allowSMS\": True\n            }\n         }\n}\n```\n\n```bash \ncurl -X POST -d @update-data.json http://localhost:8080/secured/schema-registry/db-driver/update --header \"Content-Type:application/json\" --header \"Authorization: Bearer token\"\n```\n\n- UPSERT \n\n```\n/db-driver/upsert\n```\nPayload :\n\n```\n{\n    \"collection\":  String,\n    \"_id\" : String,\n    \"document\": $jsonDocument\n}\n```\n\njsonDocument = { json data to update}\n\nExample :\n\n```\n{\n    \"collection\": \"users\",\n    “_id” : “592be28bf322cc152069e957”\n    \"document\": {\n        \"email\": \"pikachu-newmail@mail.com\",\n        \"communications\": {\n            \"allowNewsletters\": True,\n            \"allowSMS\": True\n            }\n         }\n}\n```\n- PUSH \n```\n/db-driver/push\n```\n\nPayload : \n \n```\n{\n    \"collection\":  String,\n    \"_id\" : String,\n    \"document\": $jsonDocument\n}\n```\n\n\nIt is possible to pass MongoDB operations inside the document : \n\nExample : \n```\n\"document\" : {\"array\" : {\"$each\" : [\"foo\",\"bar\"] }}\n```\n\n## Build and deploy \n### Package application \nTo package the application you need sbt 0.13.15\n\n```bash \nsbt assembly\n```\n\n\n### Docker\n\n```bash \ndocker build -t mgate . \n``` \n\n### Build and deploy on Kubernetes \n#### Prerequisities \nYou will need to install : \n- gcloud \n- kubectl \n\n\n#### Deploying to kubernetes \n##### Application\nBuild docker image and push it to your favorite registry\n\nAdd your own parameters to  the config.yml file\n\nGenerate the config-map :\n\n```bash \n./k8s/generate-configMap.sh PROJECT_ID CLUSTER_ID config.yml\n```\n\nDeploy :\n\n```bash \n./deploy.sh PROJECT_ID CLUSTER_ID\n``` \n\n\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpierrekieffer%2Fmgate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpierrekieffer%2Fmgate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpierrekieffer%2Fmgate/lists"}