{"id":15020051,"url":"https://github.com/defanglabs/defang","last_synced_at":"2026-05-15T09:17:57.576Z","repository":{"id":182613172,"uuid":"655181249","full_name":"DefangLabs/defang","owner":"DefangLabs","description":"Defang CLI and sample projects. Develop Anything, Deploy Anywhere. Take your app from Docker Compose to a secure and scalable deployment on your favorite cloud in minutes.","archived":false,"fork":false,"pushed_at":"2025-04-03T22:35:37.000Z","size":48950,"stargazers_count":61,"open_issues_count":92,"forks_count":11,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-03T23:27:25.596Z","etag":null,"topics":["aws","cloud","compose","deploy","deployment","digitalocean","docker","docker-compose","gcp","infrastructure-as-code"],"latest_commit_sha":null,"homepage":"https://defang.io","language":"Go","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/DefangLabs.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":"2023-06-18T06:15:46.000Z","updated_at":"2025-04-03T18:06:13.000Z","dependencies_parsed_at":"2024-04-01T06:39:44.103Z","dependency_job_id":"2d90e2ec-f628-4673-9185-30f204939816","html_url":"https://github.com/DefangLabs/defang","commit_stats":{"total_commits":1274,"total_committers":18,"mean_commits":70.77777777777777,"dds":0.5690737833594977,"last_synced_commit":"d889d1abd2cadf2f7eb1ba9bd09c379596349d5d"},"previous_names":["defang-io/defang","defanglabs/defang"],"tags_count":184,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DefangLabs%2Fdefang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DefangLabs%2Fdefang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DefangLabs%2Fdefang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DefangLabs%2Fdefang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DefangLabs","download_url":"https://codeload.github.com/DefangLabs/defang/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247312077,"owners_count":20918344,"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":["aws","cloud","compose","deploy","deployment","digitalocean","docker","docker-compose","gcp","infrastructure-as-code"],"created_at":"2024-09-24T19:54:31.386Z","updated_at":"2026-05-15T09:17:57.568Z","avatar_url":"https://github.com/DefangLabs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Go package](https://github.com/DefangLabs/defang/actions/workflows/go.yml/badge.svg?branch=main)](https://github.com/DefangLabs/defang/actions/workflows/go.yml)\n[![Discord](https://img.shields.io/discord/1233224785450897561)](https://s.defang.io/discord)\n![GitHub Release](https://img.shields.io/github/v/release/DefangLabs/defang)\n\n### ![Defang](https://raw.githubusercontent.com/DefangLabs/defang-assets/main/Logos/Element_Wordmark_Slogan/JPG/Dark_Colour_Glow.jpg)\n\n## Develop Once, Deploy Anywhere.\n\nTake your app from Compose to a secure and scalable deployment on your favorite cloud in minutes.\n\n### How It Works\n\n```mermaid\nflowchart LR\n\nsubgraph local[\"Your Machine or CI/CD\"]\n    compose[\"compose.yaml\"] --\u003e cli[\"Defang CLI\"]\nend\n\nsubgraph defang[\"Defang Backend\"]\n    fabric[\"Fabric API (gRPC)\"]\nend\n\nsubgraph cloud[\"Your Cloud Account\"]\n    secrets[\"Config \u0026 Secrets\"]\n    cd[\"Defang CD Task\"]\n    logs[\"Logs\"]\n    runtime[\"Load Balancer, Containers, DB, Cache, LLM, DNS, Roles\"]\nend\n\n%% control plane\ncli \u003c-.-\u003e fabric\n\n%% deploy\ncli --\u003e secrets\ncli --\u003e cd\ncd --\u003e runtime\n\n%% observability\ncli -.-\u003e logs\n```\n\n1. **You write** a standard Docker **Compose** file\n2. **Defang CLI** validates your Compose project and uploads the project to storage in your AWS/GCP account\n3. **CD runs in your cloud** — a deployment task spins up in your AWS/GCP account\n4. **Infrastructure is created** — containers, DNS, load balancing, and roles are provisioned\n5. **Monitor** the deployment and tail or query runtime logs with the Defang CLI\n\nYour code and secrets never leave your cloud account. Defang orchestrates the deployment, but everything runs in your infrastructure.\n\n## Defang CLI\n\nThe Defang Command-Line Interface [(CLI)](https://docs.defang.io/docs/getting-started) is designed for developers who prefer to manage their workflows directly from the terminal. It offers full access to Defang’s capabilities, allowing you to build, test, and deploy applications efficiently to the cloud.\n\n### Deploying with Defang\n\nIf you already have a Docker Compose file, create a new [stack](https://docs.defang.io/docs/concepts/stacks) and then deploy it. For example:\n\n```shell\n$ defang stack new\n? Which cloud provider do you want to deploy to? AWS\n? Which AWS region do you want to deploy to? us-west-2\n? Which deployment mode do you want to use? AFFORDABLE\n? What do you want to call this stack? awsuswest2\n * Created new stack configuration file: `.defang/awsuswest2`. Check this file into version control. You can now deploy this stack using `defang up --stack=awsuswest2`\n\n$ defang up --stack=awsuswest2\n```\n\n## Defang MCP Server\n\n[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_defang-0098FF?style=flat\u0026logo=visualstudiocode\u0026logoColor=ffffff)](https://vscode.dev/redirect?url=vscode:mcp/install?%7B%22name%22%3A%22defang%22%2C%22type%22%3A%22stdio%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22defang%40latest%22%2C%22mcp%22%2C%22serve%22%2C%22--client%3Dvscode%22%5D%7D)\n[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install_defang-24bfa5?style=flat\u0026logo=visualstudiocode\u0026logoColor=ffffff)](https://insiders.vscode.dev/redirect?url=vscode-insiders:mcp/install?%7B%22name%22%3A%22defang%22%2C%22type%22%3A%22stdio%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22defang%40latest%22%2C%22mcp%22%2C%22serve%22%2C%22--client%3Dvscode-insiders%22%5D%7D)\n[![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=defang\u0026config=eyJ0eXBlIjoic3RkaW8iLCJjb21tYW5kIjoibnB4IC15IGRlZmFuZyBtY3Agc2VydmUgLS1jbGllbnQgY3Vyc29yIn0%3D)\n[![Add to Kiro](https://kiro.dev/images/add-to-kiro.svg)](https://kiro.dev/launch/mcp/add?name=defang\u0026config=%7B%22command%22%3A%20%22npx%22%2C%20%22args%22%3A%20%5B%22-y%22%2C%20%22defang%40latest%22%2C%20%22mcp%22%2C%20%22serve%22%2C%20%22--client%3Dkiro%22%5D%2C%20%22disabled%22%3A%20false%2C%20%22autoApprove%22%3A%20%5B%5D%7D)\n\nThe Defang Model Context Protocol [(MCP)](https://docs.defang.io/docs/concepts/mcp) Server is tailored for developers who work primarily within integrated development environments (IDEs). It enables seamless cloud deployment from supported editors such as Cursor, Windsurf, VS Code, VS Code Insiders and Claude delivering a fully integrated experience without leaving your development environment.\n\n## Claude Code Plugin\n\nInstall the Defang plugin for [Claude Code](https://claude.ai/code) to deploy directly from any Claude Code session — no CLI required upfront:\n\n```shell\n/plugin marketplace add DefangLabs/defang\n/plugin install defang@defang-skills\n```\n\nAfter installing, use `/defang:deploy` to guide you through deploying your project. The Defang MCP server activates automatically once the Defang CLI is installed.\n\n## This repo includes:\n\n- Public releases of the Defang CLI; [click here](https://github.com/DefangLabs/defang/releases/latest/) for the latest version\n- Built-in support for MCP Server — the Defang MCP Server makes cloud deployment as easy as a single prompt. [Learn more](https://docs.defang.io/docs/concepts/mcp)\n- Samples that show how to deploy an app using the [Defang Pulumi Provider](https://github.com/DefangLabs/pulumi-defang).\n\n## Getting started\n\n- Read our [Getting Started](https://docs.defang.io/docs/getting-started) page\n- Follow the installation instructions from the [Installing](https://docs.defang.io/docs/getting-started/installing) page\n- Take a look at our [Samples](https://github.com/DefangLabs/samples) in Golang, Python, and Node.js that show how to accomplish various tasks and deploy them\n- Try the AI integration by running `defang generate`\n- Start your new service with `defang compose up`\n\n## Installing\n\nInstall the Defang CLI from one of the following sources:\n\n- Using the [Homebrew](https://brew.sh) package manager [DefangLabs/defang tap](https://github.com/DefangLabs/homebrew-defang):\n\n  ```\n  brew install DefangLabs/defang/defang\n  ```\n\n- Using a shell script:\n\n  ```\n  eval \"$(curl -fsSL s.defang.io/install)\"\n  ```\n\n- Using [Go](https://go.dev):\n\n  ```\n  go install github.com/DefangLabs/defang/src/cmd/cli@latest\n  ```\n\n- Using the [Nix package manager](https://nixos.org):\n  - with Nix-Env:\n    ```\n    nix-env -if https://github.com/DefangLabs/defang/archive/main.tar.gz\n    ```\n  - or with Flakes:\n    ```\n    nix profile install github:DefangLabs/defang#defang-cli --refresh\n    ```\n\n- Using [winget](https://learn.microsoft.com/en-us/windows/package-manager/winget/):\n\n  ```\n  winget install defang\n  ```\n\n- Using a PowerShell script:\n\n  ```\n  iwr https://s.defang.io/defang_win_amd64.zip -OutFile defang.zip\n  Expand-Archive defang.zip . -Force\n  ```\n\n- Using the [official image from Docker Hub](https://hub.docker.com/r/defangio/defang-cli):\n\n  ```\n  docker run -it defangio/defang-cli help\n  ```\n\n- Using [NPX](https://docs.npmjs.com/cli/v9/commands/npx):\n\n  ```\n  npx defang@latest help\n  ```\n\n- or download the [latest binary](https://github.com/DefangLabs/defang/releases/latest/) of the Defang CLI.\n\n## Support\n\n- File any issues [here](https://github.com/DefangLabs/defang/issues)\n\n## Command completion\n\nThe Defang CLI supports command completion for Bash, Zsh, Fish, and Powershell. To get the shell script for command completion, run the following command:\n\n```\ndefang completion [bash|zsh|fish|powershell]\n```\n\nIf you're using Bash, you can add the following to your `~/.bashrc` file:\n\n```\nsource \u003c(defang completion bash)\n```\n\nIf you're using Zsh, you can add the following to your `~/.zshrc` file:\n\n```\nsource \u003c(defang completion zsh)\n```\n\nor pipe the output to a file called `_defang` in the directory with the completions.\n\nIf you're using Fish, you can add the following to your `~/.config/fish/config.fish` file:\n\n```\ndefang completion fish | source\n```\n\nIf you're using Powershell, you can add the following to your `$HOME\\Documents\\PowerShell\\Microsoft.PowerShell_profile.ps1` file:\n\n```\nInvoke-Expression -Command (defang completion powershell | Out-String)\n```\n\n## Environment Variables\n\nThe Defang CLI recognizes the following environment variables:\n\n- `COMPOSE_DISABLE_ENV_FILE` - Whether to disable loading environment variables from a `.env` file in the current directory; defaults to `false`\n- `COMPOSE_FILE` - The Compose file(s) to use; defaults to `compose.yaml`, `compose.yml`, `docker-compose.yaml`, or `docker-compose.yml` in the current directory\n- `COMPOSE_PATH_SEPARATOR` - The path separator to use for `COMPOSE_FILE`; defaults to `:` on Unix/MacOS and `;` on Windows\n- `COMPOSE_PROJECT_NAME` - The name of the project to use; overrides the `name` in the Compose file\n- `DEFANG_ACCESS_TOKEN` - The access token to use for authentication; if not specified, uses token from `defang login`\n- `DEFANG_ALLOW_UPGRADE` - If set to `true`, allows upgrading the CD image and Pulumi version to the latest available; defaults to `false`, ie. previously deployed versions will be used to avoid unexpected upgrades\n- `DEFANG_BUILD_CONTEXT_LIMIT` - The maximum size of the build context when building container images; defaults to `100MiB`\n- `DEFANG_CD_BUCKET` - The S3 bucket to use for the BYOC CD pipeline; defaults to `defang-cd-bucket-…`\n- `DEFANG_CD_IMAGE` - The image to use for the Continuous Deployment (CD) pipeline; defaults to `public.ecr.aws/defang-io/cd:public-beta`\n- `DEFANG_DEBUG` - set this to `1` or `true` to enable debug logging\n- `DEFANG_DISABLE_ANALYTICS` - If set to `true`, disables sending analytics to Defang; defaults to `false`\n- `DEFANG_EDITOR` - The editor to launch after new project generation; defaults to `code` (VS Code)\n- `DEFANG_FABRIC` - The address of the Defang Fabric to use; defaults to `fabric-prod1.defang.dev`\n- `DEFANG_JSON` - If set to `true`, outputs JSON instead of human-readable output; defaults to `false`\n- `DEFANG_HIDE_HINTS` - If set to `true`, hides hints in the CLI output; defaults to `false`\n- `DEFANG_HIDE_UPDATE` - If set to `true`, hides the update notification; defaults to `false`\n- `DEFANG_ISSUER` - The OAuth2 issuer to use for authentication; defaults to `https://auth.defang.io`\n- `DEFANG_MODEL_ID` - The model ID of the LLM to use for the generate/debug AI integration (Pro users only)\n- `DEFANG_NO_CACHE` - If set to `true`, disables pull-through caching of container images; defaults to `false`\n- `DEFANG_PREFIX` - The prefix to use for all BYOC resources; defaults to `Defang`\n- `DEFANG_PROVIDER` - The name of the cloud provider to use, `auto` (default), `aws`, `digitalocean`, `gcp`, or `defang`\n- `DEFANG_PULUMI_BACKEND` - The Pulumi backend URL or `\"pulumi-cloud\"`; defaults to a self-hosted backend\n- `DEFANG_PULUMI_DEBUG` - If set to `true`, enables debug logging for Pulumi operations; defaults to `false`\n- `DEFANG_PULUMI_DIFF` - If set to `true`, shows the Pulumi diff during deployments; defaults to `false`\n- `DEFANG_PULUMI_DIR` - Run Pulumi from this folder, instead of spawning a cloud task; requires `--debug` (BYOC only)\n- `DEFANG_PULUMI_VERSION` - Override the version of the Pulumi image to use (`aws` provider only)\n- `DEFANG_SUFFIX` - The suffix to use for all BYOC resources; defaults to the stack name, or `beta` if unset.\n- `DEFANG_WORKSPACE` - The workspace (name or ID) to use; preferred way to select which workspace the CLI uses\n- `NO_COLOR` - If set to any value, disables color output; by default, color output is enabled depending on the terminal\n- `PULUMI_ACCESS_TOKEN` - The Pulumi access token to use for authentication to Pulumi Cloud; see `DEFANG_PULUMI_BACKEND`\n- `PULUMI_CONFIG_PASSPHRASE` - Passphrase used to generate a unique key for your stack, and configuration and encrypted state values\n- `TZ` - The timezone to use for log timestamps: an IANA TZ name like `UTC` or `Europe/Amsterdam`; defaults to `Local`\n- `XDG_STATE_HOME` - The directory to use for storing state; defaults to `~/.local/state`\n\nEnvironment variables will be loaded from a `.defang` file in the current directory, if it exists. This file follows\nthe same format as a `.env` file: `KEY=VALUE` pairs on each line, lines starting with `#` are treated as comments and ignored.\n\n## Development\n\nAt Defang we use the [Nix package manager](https://nixos.org) for our dev environment, in conjunction with [DirEnv](https://direnv.net).\n\nTo get started quickly, install Nix and DirEnv, then create a `.envrc` file to automatically load the Defang developer environment:\n\n```sh\necho use flake \u003e\u003e .envrc\ndirenv allow\n```\n\n### Adding cloud support\n\nAt a high-level, support for a specific cloud lives in three repositories:\n\n- In [this CLI repository](https://github.com/DefangLabs/defang)\n  - an implementation of the [client.Provider](src/pkg/cli/client/byoc) interface under the [`byoc` package](src/pkg/cli/client/byoc)\n  - low-level cloud helpers (\"driver\") under the [`clouds` package](src/pkg/clouds)\n    - authenticate with the cloud\n    - start a CD container (task/job)\n    - monitor the CD container's status and logs\n    - stream/query logs from deployed services\n    - set/list config (secrets/parameters)\n- In the [Defang Pulumi Provider repository](https://github.com/DefangLabs/pulumi-defang)\n  - Pulumi **component** resources under the `provider` folder\n    - `Project` component\n    - `Service` component\n    - `Postgres` component\n    - `Redis` component\n  - a Pulumi **custom** resource for `Build`\n  - an implementation of the `ConfigProvider` interface to read config (secrets/parameters) at deploy time\n- In the [Defang Docs repository](https://github.com/DefangLabs/defang-docs)\n  - under the [`providers` section](https://docs.defang.io/docs/providers), documentation for how to set up credentials and permissions for the cloud, and any cloud-specific features\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefanglabs%2Fdefang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdefanglabs%2Fdefang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefanglabs%2Fdefang/lists"}