📖 Setup Guide

Deploy Your First Application

Learn how to configure, build, and deploy a production-ready application on CloudNexus in under 5 minutes.

⏱️ 5 min read 🔄 Updated: Oct 24, 2025 🛠️ CLI v2.4.1+

Prerequisites

Before you begin, ensure you have the following installed and configured:

  • Node.js 18.0 or later (LTS recommended)
  • npm or pnpm package manager
  • A valid CloudNexus account with billing enabled
  • Basic familiarity with terminal commands
💡
CloudNexus supports Docker containers, Node.js runtimes, Python, Go, and static sites. This guide uses a Node.js Express app as the example.

1. Generate API Keys

The CLI requires authentication via personal access tokens with appropriate scopes.

  1. Navigate to Dashboard → API & Keys
  2. Click "Generate New Token"
  3. Assign the following scopes: deploy:write, env:read, logs:read
  4. Copy the token immediately. It won't be shown again.
⚠️
Never commit API tokens to version control. Use environment variables or secret managers.

2. Install the CloudNexus CLI

Install the official CLI globally using your preferred package manager:

bash
# Using npm
npm install -g @cloudnexus/cli

# Verify installation
cnx --version

Alternatively, use Homebrew on macOS/Linux:

bash
brew tap cloudnexus/tap
brew install cnx

3. Initialize & Authenticate

Log in to your account and scaffold a new project:

bash
# Authenticate with your API token
cnx auth login --token cnx_sk_your_generated_token_here

# Create a new project directory
cnx init my-production-app

# Navigate into the project
cd my-production-app

The CLI will generate a cnx.config.js file with sensible defaults for your runtime.

4. Configure Environment

Edit cnx.config.js to match your deployment requirements:

javascript
module.exports = {
  name: 'my-production-app',
  runtime: 'nodejs18',
  region: 'us-east-1',
  env: {
    NODE_ENV: 'production',
    DB_HOST: 'process.env.DB_HOST',
    API_KEY: 'secret.ref.api_key_v1'
  },
  scaling: {
    min: 2,
    max: 20,
    targetCpu: 65
  },
  healthCheck: '/api/health'
};
🔐
Use cnx secrets set to store sensitive values securely. They are never stored in plaintext config files.

5. Deploy to Production

Push your code and trigger the build pipeline:

bash
# Build and deploy with zero-downtime rollout
cnx deploy --prod

# Monitor deployment in real-time
cnx logs follow

The CLI will:

  • Bundle your application with native optimization
  • Provision compute instances in your selected region
  • Run health checks before routing traffic
  • Enable automatic rollbacks on failure

6. Verify & Monitor

After deployment, validate your endpoint and configure monitoring:

bash
# Get deployment URL
cnx apps info

# Test health endpoint
curl https://my-app.cnx.app/api/health

# Open real-time metrics dashboard
cnx monitor open
Your application is now live. All traffic is automatically routed through our global edge network with DDoS protection and SSL termination.

Troubleshooting

Common Issues

  • "Authentication failed": Ensure your token hasn't expired. Run cnx auth refresh.
  • "Build timed out": Check cnx.config.js buildCommand. Node 18+ requires explicit build scripts.
  • "Health check failing": Verify your app responds with 2xx to the healthCheck path.

For advanced debugging, run with verbose logging: cnx deploy --debug