DEV Community

K Om Senapati
K Om Senapati

Posted on

Integrate Dayotana in your NextJS app

Introduction

Daytona is a secure and open-source development environment manager that simplifies your workflow. Imagine starting development on a Next.js app without the usual setup hassle. On average, developers lose 56% of their time setting up environments. Daytona eliminates that wasted time and lets you focus directly on coding.

Daytona


Why Use Daytona?

Daytona works with:

  • Any Git platform: GitHub, GitLab, Bitbucket
  • Any IDE: Vim, VS Code, JetBrains IDEs
  • Anywhere: Localhost, AWS, Azure, GCP, Digital Ocean

The biggest advantage?

You get a pre-configured environment ready in seconds. Just run this command:

daytona create <REPO_URL>
Enter fullscreen mode Exit fullscreen mode

That's it! Your environment is ready. Now you can focus on building features and fixing bugs.


Using Daytona for Recipe Genie

1️⃣ Install Daytona using this guide.

2️⃣ Configure Daytona

Step 1: Connect Daytona to Your Git Repositories

To manage your code with version control, link Daytona to your Git provider. Run this command in your terminal:

daytona git-providers add
Enter fullscreen mode Exit fullscreen mode

Step 2: Install a Cloud Provider

If you need to create or manage cloud environments (like AWS, Azure, or GCP), install a provider using this command:

daytona provider install
Enter fullscreen mode Exit fullscreen mode

Step 3: Set a Target

A "Target" is where your development environment will run, like Docker (local or remote), AWS, GCP, or others. To choose one, use this command:

daytona target set
Enter fullscreen mode Exit fullscreen mode

Step 4: Choose Your IDE

Daytona supports connecting to many IDEs like VS Code, IntelliJ, and more. To set your default IDE, run:

daytona ide
Enter fullscreen mode Exit fullscreen mode

3️⃣ Add devcontainer.json to the repository.

Create a .devcontainer/devcontainer.json file.

If you're confused about how to create one, you can use Devcontainer AI to generate it for you.

Here's the devcontainer.json I used for Recipe Genie:

{
  "name": "Recipe Genie Dev Container",
  "image": "mcr.microsoft.com/devcontainers/javascript-node",
  "forwardPorts": [3000],
  "customizations": {
    "vscode": {
      "settings": {
        "terminal.integrated.defaultProfile.linux": "bash",
        "files.autoSave": "onWindowChange",
        "editor.formatOnSave": true,
        "editor.defaultFormatter": "esbenp.prettier-vscode"
      },
      "extensions": [
        "ms-azuretools.vscode-docker",
        "ms-vscode-remote.remote-containers",
        "dbaeumer.vscode-eslint",
        "esbenp.prettier-vscode",
        "dsznajder.es7-react-js-snippets",
        "formulahendry.auto-rename-tag",
        "bradlc.vscode-tailwindcss",
        "christian-kohler.path-intellisense",
        "ms-vscode.vscode-typescript-next"
      ]
    }
  },
  "postCreateCommand": "npm i"
}
Enter fullscreen mode Exit fullscreen mode

4️⃣ Create your workspace and project

daytona create <REPO_URL>
Enter fullscreen mode Exit fullscreen mode

That's it! Your environment is ready.

To start development, simply run:

npm run dev
Enter fullscreen mode Exit fullscreen mode

Some highlights:

  • Pre-configured environment: Uses the javascript-node devcontainer image from Microsoft.
  • Post-setup commands: Automatically runs npm i to install dependencies.
  • VS Code settings: Includes productivity-focused settings and extensions.

Conclusion

Daytona simplifies development by automating environment setup. Try Daytona today and experience the difference!

If you like this blog, show some support for this project and Daytona.

⭐ Star Recipe Genie

⭐ Star Daytona

bye bye

Top comments (12)

Collapse
 
anmolbaranwal profile image
Anmol Baranwal

Yeah, setting up environments is definitely a hassle when building a product for launch.

Let me explore Daytona further :)

Collapse
 
komsenapati profile image
K Om Senapati

Yup its so easy with Daytona

Collapse
 
rohan_sharma profile image
Rohan Sharma

Daytona is cool!

Collapse
 
mdabidhussain profile image
Md Abid Hussain

Great tool to use for development.

Collapse
 
yashksaini profile image
Yash Kumar Saini

This is a really good guide, reminded me to build a nextjs app thx @komsenapati

Collapse
 
komsenapati profile image
K Om Senapati

Yes use daytona as well :)

Collapse
 
adam_hamwandi_b612bbaafc1 profile image
Adam Hamwandi

Damn this is very cool :D I'll definitely try it out :D thanks a lot

Collapse
 
teoman_kirac_32ffd04ccc43 profile image
teoman kirac

And https certificates and such?

Collapse
 
komsenapati profile image
K Om Senapati

Its for setting a development environment, not production

Some comments may only be visible to logged-in visitors. Sign in to view all comments.