Skip to main content

Samples

Check out our sample projects here to get some inspiration and get a sense of how defang works.

Basic Service

PythonNode.jsGolang

This sample shows you how to get started with Defang. It demonstrates how to deploy one of the most basic type of services you can run on Defang: a simple web server that returns the contents of the request.

AI-ML Music Recommendations

Python

An AI-driven music recommendation system. This example demonstrates how to request GPUs for your Defang services:

services:
service1:
deploy:
resources:
reservations:
devices:
- capabilities: ["gpu"]

AWS S3

PythonNode.jsGolang

This sample shows you how to upload and download files from AWS S3 using Defang. It demonstrates how to configure services that require secrets using the defang secrets set command.

ChatGPT API

PythonNode.jsGolang

This sample shows you how to build a simple service using the OpenAI Chat Completions API. It also demonstrates how to configure services that require secrets using the defang secrets set command.

Fetch and return JSON

PythonNode.jsGolang

This sample shows you how to build a basic service that interacts with and api and returns some JSON.

Webpage and Form Post

PythonNode.jsGolang

This sample shows you how to build a simple website with a form that posts to a backend service.