What You’ll Deploy

A secure Express.js API with:

  • Pre-built Node.js web server
  • TEE security verification
  • Health monitoring endpoints
  • No code changes required

This tutorial uses an existing Node.js container to demonstrate dstack deployment. Perfect for APIs, real-time applications, and microservices.

Prerequisites

  • Access to a dstack host (see setup guide)
  • SSH tunnel to dstack dashboard
  • Web browser for dashboard access
  • 5 minutes of your time

Step 1: Open Tunnel & Access Dashboard

Connect to your dstack host and open the dashboard:
1

Open tunnel & access dashboard

This command lets you access the dstack dashboard running on your remote host.
Open in your browser:http://127.0.0.1:13680

Step 2: Deploy Node.js Container

Navigate to your dstack dashboard and click “Deploy a new instance”.

Add the Docker Compose Configuration

Copy this YAML and paste it into the “Docker Compose File” field:
2Paste your Docker Compose YAML
Click “Deploy” to start your Node.js application.

Step 3: Launch and Monitor

  1. Click Launch in the dashboard
dstack will start your Node.js Express application. This usually takes 1–2 minutes.
  1. Monitor the deployment progress
  • Check Serial Logs for VM boot details
  • View container status in the Containers tab
  • Wait for the application to show as “Running”

Step 4: Test Your Deployment

After deployment, find your app’s URL in the dashboard:
https://<APP_ID>-8080.app.<host>:<host_port>

Test the Endpoints

# Replace with your actual app URL
APP_URL="https://your-app-id-8080.app.your-host:port"

# Test main endpoint
curl $APP_URL/

# Test health check
curl $APP_URL/health

# Test TEE attestation endpoint
curl $APP_URL/attestation

# Test secure computation
curl -X POST $APP_URL/api/compute \
  -H "Content-Type: application/json" \
  -d '{"data": "sensitive information"}'

Expected Responses

Main endpoint (/):
{
  "message": "Node.js app running in TEE",
  "secure": true,
  "tee_enabled": true,
  "timestamp": "2024-01-01T12:00:00.000Z",
  "environment": "dstack-tee",
  "version": "v18.19.0"
}
Health endpoint (/health):
{
  "status": "healthy",
  "tee_protected": true,
  "node_version": "v18.19.0",
  "framework": "Express.js",
  "uptime": 45.123
}
Compute endpoint (/api/compute):
{
  "processed": true,
  "secure_computation": "completed",
  "result": "Securely processed: \"sensitive information\"",
  "tee_protected": true,
  "timestamp": "2024-01-01T12:00:00.000Z"
}

What’s Next?

Your Node.js application is now running securely in a dstack TEE environment with: Hardware Protection - Application runs in Intel TDX secure environment
Memory Encryption - All data encrypted by CPU hardware
Attestation Support - Cryptographic proof of security available
Production Ready - HTTPS endpoints with automatic certificates

Continue Learning