Environment Setup
Configure your local development environment, install the CloudNexus CLI, and connect to your workspace.
Prerequisites
Before proceeding, ensure you have the following installed:
- Node.js 18.x or higher
- Git 2.30+
- Package Manager: npm, yarn, pnpm, or bun
- Access to a CloudNexus account with API permissions
This guide assumes you're using a Unix-like terminal (macOS, Linux, or WSL on Windows). Windows CMD/PowerShell paths may vary slightly.
Step 1: Install the CloudNexus CLI
The CloudNexus CLI is the primary interface for managing projects, environments, and deployments. Install it globally using your preferred package manager:
# Using npm
npm install -g @cloudnexus/cli
# Using yarn
yarn global add @cloudnexus/cli
# Using pnpm
pnpm add -g @cloudnexus/cli
# Using bun
bun install -g @cloudnexus/cli
Verify the installation by checking the version:
cnx --version
# Output: @cloudnexus/cli v2.4.1
Step 2: Authenticate & Configure
Initialize the CLI and link it to your CloudNexus workspace. This will prompt you to log in via OAuth in your browser.
cnx auth login
# After browser authentication completes:
# ✓ Authenticated as developer@company.io
# ✓ Linked to workspace: production-cluster-alpha
Configure your default region and environment preferences:
cnx config set region us-east-1
cnx config set env dev
cnx config set provider aws
Never commit your ~/.cloudnexus/config.json file to version control. It contains sensitive tokens. Use .cnxignore to exclude it.
Step 3: Create a Project & Environment
Initialize a new CloudNexus project in your working directory. This will scaffold the required configuration files.
cd /path/to/your/project
cnx init
# Select options:
# ✓ Framework: Next.js / Node.js / Python / Go
# ✓ Region: us-east-1
# ✓ Auto-scaling: Enabled
# ✓ Database: Managed PostgreSQL
This generates the following structure:
my-project/
├── .cloudnexus/
│ ├── config.json # Project settings
│ ├── env.dev.json # Development variables
│ └── env.prod.json # Production variables
├── cnx.yaml # Deployment manifest
└── package.json
Managing Environment Variables
CloudNexus uses encrypted environment files. Never store secrets directly in code. Use the CLI to manage them securely:
# Add a new encrypted variable
cnx env set DATABASE_URL --env dev
# List current variables
cnx env list --env dev
# Sync local .env to CloudNexus
cnx env sync --from .env --env dev
Step 4: Verify Installation
Run a quick connectivity test to ensure your environment is properly configured and can reach the CloudNexus edge network.
cnx status
# Output:
# ├─ Auth: ✓ Valid (expires in 24h)
# ├─ Region: ✓ us-east-1 (latency: 12ms)
# ├─ Network: ✓ Anycast routing active
# └─ CLI: ✓ v2.4.1 (latest)
# ✓ Environment ready for deployment
Use cnx telemetry disable to opt out of anonymous usage statistics if required by your organization's compliance policies.
Troubleshooting
Authentication Failures
If cnx auth login fails, clear your cached tokens and retry:
cnx auth logout
cnx auth login --force
Network Timeouts
Corporate firewalls may block edge endpoints. Configure a proxy if needed:
cnx config set proxy http://corp-proxy.company.internal:8080