{"id":18098669,"url":"https://github.com/krzko/restmigrate","last_synced_at":"2025-04-06T04:18:30.098Z","repository":{"id":247950927,"uuid":"822118777","full_name":"krzko/restmigrate","owner":"krzko","description":"🆙 Restmigrate is a tool for managing REST API configuration migrations, inspired by database schema migration tools.","archived":false,"fork":false,"pushed_at":"2024-09-20T08:38:57.000Z","size":579,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T17:57:43.241Z","etag":null,"topics":["api-migration","apisix","caddy","cue","cuelang","database-migrations","database-schema","kong","migration","migrations","rest","rest-api"],"latest_commit_sha":null,"homepage":"","language":"Go","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/krzko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-30T10:50:13.000Z","updated_at":"2024-10-15T11:26:15.000Z","dependencies_parsed_at":"2024-07-14T14:45:16.903Z","dependency_job_id":null,"html_url":"https://github.com/krzko/restmigrate","commit_stats":null,"previous_names":["krzko/restmigrate"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krzko%2Frestmigrate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krzko%2Frestmigrate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krzko%2Frestmigrate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krzko%2Frestmigrate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krzko","download_url":"https://codeload.github.com/krzko/restmigrate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247431068,"owners_count":20937890,"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":["api-migration","apisix","caddy","cue","cuelang","database-migrations","database-schema","kong","migration","migrations","rest","rest-api"],"created_at":"2024-10-31T20:12:20.906Z","updated_at":"2025-04-06T04:18:30.024Z","avatar_url":"https://github.com/krzko.png","language":"Go","readme":"# restmigrate\n\n`restmigrate` is a Go-based tool for managing and applying configuration changes to REST APIs in a systematic, version-controlled manner. It uses a migration-like approach similar to database schema migrations, allowing you to define, apply, and revert changes to your REST API configurations.\n\n## Features\n\n- Create, apply, and revert REST API configuration changes\n- Support for multiple API gateways or generic API endpoints (e.g., Kong, APISIX, Generic)\n- [CUE](https://cuelang.org/) language for defining migrations\n- [OpenTelemetry](https://opentelemetry.io/) traces integration for observability\n\n### OpenTelemetry\n\n`restmigrate` supports OpenTelemetry for distributed tracing, follow the [configuration](#configuration) section to enable it.\n\n\u003cimg\n  src=\"/assets/images/trace-dark.png\"\n  alt=\"Distributed trace\"\n  title=\"Distributed trace\"\n  style=\"display: inline-block; margin: 0 auto; max-width: 300px\"\u003e\n\n## Installation\n\n### brew\n\nInstall [brew](https://brew.sh/) and then run:\n\n```sh\nbrew install krzko/tap/restmigrate\n```\n\n### Download Binary\n\nDownload the latest version from the [Releases](https://github.com/krzko/restmigrate/releases) page.\n\n## Commands\n\n* `create`: Create a new migration file\n* `up`: Apply pending migrations\n* `down`: Revert the last applied migration (use `--all` to revert all)\n* `list`: Display applied migrations\n\n## Configuration\n\nSet these environment variables to configure `restmigrate`:\n\n* `OTEL_EXPORTER_OTLP_ENDPOINT`: OpenTelemetry exporter endpoint\n* `OTEL_EXPORTER_OTLP_INSECURE`: Set to \"true\" for insecure connection\n* `OTEL_SDK_ENABLED`: Set to \"true\" to enable OpenTelemetry (disabled by default)\n\n## Usage\n\n### Creating a new migration\n\nTo create a new migration file:\n\n```bash\nrestmigrate create \u003cmigration_name\u003e\n```\n\nThis will create a new CUE file in the `migrations` directory with a timestamp prefix.\n\n### Applying migrations\n\nTo apply all pending migrations, `--token` and `--type` are optional if the API does not require authentication:\n\n```bash\nrestmigrate up --url \u003capi_base_url\u003e --token \u003capi_token\u003e --type \u003ctype\u003e\n```\n\n### Reverting the last migration\n\nTo revert the most recently applied migration:\n\n```bash\nrestmigrate down --url \u003capi_base_url\u003e --token \u003capi_token\u003e --type \u003ctype\u003e\n```\n\n## Migration File Format\n\nMigration files are written in CUE and should follow this structure:\n\n```cue\nmigration: {\n    timestamp: 1625097600  // Unix timestamp\n    name:      \"add_new_endpoint\"\n    up: {\n        \"/api/v1/new_endpoint\": {\n            method: \"POST\"\n            body: {\n                // Define the request body here\n            }\n        }\n    }\n    down: {\n        \"/api/v1/new_endpoint\": {\n            method: \"DELETE\"\n        }\n    }\n}\n```\n\nThe `up` and `down` fields define the changes to be applied and reverted, respectively. The `timestamp` field is used to track the order of migrations.\n\nExamples of migration files can be found in the [examples](/examples/) directory.\n\n## Development\n\nTo set up the development environment:\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/krzo/restmigrate.git\n```\n\n2. Change to the project directory:\n\n```bash\ncd restmigrate\n```\n\n3. Install dependencies:\n\n```bash\ngo mod tidy\n```\n\n4. Build the project:\n\n```bash\nmake build\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrzko%2Frestmigrate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrzko%2Frestmigrate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrzko%2Frestmigrate/lists"}