Skip to content
Merged
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
58 changes: 48 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,60 @@

# Next.js & GitHub Actions

[![1-click-deploy](https://defang.io/deploy-with-defang.png)](https://portal.defang.dev/redirect?url=https%3A%2F%2Fgithub.com%2Fnew%3Ftemplate_name%3Dsample-nextjs-github-actions-template%26template_owner%3DDefangSamples)

A basic Next.js app with a Dockerfile and docker-compose ready to deploy to AWS with [Defang](https://defang.io) with GitHub Actions configured for CI/CD.

## Steps
## Steps to Set Up

1. **Install Defang**
Run the following command to install Defang:
```
brew install DefangLabs/defang/defang
```

2. **Authenticate with Defang**
After installation, authenticate by running:
```
defang login
```

Follow the on-screen instructions and open the provided URL to complete authentication.

3. **Optional: Authenticate with AWS**
To authenticate with AWS, follow [this guide](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html).

4. **Set Up Environment Variables**
Copy the `.env.local.template` file and rename it to `.env.local`. Then fill the environment variables with the required values.

5. **Set up Authentication**
To setup Convex authentication, follow the steps in [this tutorial](https://labs.convex.dev/auth/config/oauth)
From this, you would get the necessary variables to fill up what is needed as indicated in the .env template.

1. [Install Defang](https://docs.defang.io/docs/getting-started/installing)
2. [Authenticate with Defang](https://docs.defang.io/docs/getting-started/authenticating)
3. (optional) [Authenticate with AWS](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html)
4. Run `defang compose up` in the root of this project
5. **Navigate to the Web Directory**
To ensure you're in the right project directory where the Next.js app is located, move to the `web` folder by running the command:
```
cd web
```
This step is important as it ensures you're in the correct location to install project dependencies in the next step.

---

Title: Next.js & GitHub Actions
6. **Install Dependencies**
Install all required dependencies by running:
```
npm install
```

Short Description: A basic Next.js app with a Dockerfile and docker-compose ready to deploy to AWS with Defang, with GitHub Actions configured for CI/CD.
7. **Run the Application**
Start the application by navigating to the project root and running:
```
npm run dev
```

Tags: Next.js, React, Docker, GitHub Actions, Node.js, TypeScript, JavaScript
If there are issues with missing configurations, ensure the `.env.local` file is set correctly and run `defang config` to manage sensitive configs.

Languages: nodejs
8. **Defang Docker Compose Up**
Run the following command to start the Docker container:
```
defang compose up
```