Logo

dev-resources.site

for different kinds of informations.

Integrate Daytona in your NextJS app

Published at
12/5/2024
Categories
webdev
daytona
nextjs
productivity
Author
komsenapati
Author
11 person written this
komsenapati
open
Integrate Daytona 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 · Dev Environment Manager

Daytona is a self-hosted and secure open source development environment manager.

favicon daytona.io

Why Use Daytona?

Daytona works with:

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

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 like Github. 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 can connect 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.

You can generate one with ai.

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 the following:

npm run dev
Enter fullscreen mode Exit fullscreen mode

Some highlights of devcontainer.json file:

  • 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 useful VSC settings and extensions for productive development, like Prettier, ESLint, and React/Next.js tools.
  • PORT forwarding: Automatically forwards port 3000 to access the development server from the host machine.

Conclusion

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

If you like this blog, show some love for Recipe Genie and Daytona.

GitHub logo daytonaio / daytona

The Open Source Dev Environment Manager.


Daytona logo

Documentation License Go Report Card Issues - daytona GitHub Release
Open Bounties Rewarded Bounties


Daytona - Dev environment manager that makes you 2x more productive | Product Hunt Daytona - Dev environment manager that makes you 2x more productive | Product Hunt

The Open Source Development Environment Manager

Set up a development environment on any infrastructure, with a single command

Documentation · Report Bug · Request Feature · Join Our Slack · Twitter

Features

  • Single Command: Activate a fully configured development environment with a single command.
  • Runs everywhere: spin up your development environment on any machine — whether it's local, remote, cloud-based, physical server, or a VM & any architecture x86 or ARM.
  • Configuration File Support: Initially support for dev container, ability to expand to DevFile, Nix & Flox (Contributions welcome here!).
  • Prebuilds System: Drastically improve environment setup times (Contributions welcome here!).
  • IDE Support : Seamlessly supports VS Code & JetBrains locally, ready to use without configuration. Includes a built-in Web IDE for added convenience.
  • Git Provider Integration: GitHub, GitLab, Bitbucket, Bitbucket Server, Gitea, Gitness, Azure DevOps, AWS CodeCommit, Gogs & Gitee can be connected, allowing…

GitHub logo kom-senapati / Recipe-Genie-Daytona

Recipe Genie is your ultimate cooking companion powered by TheMealDB. Discover a world of culinary delights, from tantalizing surprises to exploring categories and their delectable recipes. With Recipe Genie, embark on a culinary journey like never before.

Sample Recipe Genie

Recipe Genie is your go-to app for exploring delicious recipes, powered by TheMealDB. Discover a variety of dishes, surprise yourself with random recipes, or browse through different categories. With Recipe Genie, enjoy a fun and easy cooking adventure! It's a simple Next.js app built using TheMealDB.


🚀 Getting Started

Open Using Daytona

  1. Install Daytona: Follow the Daytona installation guide.

  2. Create the Workspace:

    daytona create https://github.com/kom-senapati/Recipe-Genie-Daytona.git
    Enter fullscreen mode Exit fullscreen mode
  3. Start the Application:

    npm run dev
    Enter fullscreen mode Exit fullscreen mode

🤔 Why Use DevContainer and Daytona?

DevContainer

  • Simplifies development environment setup in VS Code.
  • Perfect for team collaboration in open-source projects.
  • Eliminates the hassle of creating dev environments for contributors.
  • Automatically configures extensions and settings for a consistent experience.

Daytona

  • Works with any Git platform: GitHub, GitLab, Bitbucket.
  • Compatible with any IDE: Vim, VS Code, JetBrains IDEs.
  • Runs anywhere: Localhost, AWS, Azure, GCP, Digital Ocean.
  • Flexible and efficient…

bye bye

daytona Article's
27 articles in total
Favicon
From Legacy to Lightning: Modernizing an Astro App with Daytona
Favicon
Daytona_Sample_Project : CareCradle
Favicon
Stremlining Development with Daytona
Favicon
🔮 Daytona + EchoBrain – AI Development Reimagined
Favicon
Daytona-Sample-React: Text AI
Favicon
PathGen with Daytona: Revolutionizing Personalized Learning Paths
Favicon
Integrate Daytona into a Machine Learning Project with React, Node, and Python
Favicon
How Daytona Helped Me Streamline My Development Workflow
Favicon
Make your Day with Daytona
Favicon
Effortless Full Stack Development: Set Up Django-React Application with One Command Using Daytona
Favicon
Daytona: Your Project’s New Best Friend
Favicon
Comprehensive Guide: Creating and Running the "Sample Video Generator" with Daytona
Favicon
Simplifying Recipe Discovery: Integrating Daytona into Recipe Finder🍝☕️
Favicon
How to generate devcontainer.json automatically without using devcontainer.ai
Favicon
Using Daytona to maintain a Development Environment
Favicon
🚀 Simplify Your Dev Workflow with Daytona: Building a Pydantic AI-Powered Flask App
Favicon
Conquering the Setup Loop with Daytona
Favicon
Discord Image Generation Bot with Daytona
Favicon
My Journey with Daytona and How I Plan to Use It Going Forward
Favicon
Mastering Daytona Integration in Python: A Detailed Step-by-Step Guide 🚀
Favicon
Integrate DAYTONA and let the magic begin....
Favicon
Integrate Daytona into Your React Project: A Step-by-Step Guide
Favicon
Integrate Daytona in your NextJS app
Favicon
How to Set Up Dev Environment on a Remote Machine
Favicon
Streamlined DevEx with the Daytona Installer Script
Favicon
The days of “it works on my machine” are gone; meet standardized development environments
Favicon
Daytona, a Secure Alternative to GitHub Codespaces, Launched by Cloud Development Veterans

Featured ones: