Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .claude/rules/linting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Linting

This project uses Prettier for code formatting.

- All source files (`.ts`, `.tsx`, `.js`, `.jsx`, `.md`, `.json`, `.css`) must be formatted with Prettier before committing.
- `.mdx` is excluded (see `.prettierignore`): Prettier's markdown/mdx printer corrupts Docusaurus JSX-in-Markdown (Tabs/TabItem children, `{/* */}` comments). Format `.mdx` files by hand.
- Run `npx prettier --write <file>` after editing any file.
- Run `npm run format:check` to verify all files are formatted.
- The pre-commit hook runs lint-staged automatically, which formats staged files with Prettier.
- Do NOT skip the pre-commit hook with `--no-verify`.
11 changes: 11 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"fileMatcher": "\\.(ts|tsx|js|jsx|md|mdx|json|css)$",
"command": "npx prettier --write ${file}"
}
]
}
}
1 change: 0 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ jobs:
user_email: 41898282+github-actions[bot]@users.noreply.github.com
cname: docs.defang.io


# Notify docs chatbot of new docs with curl command
- name: Notify docs chatbot of new docs
run: |
Expand Down
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
12 changes: 12 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
node_modules/
build/
.docusaurus/
static/
*.lock
# Docusaurus MDX mixes JSX with indented Markdown (Tabs/TabItem children,
# JSX comments). Prettier's markdown/mdx printer mis-parses that nesting -
# it reflows fenced code blocks into prose and escapes `*` inside `{/* */}`
# JSX comments - which corrupts content without erroring on some files and
# breaks the Docusaurus build on others. Leave .mdx unformatted until
# Prettier's MDX support handles this correctly.
*.mdx
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": true,
"singleQuote": false,
"trailingComma": "all",
"tabWidth": 2,
"printWidth": 80
}
13 changes: 13 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
# Repository Guidelines

## Project Structure & Module Organization

The site is a Docusaurus 3 app. Author content in `docs/` (guides, CLI docs under `docs/cli/`) and `blog/` (Markdown posts). React-based customizations live in `src/` (`src/pages/index.tsx`, `src/components/`), while static assets and JSON feeds ship from `static/`. Build artifacts land in `build/` and should never be committed. Automation scripts sit in `scripts/`, notably `scripts/prebuild.sh`, which normalizes CLI docs and samples before every build.

## Build, Test, and Development Commands

Install dependencies with `npm install`. Use `npm run start` for local dev; it runs `scripts/prebuild.sh`, then serves the docs with hot reload. Execute `npm run build` for production-ready static output and `npm run serve` to smoke-test the generated `build/`. Run `npm run typecheck` to catch TS issues without compiling, and `npm run clear` if you need to reset the Docusaurus cache.

## Coding Style & Naming Conventions

Write prose in Markdown or MDX with frontmatter; use kebab-case filenames such as `docs/networking/private-endpoints.mdx`. React/TypeScript follows 2-space indentation, named exports when practical, and TypeScript types declared near component definitions. Tailwind utility classes are available; co-locate component styles via `.module.css` when utilities are insufficient. Keep metadata files (`_category_.json`) lean and descriptive.

## External Dependencies & Prebuild Notes

The prebuild step shells into `../defang/src/cmd/gendocs` (requires Go) and ingests `../samples/samples`. Keep those repositories updated locally, or vendor them into `defang-docs/defang` and `defang-docs/samples` when working in CI or preview branches.

## Formatting

This project uses Prettier for code formatting with a pre-commit hook (Husky + lint-staged).

- Agents MUST run `npx prettier --write <file>` on any file they create or edit.
- Agents MUST NOT use `--no-verify` on commits.
- The pre-commit hook runs Prettier automatically on staged files, but agents should format before staging to catch issues early.
- Run `npm run format:check` to verify all files pass formatting.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ This website is built using [Docusaurus 2](https://docusaurus.io/), a modern sta
```
$ npm install
```

Make sure that you've cloned the `defanglabs/defang` repo and `defanglabs/samples` repo in sibling directories.

```
$ git clone https://github.com/DefangLabs/defang.git ../defang
$ git clone https://github.com/DefangLabs/defang.git ../defang
$ git clone https://github.com/DefangLabs/samples.git ../samples
```

Expand All @@ -28,7 +29,7 @@ This command generates static content into the `build` directory and can be serv
$ npm run start
```

This command starts a local development server and opens up a browser window.
This command starts a local development server and opens up a browser window.

### Deployment

Expand Down
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
presets: [require.resolve("@docusaurus/core/lib/babel/preset")],
};
21 changes: 12 additions & 9 deletions blog/2024-03-28-slackbot-sample.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,26 @@ authors: raphael_titsworth_morin
Hey folks! Today, I'm going to share one of our code samples that will show you how to deploy a simple Slack bot. If you're looking to connect a cloud service to Slack to publish status updates, or something else like that, this should help you get started. We'll walk through a step-by-step process of writing a Go program using the [github.com/slack-go/slack](https://github.com/slack-go/slack) library to interact with the Slack API and easily deploy it using Defang.

{/* truncate */}

## Prerequisites

Before we dive into the details, let's make sure you have everything you need to get started:

1. **Install Defang CLI:** Simplify your deployment process by installing the Defang CLI tool. Follow the instructions [here](/docs/intro/getting-started#install-the-defang-cli) to get it up and running quickly.

2. **Slack API Token:** Create a Slack App at https://api.slack.com/apps, granting it the necessary permissions, including the bot `chat:write` scope.
![screenshot of the slack admin UI showing the bot scopes](/img/slackbot-sample/scopes.png)
![screenshot of the slack admin UI showing the bot scopes](/img/slackbot-sample/scopes.png)

3. **Install the app in your workspace:** You'll need to install the app in your workspace for it to work. Click the "Install to Workspace" button in the Slack admin UI to do this. Mine says "Reinstall" because I've already installed it.
![screenshot of the slack admin UI showing the install button](/img/slackbot-sample/install-app.png)
3. **Install the app in your workspace:** You'll need to install the app in your workspace for it to work. Click the "Install to Workspace" button in the Slack admin UI to do this. Mine says "Reinstall" because I've already installed it.
![screenshot of the slack admin UI showing the install button](/img/slackbot-sample/install-app.png)

4. **Copy the Bot User OAuth Access Token:** This token will authenticate your Slackbot with the Slack API.
![screenshot of the slack admin UI showing the auth token field](/img/slackbot-sample/token.png)
4. **Copy the Bot User OAuth Access Token:** This token will authenticate your Slackbot with the Slack API.
![screenshot of the slack admin UI showing the auth token field](/img/slackbot-sample/token.png)

5. **Invite the Bot to a Channel:** To enable your Slackbot, invite it to the desired channel using the `@<botname>` command. In the screenshot below, my bot's name actually starts with the word invite, but if your bot is called `mycoolbot` you would invite it with `@mycoolbot`. This ensures your Slackbot has the required permissions to interact with the channel.
![screenshot of the slack chat UI showing me inviting my bot](/img/slackbot-sample/invite.png)
5. **Invite the Bot to a Channel:** To enable your Slackbot, invite it to the desired channel using the `@<botname>` command. In the screenshot below, my bot's name actually starts with the word invite, but if your bot is called `mycoolbot` you would invite it with `@mycoolbot`. This ensures your Slackbot has the required permissions to interact with the channel.
![screenshot of the slack chat UI showing me inviting my bot](/img/slackbot-sample/invite.png)

6. **Clone the Sample Code:** Clone the Defang repository and navigate to the `samples/golang/slackbot` directory. This directory contains the sample code for the Slackbot.
6. **Clone the Sample Code:** Clone the Defang repository and navigate to the `samples/golang/slackbot` directory. This directory contains the sample code for the Slackbot.

```bash
git clone https://github.com/DefangLabs/defang
Expand All @@ -44,9 +45,10 @@ Now that we have everything set up, let's dive into the deployment process. Foll
defang config set --name SLACK_CHANNEL_ID --value your_slack_channel_id
```

2. **Deploy the Slackbot:** Use the Defang CLI's `defang compose up` command to deploy.
2. **Deploy the Slackbot:** Use the Defang CLI's `defang compose up` command to deploy.

## Usage

With your Slackbot up and running, let's explore how to make the most of it. Let's send a POST request to the `/` endpoint with a JSON body containing the message you want to post to the Slack channel. Popular tools like cURL or Postman can help you send the request:

```bash
Expand All @@ -56,4 +58,5 @@ curl 'https://raphaeltm-bot--8080.prod1.defang.dev/' \
```

## Takeaways

Congratulations! You've successfully deployed a Slackbot using Defang. If you deployed this as an internal service, you could use it to send status updates, alerts, or other important messages to your team. The possibilities are endless!
16 changes: 10 additions & 6 deletions blog/2024-05-01-may-product-updates.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ authors: defang_team
Hey folks! There is a lot going on at Defang and we're excited to share our latest product updates with you. Over the last month, we've been working hard to improve the Defang system and make it even easier for you to deploy your applications. Here's a quick overview of what we've been up to:

{/* truncate */}

## npx defang

We know a lot of you are using Defang for the first time. To make it easier to get started, we've added a new way to install the Defang CLI. Now you can use npx to run the CLI without installing it globally by running:
Expand All @@ -26,17 +27,20 @@ Previously you could bring your own domain with <a href="/docs/concepts/defang-b
## Windows Support

Some of you use Defang from a Windows PC and previously a few features didn't work correctly on Windows. Some stuff we've fixed:
* ansi color codes in logs
* handle ctrl-c when tailing logs

- ansi color codes in logs
- handle ctrl-c when tailing logs

## Improved CLI

We've made a variety of small tweaks and improvements to the CLI which should make things a little bit cleaner and more stable.
* log messages have been made more clear
* adding more progress information during compose up

- log messages have been made more clear
- adding more progress information during compose up

## Stability and Reliability

Defang is still in Beta and we know we've got to be rock solid by the time we release V1, so we've been working hard to improve the stability and reliability of the Defang architecture. We've been battle-testing different technologies to see how they hold up and have mad a few changes that should make things even better:
* capacity improvements in build queues
* improvements in log availability

- capacity improvements in build queues
- improvements in log availability
24 changes: 18 additions & 6 deletions blog/2024-06-01-june-product-updates.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
---
title: May 2024 Defang Compose Update
tags: [Cloud, NoDevOps, BYOC, Playground, Load Testing, ACME, Managed Redis, Kaniko, Postgres, ECS, Defang Compose Update]
tags:
[
Cloud,
NoDevOps,
BYOC,
Playground,
Load Testing,
ACME,
Managed Redis,
Kaniko,
Postgres,
ECS,
Defang Compose Update,
]
authors: defang_team
---

![Defang Compose Update](/img/defang-compose-update.webp)

Hey folks! We're back with another exciting update about Defang. Our team has been working hard to bring you new features and improvements so you can get deploying faster. Here's a rundown of what we've been up to this month:


{/* truncate */}

## Samples, samples, samples!

We've been cranking out samples like there's no tomorrow. We've published samples to get you up and running with FastAPI, Elysia, Angular, React, Svelte, Sveltekit, Sails.js, Phoenix, and more. You can filter through them on the [Defang homepage](https://defang.io/#deploy). Check out our video about all the [new samples and functionality](https://www.youtube.com/watch?v=8wIU_af-sX8).
Expand All @@ -24,7 +37,6 @@ If you look through our [GitHub organization](https://github.com/DefangLabs), yo

![screenshot of github UI pointing towards template button](https://github.com/DefangLabs/defang-docs/assets/910895/97d33d90-43b9-499a-b139-e114b701adcb)


Not only will that create a new repo based on the sample in your account, but if you've used Defang before (and accepted the Terms and Conditions) it will automatically deploy it to the playground so you can start playing with Defang immediately.

## ACME for BYOD
Expand All @@ -33,13 +45,13 @@ We’re excited to announce that ACME support is now available for Bring Your Ow

## Warnings for Stateful Services

To help you avoid potential pitfalls, we’ve added warnings against deploying stateful services with Defang, since you shouldn't actually be deploying anything stateful with Defang. For example, we'll warn you if you try to deploy services with images like `postgres:<version>`, `redis:<version>`, `minio:<version>`, etc.
To help you avoid potential pitfalls, we’ve added warnings against deploying stateful services with Defang, since you shouldn't actually be deploying anything stateful with Defang. For example, we'll warn you if you try to deploy services with images like `postgres:<version>`, `redis:<version>`, `minio:<version>`, etc.

In the near future we will be offering ways to run some stateful services using cloud providers' managed offerings. For example Redis, Postgres, and S3. Speaking of which...

## Managed Redis!

Redis is such a versatile tool that can help with so many different use cases. So we've introduced Managed Redis! You can now specify the Redis image in your `compose.yaml` file and indicate that you want it managed by your cloud provider using `x-defang-redis: true` in your service definition.
Redis is such a versatile tool that can help with so many different use cases. So we've introduced Managed Redis! You can now specify the Redis image in your `compose.yaml` file and indicate that you want it managed by your cloud provider using `x-defang-redis: true` in your service definition.

## Load Testing

Expand All @@ -59,7 +71,7 @@ Building on the momentum of Managed Redis, we’re introducing Managed Postgres.

### BYOC ECS Lifecycle Events

Defang runs your services with ECS, and we're working on making it clearer what's happening under the hood.
Defang runs your services with ECS, and we're working on making it clearer what's happening under the hood.

---

Expand Down
32 changes: 17 additions & 15 deletions blog/2024-07-01-july-product-updates.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: June 2024 Defang Compose Update
tags: [Cloud, NoDevOps, BYOC, Windows, Managed Redis, CLI, Defang Compose Update]
tags:
[Cloud, NoDevOps, BYOC, Windows, Managed Redis, CLI, Defang Compose Update]
authors: defang_team
---

Expand All @@ -9,12 +10,13 @@ authors: defang_team
Hey folks! We've got another batch of updates to share with you about what the Defang team has been working on over the past month. We're committed to improving your deployment experience, so let's take a look at what's new.

{/* truncate */}

## Windows Experience Improvements

For our Windows users out there, we've made some changes to make your Defang experience even smoother:

* You can now install Defang using `winget`, the Windows Package Manager, for a streamlined setup
* We've introduced a signed binary for added security and peace of mind
- You can now install Defang using `winget`, the Windows Package Manager, for a streamlined setup
- We've introduced a signed binary for added security and peace of mind

Deploying your apps from Windows just got a little bit nicer.

Expand All @@ -34,34 +36,34 @@ We first introduced this last month, but we've since rolled it out to everyone.

We've updated our sample projects to showcase how to use them with Defang, including:

* [ASP.NET Core](https://github.com/DefangSamples/sample-csharp-dotnet-template)
* [Feathers.js](https://github.com/DefangSamples/sample-feathersjs-template)
* [Flask & LangChain](https://github.com/DefangSamples/sample-langchain-template)
* [BullMQ with Redis](https://github.com/DefangSamples/sample-bullmq-bullboard-redis-template)
- [ASP.NET Core](https://github.com/DefangSamples/sample-csharp-dotnet-template)
- [Feathers.js](https://github.com/DefangSamples/sample-feathersjs-template)
- [Flask & LangChain](https://github.com/DefangSamples/sample-langchain-template)
- [BullMQ with Redis](https://github.com/DefangSamples/sample-bullmq-bullboard-redis-template)

Check them out if you're looking for some inspiration or a starting point for your own projects.

## CLI Updates

We're always looking for ways to enhance the CLI experience. Here's what's new:

* `npx defang` automatically checks to always have the latest version of the CLI
* The output during `defang compose up` has been streamlined to focus on the most important information
* `defang tail` now supports listening to specific services, making it easier to troubleshoot issues
* We've improved hints and error messages to better guide you when something goes wrong
* The CLI now has improved color support for light theme terminals, making it easier on the eyes
- `npx defang` automatically checks to always have the latest version of the CLI
- The output during `defang compose up` has been streamlined to focus on the most important information
- `defang tail` now supports listening to specific services, making it easier to troubleshoot issues
- We've improved hints and error messages to better guide you when something goes wrong
- The CLI now has improved color support for light theme terminals, making it easier on the eyes

It's the small refinements that can make a big difference in your workflow.

## Other Updates

Here are a few more things that didn't quite fit with the rest:

* Visibility into ECS deployment events in BYOC tail logs
* Improvements to ACME certificate generation
- Visibility into ECS deployment events in BYOC tail logs
- Improvements to ACME certificate generation

Keep an eye out for these updates in the near future.

---

As always, we'd love your help shaping the future of Defang, so let us know what you'd like to see next. Happy deploying! 🚀
As always, we'd love your help shaping the future of Defang, so let us know what you'd like to see next. Happy deploying! 🚀
Loading
Loading