Samples
Angular & Node.js
This sample demonstrates how to deploy a full-stack Angular and Node.js application with Defang. It uses Socket.IO for real-time communication. The Docker setup ensures the app can be easily built and deployed.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
- Install Node.js
- Install Angular CLI
Development
For development, we use two local containers, one for the frontend Angular service and one for the backend service in Express. It also uses Caddy as a web server for serving static files.
To run the application locally, you can use the following command:
docker compose -f compose.dev.yaml up --build
Configuration
For this sample, you will not need to provide configuration.
If you wish to provide configuration, see below for an example of setting a configuration for a value named API_KEY
.
defang config set API_KEY
Deployment
[!NOTE] Download Defang CLI
Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
BYOC (AWS)
If you want to deploy to your own cloud account, you can use Defang BYOC:
- Authenticate your AWS account, and check that you have properly set your environment variables like
AWS_PROFILE
,AWS_REGION
,AWS_ACCESS_KEY_ID
, andAWS_SECRET_ACCESS_KEY
. - Run in a terminal that has access to your AWS environment variables:
defang --provider=aws compose up
Title: Angular & Node.js
Short Description: A full-stack application using Angular for the frontend and Node.js with Socket.IO for the backend, containerized with Docker.
Tags: Angular, Node.js, Socket.IO, TypeScript, JavaScript
Languages: nodejs
Arduino Flask Wifi Server
This sample contains an interactive wifi-connected UI program for a SenseCAP Indicator Device, built for an Embedded Systems project at Defang Software Labs.
The device has a square liquid-crystal touch screen display, and a ESP32-S3 chip that can be programmed in an Arduino environment.
The program welcome.ino
, acting as a client, pings data every 5 seconds after it is connected to a wifi network. It uses a library called ArduinoHTTPClient. It is also recommended to use Arduino IDE when coding with .ino
files. The program UI will display a message that is randomized in color and location on the screen at the same time during pings (every 5 seconds).
The Flask server in web_server.py
receives these pings when it is initialized and connected to the same wifi network as the client. To initalize it, run python web_server.py
. To view it, open localhost
with the port number used. To deploy it to the cloud, run defang up
in the \welcome
directory.
A helpful file called serial_reader.py
decodes serial monitor readings to a readable format, allowing you to see Serial.println()
messages in real time when running. To initalize it, run python serial_reader.py
and see it show up in the terminal.
Here is a diagram showing the structure of the application.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
Development
To run the application locally, you can use the following command:
docker compose up --build
Configuration
For this sample, you will not need to provide configuration.
If you wish to provide configuration, see below for an example of setting a configuration for a value named API_KEY
.
defang config set API_KEY
Deployment
[!NOTE] Download Defang CLI
Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
BYOC
If you want to deploy to your own cloud account, you can use Defang BYOC.
Title: Arduino Flask Wifi Server
Short Description: An Arduino wifi server built with Flask.
Tags: Arduino, Flask, Python, IoT, Wifi, Serial
Languages: python
BullMQ & BullBoard & Redis
This sample demonstrates how to deploy a BullMQ message queue on top of managed Redis with a queue processor and a dashboard to monitor the queue.
Once your app is up and running you can go to the /board
route for the board
service to see the Bull Board dashboard and use the username admin
and the board password you set to log in (see Configuration).
To add a job to the queue, you can go to the /add
route of the api
service. This will use some default values so you can test things out. You can also see an example of a post request in the sample HTTP request file.
The worker
service is the queue processor that will process the jobs added to the queue. You can see in the compose.yaml
file that the worker
service is set to scale to 2 instances. This means that there will be 2 workers processing jobs from the queue. You can set this to your desired number of workers, but we wanted to show how you can increase the number of workers to handle more jobs.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
Development
To run the application locally, you can use the following command:
docker compose -f compose.dev.yaml up --build
Configuration
For this sample, you will need to provide the following configuration:
Note that if you are using the 1-click deploy option, you can set these values as secrets in your GitHub repository and the action will automatically deploy them for you.
BOARD_PASSWORD
Set a board password and use together with the board username admin
when signing in.
defang config set BOARD_PASSWORD
QUEUE
defang config set QUEUE
Deployment
[!NOTE] Download Defang CLI
Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
BYOC (AWS)
If you want to deploy to your own cloud account, you can use Defang BYOC:
- Authenticate your AWS account, and check that you have properly set your environment variables like
AWS_PROFILE
,AWS_REGION
,AWS_ACCESS_KEY_ID
, andAWS_SECRET_ACCESS_KEY
. - Run in a terminal that has access to your AWS environment variables:
defang --provider=aws compose up
Title: BullMQ & BullBoard & Redis
Short Description: A sample project with BullMQ, BullBoard, and Redis.
Tags: BullMQ, BullBoard, Redis, Express, Node.js, Message Queue, JavaScript
Languages: nodejs
Crew.ai Django Sample
This sample shows how to use Crew.ai with a Django application. It provides a simple web interface that allows users to input text and receive a summary of the text in real-time using Django Channels with a Redis broker. It uses Celery to handle the Crew.ai tasks in the background with Redis as a broker. It uses Postgres as the database for Django.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
Development
To run the application locally, you can use the following command:
docker compose -f ./compose.local.yaml up --build
Configuration
For this sample, you will need to provide the following configuration:
Note that if you are using the 1-click deploy option, you can set these values as secrets in your GitHub repository and the action will automatically deploy them for you.
POSTGRES_PASSWORD
The password for the Postgres database.
defang config set POSTGRES_PASSWORD
SSL_MODE
The SSL mode for the Postgres database.
defang config set SSL_MODE
DJANGO_SECRET_KEY
The secret key for the Django application.
defang config set DJANGO_SECRET_KEY
Deployment
[!NOTE] Download Defang CLI
Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
BYOC
If you want to deploy to your own cloud account, you can use Defang BYOC.
Title: Crew.ai Django Sample
Short Description: A sample application that uses Crew.ai to summarize text in a background task, streamed to the user in real-time.
Tags: Django, Celery, Redis, Postgres, AI, ML
Languages: Python
C# & ASP.NET Core
This sample project is a simple task manager application using ASP.NET Core for the backend and JavaScript for client-side component rendering.
It showcases how you could deploy a full-stack application with ASP.NET Core and JavaScript using Defang. The Docker setup ensures the app can be easily built and tested during development.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
- Install ASP.NET Core
Development
For development, we use two local containers, one for the frontend service and one for the backend service in ASP.NET Core. It also uses Caddy as a web server for serving static files.
To run the application locally, you can use the following command:
docker compose -f compose.dev.yaml up --build
Configuration
For this sample, you will not need to provide configuration.
If you wish to provide configuration, see below for an example of setting a configuration for a value named API_KEY
.
defang config set API_KEY
Deployment
[!NOTE] Download Defang CLI
Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
BYOC (AWS)
If you want to deploy to your own cloud account, you can use Defang BYOC:
- Authenticate your AWS account, and check that you have properly set your environment variables like
AWS_PROFILE
,AWS_REGION
,AWS_ACCESS_KEY_ID
, andAWS_SECRET_ACCESS_KEY
. - Run in a terminal that has access to your AWS environment variables:
defang --provider=aws compose up
Title: C# & ASP.NET Core
Short Description: A simple task manager application using C# and ASP.NET Core.
Tags: ASP.NET Core, JavaScript, C#
Languages: C#
Django
This sample is a simple Django to-do app that uses SQLite as the database, which will be reset every time you deploy. It is not production-ready. For production use cases, you should check out the Django + Postgres sample.
The app includes a management command which is run on startup to create a superuser with the username admin
and password admin
. This means you can login to the admin interface at /admin/
and see the Django admin interface without any additional steps. The example_app
is already registered and the Todo
model is already set up to be managed in the admin interface.
The Dockerfile and compose files are already set up for you and are ready to be deployed. Serving is done using Gunicorn and uses WhiteNoise for static files. The CSRF_TRUSTED_ORIGINS
setting is configured to allow the app to run on a defang.dev
subdomain.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
Development
To run the application locally, you can use the following command:
docker compose up --build
Configuration
For this sample, you will not need to provide configuration.
If you wish to provide configuration, see below for an example of setting a configuration for a value named API_KEY
.
defang config set API_KEY
Deployment
[!NOTE] Download Defang CLI
Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
BYOC (AWS)
If you want to deploy to your own cloud account, you can use Defang BYOC:
- Authenticate your AWS account, and check that you have properly set your environment variables like
AWS_PROFILE
,AWS_REGION
,AWS_ACCESS_KEY_ID
, andAWS_SECRET_ACCESS_KEY
. - Make sure to update the
CSRF_TRUSTED_ORIGINS
setting in thesettings.py
file to include an appropriate domain. - Run in a terminal that has access to your AWS environment variables:
defang --provider=aws compose up
Title: Django
Short Description: A simple Django app that uses SQLite as the database.
Tags: Django, SQLite, Python
Languages: python
Django Celery
This is a sample Django application that uses Celery for background tasks. It uses Postgres as the database and Redis as the message broker.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
Development
To run the application locally, you can use the following command:
docker compose -f compose.dev.yaml up --build
Configuration
For this sample, you will need to provide the following configuration:
Note that if you are using the 1-click deploy option, you can set these values as secrets in your GitHub repository and the action will automatically deploy them for you.
POSTGRES_PASSWORD
The password for the Postgres database.
defang config set POSTGRES_PASSWORD
SECRET_KEY
The secret key for the Django application.
defang config set SECRET_KEY
Deployment
[!NOTE] Download Defang CLI
Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
BYOC
If you want to deploy to your own cloud account, you can use Defang BYOC.
Title: Django Celery
Short Description: A Django application that uses Celery for background tasks, Postgres as the database, and Redis as the message broker.
Tags: Django, Celery, Postgres, Redis
Languages: python, sql
Django Channels & Redis & Postgres
This sample demonstrates how to get Django Channels up and running with Redis and Postgres both managed by Defang. It demonstrates how to do this with a simple chat application.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticated with your AWS account
- (Optional for local development) Docker CLI
Development
To run the application locally, you can use the following command:
docker compose -f compose.dev.yaml up
This will start the Django server, Redis, and Postgres and mounts your Django app so you get live reloading. You can access the Django server at http://localhost:8000
.
Configuration
For this sample, you will need to provide the following configuration. Note that if you are using the 1-click deploy option, you can set these values as secrets in your GitHub repository and the action will automatically deploy them for you.
SECRET_KEY
The secret key for your Django application. You can generate a new one by running python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'
. A default, insecure key is used if this is not set, but you should set it for a production deployment.
POSTGRES_PASSWORD
The password for your Postgres database. You need to set this before deploying for the first time.
Deploying
- Open the terminal and type
defang login
- Use the
defang config
command to setup environment variables. - Type
defang compose up
in the CLI. - Your app will be running within a few minutes.
Title: Django Channels & Redis & Postgres
Short Description: A basic configuration of Django Channels with Redis and Postgres demonstrating a simple chat application.
Tags: Django, Channels, Redis, Postgres, Chat, Application
Languages: Python
Django & Postgres
This template is a customer relationship management list project developed using Python Django framework, offering a starting point to help you quickly build your customer management system. We use PostgreSQL as the database. We have prepared all the essential files for deployment. By spending less than 10 minutes setting up the environment, as detailed in the prerequisites, and executing the commands in our step-by-step guide, your website will be ready to go live to the world!
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
Development
To run the application locally, you can use the following command:
docker compose up --build
Configuration
For this sample, you will need to provide the following configuration:
Note that if you are using the 1-click deploy option, you can set these values as secrets in your GitHub repository and the action will automatically deploy them for you.
POSTGRES_PASSWORD
The password for the PostgreSQL database.
defang config set POSTGRES_PASSWORD
SECRET_KEY
The secret key is used to secure the Django application.
defang config set SECRET_KEY
ALLOWED_HOSTS
The allowed hosts for the Django application. (i.e. the domain your app runs on)
defang config set ALLOWED_HOSTS
Deployment
[!NOTE] Download Defang CLI
Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
BYOC (AWS)
If you want to deploy to your own cloud account, you can use Defang BYOC:
- Authenticate your AWS account, and check that you have properly set your environment variables like
AWS_PROFILE
,AWS_REGION
,AWS_ACCESS_KEY_ID
, andAWS_SECRET_ACCESS_KEY
. - Run in a terminal that has access to your AWS environment variables:
defang --provider=aws compose up
Title: Django & PostgreSQL
Short Description: A customer relationship management list project developed using the Python Django framework, offering a starting point to help you quickly build your customer management system.
Tags: Django, PostgreSQL, Python, SQL
Languages: python
Elysia & Bun
A basic Elysia app running on Bun with a Dockerfile and compose.yaml ready to deploy to AWS with Defang.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
Development
To run the application locally, you can use the following command:
docker compose -f compose.dev.yaml up --build
Configuration
For this sample, you will not need to provide configuration.
If you wish to provide configuration, see below for an example of setting a configuration for a value named API_KEY
.
defang config set API_KEY
Deployment
[!NOTE] Download Defang CLI
Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
BYOC (AWS)
If you want to deploy to your own cloud account, you can use Defang BYOC:
- Authenticate your AWS account, and check that you have properly set your environment variables like
AWS_PROFILE
,AWS_REGION
,AWS_ACCESS_KEY_ID
, andAWS_SECRET_ACCESS_KEY
. - Run in a terminal that has access to your AWS environment variables:
defang --provider=aws compose up
Title: Elysia & Bun
Short Description: A basic Elysia app running on Bun with Defang.
Tags: Bun, Elysia, TypeScript, JavaScript
Languages: nodejs
FastAPI
This sample project demonstrates how to deploy FastAPI with Defang.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
Development
To run the application locally, you can use the following command:
docker compose -f compose.yaml -f compose.dev.yaml up --build
Configuration
For this sample, you will not need to provide configuration.
If you wish to provide configuration, see below for an example of setting a configuration for a value named API_KEY
.
defang config set API_KEY
Deployment
[!NOTE] Download Defang CLI
Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
BYOC (AWS)
If you want to deploy to your own cloud account, you can use Defang BYOC:
- Authenticate your AWS account, and check that you have properly set your environment variables like
AWS_PROFILE
,AWS_REGION
,AWS_ACCESS_KEY_ID
, andAWS_SECRET_ACCESS_KEY
. - Run in a terminal that has access to your AWS environment variables:
defang --provider=aws compose up
Title: FastAPI
Short Description: A sample project demonstrating how to deploy FastAPI with Defang.
Tags: FastAPI, OpenAPI, Python
Languages: python
FastAPI & PostgreSQL
This sample project demonstrates how to deploy FastAPI with PostgreSQL with Defang.
Prerequisites
- Download Defang CLI
- (optional) If you are using Defang BYOC, make sure you have properly authenticated your AWS account.
Development
To run the development container(s) locally, do:
docker compose -f compose.dev.yaml up --build
Or to run the production container(s) locally, do:
POSTGRES_PASSWORD=postgres docker compose up --build
Configuration
For this sample, you will need to provide the following configuration:
Note that if you are using the 1-click deploy option, you can set these values as secrets in your GitHub repository and the action will automatically deploy them for you.
POSTGRES_PASSWORD
defang config set POSTGRES_PASSWORD
Deployment
[!NOTE] Download Defang CLI
Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
BYOC (AWS)
If you want to deploy to your own cloud account, you can use Defang BYOC:
- Authenticate your AWS account, and check that you have properly set your environment variables like
AWS_PROFILE
,AWS_REGION
,AWS_ACCESS_KEY_ID
, andAWS_SECRET_ACCESS_KEY
. - Run in a terminal that has access to your AWS environment variables:
defang --provider=aws compose up
Title: FastAPI & PostgreSQL
Short Description: A sample project with FastAPI and PostgreSQL.
Tags: FastAPI, PostgreSQL, Python, SQL
Languages: python
Feathers.js
This sample project demonstrates how to deploy a FeathersJS application on to AWS using Defang. We also demonstrate how to run the application in both development and production environments using Docker Compose.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
- (Optional - for local development) Node.js
Development
For development, we use Docker to containerize the FeathersJS application. The Docker Compose configuration is defined in the compose.dev.yaml
file.
To run the application locally, you can use the following command:
docker compose -f compose.dev.yaml up --build
Configuration
For this sample, you will not need to provide configuration.
If you wish to provide configuration, see below for an example of setting a configuration for a value named API_KEY
.
defang config set API_KEY
Deployment
[!NOTE] Download Defang CLI
Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
BYOC (AWS)
If you want to deploy to your own cloud account, you can use Defang BYOC:
- Authenticate your AWS account, and check that you have properly set your environment variables like
AWS_PROFILE
,AWS_REGION
,AWS_ACCESS_KEY_ID
, andAWS_SECRET_ACCESS_KEY
. - Run in a terminal that has access to your AWS environment variables:
defang --provider=aws compose up
Title: Feathers.js
Short Description: A sample project demonstrating how to deploy a Feathers.js application using Defang. The application displays "DefangxFeathersjs" on the webpage.
Tags: Feathers.js, Node.js, JavaScript
Languages: nodejs
Flask
This is a basic Flask to-do app that can be deployed with Defang. Note that alongside your .py
file, include a requirements.txt
so that the Dockerfile can install the necessary packages with pip.
This project is intended to provide a basic understanding of how to get started with Flask on Defang. The items are stored in memory and are lost when the server is restarted. It is not intended for production use. If you need something production ready, you should use a managed database like Postgres or MySQL.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
Development
To run the application locally, you can use the following command:
docker compose up --build
Configuration
For this sample, you will not need to provide configuration.
If you wish to provide configuration, see below for an example of setting a configuration for a value named API_KEY
.
defang config set API_KEY
Deployment
[!NOTE] Download Defang CLI
Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
BYOC (AWS)
If you want to deploy to your own cloud account, you can use Defang BYOC:
- Authenticate your AWS account, and check that you have properly set your environment variables like
AWS_PROFILE
,AWS_REGION
,AWS_ACCESS_KEY_ID
, andAWS_SECRET_ACCESS_KEY
. - Run in a terminal that has access to your AWS environment variables:
defang --provider=aws compose up
Title: Flask
Short Description: A basic Flask to-do app.
Tags: Flask, Python
Languages: python
Go HTTP Server
A very simple example of a Go service that listens on a port and returns information about the request.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
Development
To run the application locally, you can use the following command:
docker compose up --build
Configuration
For this sample, you will not need to provide configuration.
If you wish to provide configuration, see below for an example of setting a configuration for a value named API_KEY
.
defang config set API_KEY
Deployment
[!NOTE] Download Defang CLI
Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
BYOC (AWS)
If you want to deploy to your own cloud account, you can use Defang BYOC:
- Authenticate your AWS account, and check that you have properly set your environment variables like
AWS_PROFILE
,AWS_REGION
,AWS_ACCESS_KEY_ID
, andAWS_SECRET_ACCESS_KEY
. - Run in a terminal that has access to your AWS environment variables:
defang --provider=aws compose up
Title: Go HTTP Server
Short Description: A simple Go application that echoes back the request.
Tags: Go, HTTP
Languages: golang
Go HTTP Form
This Go application demonstrates a simple form submission using the standard net/http library. Users can input their first name into a form, and upon submission, they will be greeted personally by the application.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
Development
To run the application locally, you can use the following command:
docker compose up --build
Configuration
For this sample, you will not need to provide configuration.
If you wish to provide configuration, see below for an example of setting a configuration for a value named API_KEY
.
defang config set API_KEY
Deployment
[!NOTE] Download Defang CLI
Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
BYOC (AWS)
If you want to deploy to your own cloud account, you can use Defang BYOC:
- Authenticate your AWS account, and check that you have properly set your environment variables like
AWS_PROFILE
,AWS_REGION
,AWS_ACCESS_KEY_ID
, andAWS_SECRET_ACCESS_KEY
. - Run in a terminal that has access to your AWS environment variables:
defang --provider=aws compose up
Title: Go HTTP Form
Short Description: A simple Go application that demonstrates form submission using the net/http library.
Tags: Go, HTTP
Languages: golang
Go & MongoDB
This sample is a task manager application that uses Go and MongoDB, deployed with Defang.
HTML and JavaScript are used for the frontend to interact with the backend via API calls. There is a go.mod
file that includes dependencies for the Dockerfile to install.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
Development
To run the application locally, you can use the following command:
docker compose up --build
Configuration
For this sample, you will need to provide the following configuration:
Note that if you are using the 1-click deploy option, you can set these values as secrets in your GitHub repository and the action will automatically deploy them for you.
MONGO_INITDB_ROOT_USERNAME
The username for the MongoDB database.
defang config set MONGO_INITDB_ROOT_USERNAME
MONGO_INITDB_ROOT_PASSWORD
The password for the MongoDB database.
defang config set MONGO_INITDB_ROOT_PASSWORD
Using MongoDB Atlas
If you want to use MongoDB Atlas, you can set the URI with defang config set MONGO_URI
and remove the value from the MONGO_URI
environment variable so that it is read from defang config. For example, in your compose.yaml
file:
services:
app:
environment:
- MONGO_URI # empty values are read from defang config
Using DocumentDB in AWS
If you want to use DocumentDB in AWS, you can add the x-defang-mongodb
extension to your compose.yaml
file:
services:
db:
x-defang-mongodb: true
This will automatically provision a DocumentDB cluster in your AWS account.
Deployment
[!NOTE] Download Defang CLI
Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
BYOC (AWS)
If you want to deploy to your own cloud account, you can use Defang BYOC:
- Authenticate your AWS account, and check that you have properly set your environment variables like
AWS_PROFILE
,AWS_REGION
,AWS_ACCESS_KEY_ID
, andAWS_SECRET_ACCESS_KEY
. - Run in a terminal that has access to your AWS environment variables:
defang --provider=aws compose up
Title: Go & MongoDB
Short Description: A simple Go application that manages tasks with MongoDB.
Tags: Go, MongoDB, Atlas, Task Manager
Languages: golang
Golang & OpenAI
This sample demonstrates how to deploy a Go project with OpenAI using Defang.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
Development
To run the application locally, you can use the following command:
docker compose up --build
Configuration
For this sample, you will need to provide the following configuration:
Note that if you are using the 1-click deploy option, you can set these values as secrets in your GitHub repository and the action will automatically deploy them for you.
OPENAI_KEY
An API key to access the OpenAI API.
defang config set --name OPENAI_KEY
Testing
Below are some useful commands for testing.
echo "Hello" | curl -H "Content-Type: application/text" -d @- https://xxxxxxxx/prompt
or alternatively,
cat prompt.txt | curl -H "Content-Type: application/text" -d @- https://xxxxxxxx/prompt
Deployment
[!NOTE] Download Defang CLI
Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
BYOC (AWS)
If you want to deploy to your own cloud account, you can use Defang BYOC:
- Authenticate your AWS account, and check that you have properly set your environment variables like
AWS_PROFILE
,AWS_REGION
,AWS_ACCESS_KEY_ID
, andAWS_SECRET_ACCESS_KEY
. - Run in a terminal that has access to your AWS environment variables:
defang --provider=aws compose up
Title: Go & OpenAI
Short Description: A simple Go application that interacts with the OpenAI API.
Tags: Go, OpenAI, ChatGPT
Languages: golang
Go & REST API
This sample shows a Go HTTP server that uses a REST API to fetch data, deployed using Defang.
It serves two endpoints: /
and /rates
. The /
endpoint responds with a JSON object containing the status, while the /rates
endpoint fetches data from the Fiscal Data Treasury API and returns the response to the client.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
Development
To run the application locally, you can use the following command:
docker compose up --build
Configuration
For this sample, you will not need to provide configuration.
If you wish to provide configuration, see below for an example of setting a configuration for a value named API_KEY
.
defang config set API_KEY
Deployment
[!NOTE] Download Defang CLI
Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
BYOC (AWS)
If you want to deploy to your own cloud account, you can use Defang BYOC:
- Authenticate your AWS account, and check that you have properly set your environment variables like
AWS_PROFILE
,AWS_REGION
,AWS_ACCESS_KEY_ID
, andAWS_SECRET_ACCESS_KEY
. - Run in a terminal that has access to your AWS environment variables:
defang --provider=aws compose up
Title: Go & REST API
Short Description: A simple Go application that fetches fiscal data from an API.
Tags: Go, HTTP, Fiscal Data, REST API
Languages: golang
Go & S3
This sample shows a simple Go application that uploads and downloads files from AWS S3, deployed with Defang.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
Development
To run the application locally, you can use the following command:
docker compose up --build
Configuration
For this sample, you will need to provide the following configuration:
Note that if you are using the 1-click deploy option, you can set these values as secrets in your GitHub repository and the action will automatically deploy them for you.
AWS_ACCESS_KEY
An AWS access key to use S3.
defang config set --name AWS_ACCESS_KEY
AWS_SECRET_KEY
An AWS secret key to use S3.
defang config set --name AWS_SECRET_KEY
Testing
Below is a useful command for testing.
curl -X POST -H 'Content-Type: application/json' -d '{ "first_name" : "jane", "last_name" : "doe" }' https://xxxxxx/upload
curl https://xxxxxx/download
Deployment
[!NOTE] Download Defang CLI
Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
BYOC (AWS)
If you want to deploy to your own cloud account, you can use Defang BYOC:
- Authenticate your AWS account, and check that you have properly set your environment variables like
AWS_PROFILE
,AWS_REGION
,AWS_ACCESS_KEY_ID
, andAWS_SECRET_ACCESS_KEY
. - Run in a terminal that has access to your AWS environment variables:
defang --provider=aws compose up
Title: Go & S3
Short Description: A simple Go application that uploads and downloads files from AWS S3.
Tags: Go, S3, AWS
Languages: golang
Go & Slack API
This is a simple Slackbot that takes a request and posts the message from the body to a Slack channel.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
Slack API Token
You'll need to head to https://api.slack.com/apps to create a Slack App.
Make sure to:
- Give it the bot
chat:write
scope - Install the app to your workspace
- Copy the Bot User OAuth Access Token
- Invite your bot to the channel you want it to post to using the
@botname
command in the channel (this will allow you to invite it)
Development
To run the application locally, you can use the following command:
docker compose up --build
Configuration
For this sample, you will need to provide the following configuration:
Note that if you are using the 1-click deploy option, you can set these values as secrets in your GitHub repository and the action will automatically deploy them for you.
SLACK_TOKEN
This is the token you've copied previously for the Slack API.
defang config set SLACK_TOKEN
SLACK_CHANNEL_ID
This is the ID of the Slack channel where the bot will post messages.
defang config set SLACK_CHANNEL_ID
Deployment
[!NOTE] Download Defang CLI
Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
BYOC (AWS)
If you want to deploy to your own cloud account, you can use Defang BYOC:
- Authenticate your AWS account, and check that you have properly set your environment variables like
AWS_PROFILE
,AWS_REGION
,AWS_ACCESS_KEY_ID
, andAWS_SECRET_ACCESS_KEY
. - Run in a terminal that has access to your AWS environment variables:
defang --provider=aws compose up
Usage
Once the Slackbot is deployed, you can send a POST request to the /
endpoint with a JSON body containing the message you want to post to the Slack channel. Here's an example:
curl 'https://raphaeltm-bot--8080.prod1.defang.dev/' \
-H 'content-type: application/json' \
--data-raw $'{"message":"This is your bot speaking. We\'ll be landing in 10 minutes. Please fasten your seatbelts."}'
Title: Go & Slack API
Short Description: A simple Slackbot that posts messages to a Slack channel.
Tags: Go, Slack, Bot
Languages: golang
Hasura & PostgreSQL
This sample project demonstrates how to deploy Hasura with Defang and connect it to a Postgres database. We also demonstrate how to run a Postgres container during development and how to switch over to a managed postgres service like RDS, Neon, or others in production. If you want to get a compatible database ready to go really quickly for free, Neon is a quick and easy way to go. The sample populates the database with some sample data so you can quickly start playing with the Hasura console. It sets wide open permissions on the tables as well so you can start querying or mutating the data right away.
Prerequisites
- Download Defang CLI
- Have a managed database service configured and have the connection string ready.
- (Optional) If you are using Defang BYOC authenticated with your AWS account
- (Optional - for local development) Docker CLI
- (Optional) Install the Hasura CLI to create migrations and update metadata for your Hasura GraphQL api.
Development
For development, we use a Postgres container. The Postgres container is defined in the compose.dev.yaml
file. The Hasura container is defined in the compose.yaml
file, with some overrides in the compose.dev.yaml
file so it can correctly connect to the development database container.
To start the development environment, run docker compose -f ./compose.yaml -f ./compose.dev.yaml up
. This will start the Postgres container and the Hasura container. The Hasura console will be available at http://localhost:8080
with the password password
.
Note: If you want to make changes to your database, permissions, etc. you should use the Hasura console and the Hasura CLI to make those changes. See the next section for more information.
Editing the database/permissions etc.
If you want to edit the database, permissions, or any other Hasura settings such that you can deploy them to production, you should install the Hasura CLI. Then, after starting the development environment, you can run hasura console
inside the ./hasura
directory. This will open the Hasura console in your browser. Any changes you make in the console will be saved to the migrations
and metadata
directories. When you run defang compose up
these changes will be applied to the production environment.
Deploying
- Open the terminal and type
defang login
- Add your connection string as a defang config value by typing
defang config set HASURA_GRAPHQL_DATABASE_URL
and pasting your connection string (which should be in the formatpostgres://username:password@host:port/dbname
) - Setup a password for hasura by typing
defang config set HASURA_GRAPHQL_ADMIN_SECRET
and adding a password you would like to login with. - Type
defang compose up
in the CLI. - Your app will be running within a few minutes.
Title: Hasura & PostgreSQL
Short Description: A sample project demonstrating how to deploy Hasura with Defang and connect it to a PostgreSQL database.
Tags: Hasura, GraphQL, PostgreSQL, Database
Languages: SQL, GraphQL
HTML & CSS & JavaScript
This sample shows how to get a static HTML, CSS and JavaScript website up and running with Defang.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticated with your AWS account
- (Optional for local development) Docker CLI
Development
To run the application locally, you can use the following command:
docker compose up --build
Configuration
For this sample, you will not need to provide configuration.
If you wish to provide configuration, see below for an example of setting a configuration for a value named API_KEY
.
defang config set API_KEY
Deployment
[!NOTE] Download Defang CLI
Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
BYOC (AWS)
If you want to deploy to your own cloud account, you can use Defang BYOC:
- Authenticate your AWS account, and check that you have properly set your environment variables like
AWS_PROFILE
,AWS_REGION
,AWS_ACCESS_KEY_ID
, andAWS_SECRET_ACCESS_KEY
. - Run in a terminal that has access to your AWS environment variables:
defang --provider=aws compose up
Title: HTML & CSS & JavaScript
Short Description: A simple HTML, CSS and JavaScript website running on Defang.
Tags: HTML, CSS, JavaScript, Frontend
Languages: nodejs
Huginn
This sample shows how to deploy Huginn with Defang.
Huginn is a system for building agents that perform automated tasks for you online. Huginn's Agents can monitor the web, respond to events, and act on your behalf. They propagate events along a directed graph. It's like a customizable IFTTT or Zapier on your own server, ensuring data privacy.
Prerequisites
- Download Defang CLI
- Have a managed database service configured and ready, such as Neon PostgreSQL
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
Development
To run the application locally, you can use the following command:
docker compose -f ./compose.yaml -f ./compose.dev.yaml up
This will start the Postgres container and the Huginn container. Huginn will be available at http://localhost:3000
with the username admin
and password password
.
Configuration
For this sample, you will need to provide the following configuration:
Note that if you are using the 1-click deploy option, you can set these values as secrets in your GitHub repository and the action will automatically deploy them for you.
DATABASE_NAME
The name of the database.
defang config set DATABASE_NAME
DATABASE_USERNAME
The username used with the database.
defang config set DATABASE_USERNAME
DATABASE_PASSWORD
The password used with the database.
defang config set DATABASE_PASSWORD
DATABASE_HOST
The host of the database.
defang config set DATABASE_HOST
Deployment
[!NOTE] Download Defang CLI
Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
BYOC (AWS)
If you want to deploy to your own cloud account, you can use Defang BYOC:
- Authenticate your AWS account, and check that you have properly set your environment variables like
AWS_PROFILE
,AWS_REGION
,AWS_ACCESS_KEY_ID
, andAWS_SECRET_ACCESS_KEY
. - Run in a terminal that has access to your AWS environment variables:
defang --provider=aws compose up
Title: Huginn
Short Description: A system for building agents that perform automated tasks for you online.
Tags: Huginn, Agents, Automation
Languages: Dockerfile
ImgProxy
This sample shows how to deploy ImgProxy with Defang. ImgProxy is a fast and secure standalone server for resizing and converting remote images. It can be deployed using the official Docker image, as documented here.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
Development
To run the application locally, you can use the following command:
docker compose up --build
Configuration
For this sample, you will not need to provide configuration.
If you wish to provide configuration, see below for an example of setting a configuration for a value named API_KEY
.
defang config set API_KEY
Deployment
[!NOTE] Download Defang CLI
Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
BYOC (AWS)
If you want to deploy to your own cloud account, you can use Defang BYOC:
- Authenticate your AWS account, and check that you have properly set your environment variables like
AWS_PROFILE
,AWS_REGION
,AWS_ACCESS_KEY_ID
, andAWS_SECRET_ACCESS_KEY
. - Run in a terminal that has access to your AWS environment variables:
defang --provider=aws compose up
Title: ImgProxy
Short Description: A fast and secure standalone server for resizing and converting remote images
Tags: Imgproxy, Images, Server
Languages: N/A
Javalin Sample
This sample demonstrates how to deploy a very basic Javalin sample with Defang. The sample simply outputs "Defang x Javalin" on the webpage.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticated with your AWS account
- (Optional - for local development) Docker CLI
Deploying
- Open the terminal and type
defang login
- Type
defang compose up
in the CLI. - Your app will be running within a few minutes.
Development
For development, we use a local container. This can be seen in the compose.yaml file. To run the sample locally use the following command:
docker compose up --build
Title: Javalin
Short Description: A short hello world application demonstrating how to deploy Javalin onto Defang.
Tags: Javalin, Java, Maven
Languages: java
Langchain & Flask
This sample is an endpoint that tells programming jokes and shows how to deploy a flask app that uses Langchain on to AWS via Defang.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticated with your AWS account
- (Optional - for local development) Docker CLI
Deploying
- Open the terminal and type
defang login
- Set the environment variable
OPENAI_KEY
by typingdefang config set OPENAI_KEY
. - Type
defang compose up
in the CLI. - Your app will be running within a few minutes.
Development
For development, first clone the project and navigate to its directory. After such, please run the command
docker compose up --build
This will start a Docker container with the flask app which will display the result of the langchain prompt.
Title: LangChain & Flask
Short Description: A sample project demonstrating how to deploy LangChain with Flask on Defang.
Tags: LangChain, Flask, AI, Python
Languages: python
Managed LLM
This sample application demonstrates the use of OpenAI-compatible Managed LLMs (Large Language Models) with Defang.
Note: Using Docker Model Provider? See our Managed LLM with Docker Model Provider sample.
Using the Defang OpenAI Access Gateway, the feature x-defang-llm: true
enables you to use Managed LLMs on the Defang Playground or on platforms offered by BYOC providers (such as AWS Bedrock or GCP Vertex AI) with an OpenAI-compatible SDK.
This allows switching from OpenAI to the Managed LLMs on supported cloud platforms without modifying your application code.
You can configure the LLM_MODEL
and LLM_URL
for the LLM separately for local development and production environments.
- The
LLM_MODEL
is the LLM Model ID you are using. - The
LLM_URL
is the bridge that provides authenticated access to the LLM model.
Ensure you have enabled model access for the model you intend to use. To do this, you can check your AWS Bedrock model access or GCP Vertex AI model access.
To learn about available LLM models in Defang, please see our Model Mapping documentation.
For more about Managed LLMs in Defang, please see our Managed LLMs documentation.
Defang OpenAI Access Gateway
In the compose.yaml
file, the llm
service is used to route requests to the LLM API model. This is known as the Defang OpenAI Access Gateway.
The x-defang-llm
property on the llm
service must be set to true
in order to use the OpenAI Access Gateway when deploying with Defang.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
Development
To run the application locally, you can use the following command:
docker compose -f compose.local.yaml up --build
Deployment
[!NOTE] Download Defang CLI
Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
BYOC
If you want to deploy to your own cloud account, you can use Defang BYOC.
Title: Managed LLM
Short Description: An app using Managed LLMs with Defang's OpenAI Access Gateway.
Tags: LLM, OpenAI, Python, Bedrock, Vertex
Languages: Python
Managed LLM with Docker Model Provider
This sample application demonstrates using Managed LLMs with a Docker Model Provider, deployed with Defang.
Note: This version uses a Docker Model Provider for managing LLMs. For the version with Defang's OpenAI Access Gateway, please see our Managed LLM Sample instead.
The Docker Model Provider allows users to run LLMs locally using docker compose
. It is a service with provider:
in the compose.yaml
file.
Defang will transparently fixup your project to use AWS Bedrock or Google Cloud Vertex AI models during deployment.
You can configure the LLM_MODEL
and LLM_URL
for the LLM separately for local development and production environments.
- The
LLM_MODEL
is the LLM Model ID you are using. - The
LLM_URL
will be set by Docker and during deployment Defang will provide authenticated access to the LLM model in the cloud.
Ensure you have enabled model access for the model you intend to use. To do this, you can check your AWS Bedrock model access or GCP Vertex AI model access.
To learn about available LLM models in Defang, please see our Model Mapping documentation.
For more about Managed LLMs in Defang, please see our Managed LLMs documentation.
Docker Model Provider
In the compose.yaml
file, the llm
service will route requests to the LLM API model using a Docker Model Provider.
The x-defang-llm
property on the llm
service must be set to true
in order to use the Docker Model Provider when deploying with Defang.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
Development
To run the application locally, you can use the following command:
docker compose -f compose.local.yaml up --build
Deployment
[!NOTE] Download Defang CLI
Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
BYOC
If you want to deploy to your own cloud account, you can use Defang BYOC.
Title: Managed LLM with Docker Model Provider
Short Description: An app using Managed LLMs with a Docker Model Provider, deployed with Defang.
Tags: LLM, Python, Bedrock, Vertex, Docker Model Provider
Languages: Python
MCP
This is a sample of a Model Context Protocol (MCP) chatbot application built with Next.js, Python, and Anthropic Claude, deployed using Defang.
This example uses Docker's mcp/time
image as a base for the MCP Server (with MCP tools included), but it can be adapted to use any of the Docker MCP images.
How It Works
Service 1 (Web Server with UI)
The web server and UI are built in Next.js (see /service-1/src/app
). The web server includes a forwarding action to connect to the MCP Client.
Service 2 (MCP Client and MCP Server)
The MCP Client is written in Python and ran in a venv
virtual environment. The MCP server is provided by the Docker mcp/time
image. The MCP Server communicates with the MCP Client in a Quart app (i.e. Asynchronous Server Gateway Interface (ASGI) version of Flask) through the stdio
transport method, as seen in /service-2/main.py
. For more on MCP transport methods, see here.
Here's a breakdown of what happens when a user interacts with the UI:
- When a user submits a query to the chatbot, the browser sends a request to the Next.js web server.
- The Next.js web server will forward this request to the MCP Client via a REST endpoint.
- The MCP Client processes the request by interacting with the Anthropic (Claude) API and tools available through the MCP Server.
- Once the response is generated, it is sent back to the Next.js web server and displayed to the user in the UI.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
Development
To run the application locally, you can use the following command:
docker compose up --build
Configuration
For this sample, you will need to provide the following configuration:
Note that if you are using the 1-click deploy option, you can set these values as secrets in your GitHub repository and the action will automatically deploy them for you.
ANTHROPIC_API_KEY
An API key for accessing the Anthropic Claude API.
defang config set ANTHROPIC_API_KEY
Deployment
[!NOTE] Download Defang CLI
Defang Playground
Deploy your application to the Defang Playground by opening up your terminal and typing:
defang compose up
BYOC
If you want to deploy to your own cloud account, you can use Defang BYOC.
Title: Model Context Protocol (MCP) Chatbot
Short Description: An MCP (Model Context Protocol) chatbot assistant built with Next.js, Python, and Anthropic Claude.
Tags: MCP, Next.js, Python, Quart, Claude, AI, Anthropic, TypeScript, React, JavaScript
Languages: nodejs, python
Metabase & Postgres
Metabase is a simple and powerful analytics tool which lets anyone learn and make decisions from their company’s data. This sample demonstrates how to deploy Metabase with Defang. In development, we run a postgres container and in production, we use a managed postgres service. To build the sample, we used Neon, because of their simplicity and generous free tier.
Prerequisites
- Download Defang CLI
- Have a managed database service configured and have the connection details ready.
- (optional) If you are using Defang BYOC, make sure you have properly authenticated your AWS account.
Local
For development, we use a Postgres container. The Postgres container is defined in the compose.dev.yaml
file. The Metabase container is defined in the compose.yaml
file, with some overrides in the compose.dev.yaml
file so it can correctly connect to the development database container.
To start the development environment, run docker compose -f ./compose.yaml -f ./compose.dev.yaml up
. This will start the Postgres container and the Metabase container. Metabase will be available at http://localhost:3000
.
Since Metabase is a self contained application, there isn't an actual development process, but you can use the development environment to see how Metabase works.
Deploying
- Open the terminal and type
defang login
- Add your database connection details using
defang config
by typingdefang config set <CONFIG_VAL>
where<CONFIG_VAL>
is the each of the followingMB_DB_DBNAME
,MB_DB_HOST
,MB_DB_PORT
,MB_DB_USER
,MB_DB_PASS
(to set the database name, host, port, user, and password respectively). For exampledefang config set MB_DB_DBNAME
and pasting your database name. - Type
defang compose up
in the CLI. - Your app will be running within a few minutes.
Title: Metabase & PostgreSQL
Short Description: A simple Metabase configuration with a PostgreSQL database.
Tags: Metabase, PostgreSQL, Analytics, Database
Languages: SQL
Next.js
A basic Next.js app with a Dockerfile and compose.yaml ready to deploy to AWS with Defang.
Steps
- Install Defang
- Authenticate with Defang
- (optional) Authenticate with AWS
- Run
defang compose up
in the root of this project
Title: Next.js
Short Description: A basic Next.js app.
Tags: Next.js, React, Docker, Node.js, TypeScript, JavaScript
Languages: nodejs
Next.js Blog
This template is a starter project developed using Next.js designed to make it easy to launch a blog. It offers an excellent starting point to help you publish your content by simply modifying the MDX files included in _posts
directory. We have prepared all the necessary files for deployment. By spending just a few minutes setting up the environment, as detailed in the prerequisites, and executing the commands in our step-by-step guide, your website will be ready to go live in no time!
Essential Setup Files
- A Dockerfile to describe the basic image of your applications.
- A docker-compose file to define and run multi-container Docker applications.
- A .dockerignore file to comply with the size limit (10MB).
Prerequisite
- Download Defang CLI
- If you are using Defang BYOC, make sure you have properly authenticated your AWS account
Plus, make sure that you have properly set your environment variables like
AWS_PROFILE
,AWS_REGION
,AWS_ACCESS_KEY_ID
, andAWS_SECRET_ACCESS_KEY
.
A Step-by-Step Guide
- Edit your content in the
_posts
directory - Open the terminal and type
defang login
- Type
defang compose up
in the CLI - Now your application will be launched
Title: Next.js Blog
Short Description: A starter project developed using Next.js designed to make it easy to launch a blog.
Tags: Next.js, Blog, Node.js, React, MDX, TypeScript, JavaScript
Languages: nodejs
Next.js & Claude
This sample shows a Next.js and Claude application deployed using Defang. It uses Anthropic API for its chatbot functionality.
Prerequisites
- Download Defang CLI
- (Optional) If you are using Defang BYOC authenticate with your cloud provider account
- (Optional for local development) Docker CLI
Development
To run the application locally, you can use the following command:
docker compose -f compose.dev.yaml up --build