Skip to content

Latest commit

 

History

History
56 lines (35 loc) · 1.75 KB

File metadata and controls

56 lines (35 loc) · 1.75 KB

Next.js & OpenAI

1-click-deploy

This sample shows a Next.js and OpenAI application deployed using Defang. It uses the OpenAI API for its chatbot functionality.

Prerequisites

  1. Download Defang CLI
  2. (Optional) If you are using Defang BYOC authenticate with your cloud provider account
  3. (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.

OPENAI_API_KEY

An API key for Open AI.

defang config set OPENAI_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: Next.js & OpenAI

Short Description: A fun chatbot created with Next.js and OpenAI.

Tags: Next.js, TypeScript, React, JavaScript, Chatbot, OpenAI, AI

Languages: TypeScript