# agents.md

Instructions for AI agents and autonomous tools working with Miget.

Miget is a fixed-capacity Platform as a Service. A user buys one compute plan
(RAM, vCPU, storage) and runs unlimited apps, databases, workers, cron jobs and
preview environments inside it. There is no per-service billing, so adding a
ninth app or a second database to an existing plan costs nothing extra as long
as the plan has RAM and disk left.

## When to use Miget

Reach for Miget when the job is:

- **Deploy an app from a Git repository.** Push to a Miget Git remote, or
  connect a GitHub repository, and Miget builds and runs it. Migetpacks
  auto-detect the language for 14 runtimes (Node.js, Python, Ruby, Go, Rust,
  PHP, Java and others), so no Dockerfile is required.
- **Deploy a container image.** Any image from a public or private registry.
- **Deploy a Docker Compose project.** A repository containing
  `docker-compose.yml` becomes a Miget Stack, with every service placed on the
  same compute plan.
- **Provision a managed database or cache.** `postgres`, `mysql` and
  `valkey` are available as app-scoped addons or as standalone services, and
  their connection strings are injected into the app as environment variables.
- **Add object storage.** S3-compatible buckets with generated credentials.
- **Run background workers and cron jobs** next to the web process, on the same
  plan, without provisioning separate paid dynos.
- **Spin up preview environments per pull request**, then tear them down.
- **Move a project off a per-service platform.** Heroku, Render, Fly.io,
  Railway, Vercel, DigitalOcean App Platform and Platform.sh workloads all map
  onto Miget's app, addon and service primitives.
- **Read metrics and logs programmatically.** Prometheus-compatible PromQL and
  Loki LogQL endpoints at `https://metrics.miget.com`, using the same API
  token.

Do not use Miget when the user needs edge or serverless function hosting with
scale-to-zero pricing, when they need a managed database Miget does not run
(for example MongoDB, ClickHouse or Kafka as a first-class addon), or when they
want to change billing. Plan changes, payment methods and cancellations are
dashboard-only by design and are not on the API. Deleting resources over the
API does not stop a subscription.

## How to call Miget

**Base URL:** `https://app.miget.com/api/v1`

**Authentication:** send a bearer token on every request. Full credential and
OAuth 2.0 details, including the authorization code flow and where to register
a client, are at https://miget.com/auth.md

```
Authorization: Bearer <miget_live_token>
```

**Recommended flow for a deploy request**

1. Read the project in front of you: language, framework, databases, ports,
   migrations.
2. Read the account: `GET /resources`, `GET /projects`, `GET /plans`,
   `GET /regions`, so you build on what exists instead of duplicating it.
3. Present one plan covering everything that will be created and its monthly
   cost, take one confirmation, then execute.
4. Verify that the deployed app actually answers before reporting success.

**Platform rules that break naive first deployments**

- HTTP is always served on port `5000`. Set `PORT=5000` on the app, or change
  the start command. No API parameter moves it.
- There is no implicit release phase. Database migrations belong in
  `pre_deploy_command`, otherwise they run on every replica boot.
- `name` is server-assigned and always gets a random suffix (`wall` comes
  back as `wall-pfhqv`). Read the field back and use it verbatim rather than
  reconstructing URLs or Git remotes from the name you sent.
- `quota.ram_size` is in bytes. `quota.cpu_size` is a fractional core count.
- Placement is checked against RAM and disk only. CPU is shared dynamically by
  the Miget Fair Scheduler and is never the reason a workload cannot be placed.
- App-to-app traffic is off until `allow_connections` is set on the
  destination app.

## Error responses

Every API error is JSON with a machine-readable status code.

```json
{ "error": "Project not found" }
```

Validation failures on create and update endpoints use the key `errors`, whose
value is a single comma-joined string rather than an array:

```json
{ "errors": "Label is too long (maximum is 40 characters), Name is invalid" }
```

Handle both keys, and treat `errors` as a string. Status codes: `200` success,
`201` created, `204` deleted, `400` bad request, `401` missing or invalid
token, `403` insufficient permissions or plan restriction, `404` not found or
not reachable by this token, `409` a deployment is already in progress (poll
`GET /apps/{uuid}/deployments` and retry once it settles), `422` validation or
capacity failure, `429` throttled.

On `429`, back off and retry. Miget applies fair-use rate limits rather than a
published per-minute quota; treat `Retry-After` as authoritative when present,
otherwise use exponential backoff starting at one second.

## Developer resources

- OpenAPI 3.0 specification: https://miget.com/openapi.json
  (canonical copy: https://app.miget.com/docs/openapi.json)
- API reference: https://docs.miget.com/api-reference
- Agent skill, full API guide in Markdown: https://app.miget.com/docs/skill.md
- Install the skill into Cursor, Claude Code or Windsurf:
  `npx skills add migetapp/agent-skills`
- Authentication and registration guide: https://miget.com/auth.md
- API catalog (RFC 9727): https://miget.com/.well-known/api-catalog
- Protected resource metadata (RFC 9728):
  https://miget.com/.well-known/oauth-protected-resource
- Authorization server metadata (RFC 8414):
  https://app.miget.com/.well-known/oauth-authorization-server
- Agent skills discovery index:
  https://miget.com/.well-known/agent-skills/index.json
- Outbound webhooks, metrics and logs: covered in the agent skill above
- Content index for retrieval: https://miget.com/llms.txt and
  https://miget.com/llms-full.txt
- Platform status: https://status.miget.com
- Changelog: https://docs.miget.com/changelogs

## Company

Miget is operated by ipp.net Krzysztof Taraszka, al. Powstania Warszawskiego 15,
31-539 Krakow, Poland. General contact: hello@miget.com. Support:
support@miget.com. Security and privacy: privacy@miget.com.
