Back to Blog
First look into Daytona-Typescript integration

First look into Daytona-Typescript integration

I used Daytona for my relay-chat-backend, a WebSocket chat application written in Typescript/NodeJS setup.

December 14, 2024
10 min read
DevOpsOpen-SourceTypescriptWebSockets

Introduction

Daytona is a powerful and extremely user-friendly open source development environment manager. It's particularly useful for building a standardized development workflow, ensuring that environments stay consistent and predictable across the development lifecycle.

Daytona Banner

How Daytona Helped Me

When I started contributing seriously to open source this year, especially during Hacktoberfest'24, I noticed a huge amount of time and resources were wasted during project setup. To contribute, I'd first fork the repo, clone it, open in VSCode, install dependencies, and finally get it running locally. This repetitive process was tedious and time-consuming.

I kept wondering if there could be an easier, faster way to start contributing…

Project setup workflow

Enter Daytona: A tool that lets you skip the tedium and get straight to coding, without hassling over environment setup.

I used Daytona for my relay-chat-backend (a WebSocket chat app in Typescript/NodeJS). The experience was impressively smooth: every step—from environment creation to running the app—worked perfectly.

Why You should also use Daytona:

Works with every version control
GitHub GitHub
GitLab GitLab
Bitbucket Bitbucket
Works with any IDE of your choice
Vim Vim
VS Code VS Code
IntelliJ IDEA IntelliJ
WebStorm WebStorm
Rider Rider
PyCharm PyCharm
CLion CLion
🌍 Works anywhere — broad integrations
Azure Azure
AWS AWS
GCP GCP

Advantages

The highlight for me is the cool & interactive CLI. With just a command, you can spin up a complete dev environment!

Daytona CLI Interface

Create the whole environment with:


daytona create <REPO URL>


Getting Started

  1. Install Daytona — Follow their Official Installation Guide

  2. Windows Install: Install Daytona with this PowerShell script:
    
    $architecture = if ($env:PROCESSOR_ARCHITECTURE -eq "AMD64") { "amd64" } else { "arm64" }
    md -Force "$Env:APPDATA\bin\daytona"; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Tls,Tls11,Tls12';
    Invoke-WebRequest -URI "https://download.daytona.io/daytona/v0.47/daytona-windows-$architecture.exe" -OutFile "$Env:APPDATA\bin\daytona\daytona.exe";
    $env:Path += ";" + $Env:APPDATA + "\bin\daytona"; [Environment]::SetEnvironmentVariable("Path", $env:Path, [System.EnvironmentVariableTarget]::User);
    daytona serve;
    

  3. Add Git Providers:

    Daytona makes it easy to connect to your favorite Git platforms.

    daytona git-providers add
    git-providers Interface

    NOTE: Multiple other git providers are also supported.

    More Git providers

  4. Setup Cloud Providers:

    Easily create and manage environments with providers like Azure, AWS, GCP, localhost, Docker (local or remote).

    NOTE: For extra options, install the provider SDK first.

    daytona provider install
    Daytona Providers

  5. Add a Dev Container:

    When ready, add .devcontainer/devcontainer.json to your project. If setup feels tricky, just use Devcontainer AI – copy-paste your repo link, and let it generate devcontainer.json automatically.

    Devcontainer AI page

    Here’s my relay-chat-backend devcontainer.json config file:

    {
      "name": "WebSocket Chat Application",
      "image": "mcr.microsoft.com/devcontainers/typescript-node:20",
      "forwardPorts": [
        3000
      ],
      "customizations": {
        "vscode": {
          "settings": {
            "typescript.tsdk": "/usr/local/lib/node_modules/typescript/lib",
            "editor.formatOnSave": true
          },
          "extensions": [
            "esbenp.prettier-vscode",
            "dbaeumer.vscode-eslint"
          ]
        }
      },
      "postCreateCommand": "npm install"
    }
    

  6. Create your project workspace:
    daytona create https://github.com/yashksaini-coder/relay-chat-backend

  7. Final Step:

    To start the application, simply run:

    npm run dev

Key Takeaways

  • Productivity Boost: Automates tedious initial setup and environment management, streamlining and optimizing my entire workflow.
  • Security: Offers controlled access and robust dependency management, keeping your projects and sensitive info secure.
  • Scalability: Easily handles modifications and scaling (tried on a full stack chat app—both frontend & backend—worked like a charm!).

Conclusion

I loved using Daytona! It's easy, quick, highly portable, and makes dev environment management a breeze. Try it today – you'll have a great experience, I promise.

If you liked this blog, please support my projects:
- Relay-chat-backend Repository
- Star Daytona on GitHub

UPI Payment
Scan QR or copy UPI ID
UPI ID: 8273638500@ybl
Scan to pay with any UPI app