Nexlayer CLI
π Deploy and manage full-stack applications in minutes with Nexlayer CLI. Built for developers who value simplicity without sacrificing power.
Quick Start (30 seconds)
# 1. Install the CLI
go install github.com/Nexlayer/nexlayer-cli@latest
# 2. Start the interactive wizard
nexlayer wizard
That's it! The wizard will guide you through deployment setup. Want more control? Check out the manual setup below.
Requirements
- Go version 1.21 or later
- Git (for version control)
- Docker (for container builds)
Installation
go install github.com/Nexlayer/nexlayer-cli@latest
Make sure your $GOPATH/bin
is in your system PATH to access the CLI globally.
Common Commands
# Start the interactive wizard (recommended for first-time users)
nexlayer wizard
# Initialize a new project
nexlayer init
# Deploy your application
nexlayer deploy my-app
# Check deployment status
nexlayer status my-app
# View logs
nexlayer logs my-app
# Scale your application
nexlayer scale my-app --replicas 3
Real-World Examples
1. CI/CD Pipeline Integration
# .github/workflows/deploy.yml
name: Deploy with Nexlayer
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Nexlayer CLI
run: go install github.com/Nexlayer/nexlayer-cli@latest
- name: Deploy to Production
run: |
nexlayer deploy my-app \
--env production \
--auto-approve
env:
NEXLAYER_AUTH_TOKEN: ${{ secrets.NEXLAYER_AUTH_TOKEN }}
2. Multi-Environment Setup
# Development deployment
nexlayer deploy my-app --env staging
# Production deployment with increased resources
nexlayer deploy my-app --env production \
--replicas 3 \
--cpu 2 \
--memory 4Gi
3. Advanced Configuration
# nexlayer.yaml
version: '1'
app:
name: my-awesome-app
template: node-typescript
env:
NODE_ENV: production
API_URL: https://api.example.com
resources:
cpu: 1
memory: 2Gi
scaling:
min: 2
max: 5
targetCPU: 70
Environment Setup
The CLI requires only one environment variable:
NEXLAYER_AUTH_TOKEN="your_auth_token" # Your authentication token from https://app.nexlayer.io/settings/tokens
This token is used to authenticate your CLI requests with the Nexlayer API. You can get your token by:
- Logging into your Nexlayer account
- Going to Settings β API Tokens
- Creating a new token with appropriate permissions
For different environments:
- Use
--env staging
(default) to deploy to https://app.staging.nexlayer.io
- Use
--env production
to deploy to https://app.nexlayer.io
Security Best Practices
Authentication Token Security
-
Never commit tokens to version control
- Store tokens in environment variables
- Use secure secret management in CI/CD pipelines
- Consider using tools like HashiCorp Vault or AWS Secrets Manager
-
Token Best Practices
- Rotate tokens regularly
- Use tokens with minimal required permissions
- One token per environment/purpose
- Revoke tokens immediately if exposed
-
Local Development
- Use
.env
files (not committed to git)
- Different tokens for different environments
# .env.development
NEXLAYER_AUTH_TOKEN=dev_token
NEXLAYER_STAGING_API_URL=http://localhost:8080
Secure CI/CD Integration
# GitHub Actions example with secure token handling
name: Deploy with Nexlayer
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Nexlayer CLI
run: go install github.com/Nexlayer/nexlayer-cli@latest
- name: Deploy to Production
env:
# Use GitHub's secret management
NEXLAYER_AUTH_TOKEN: ${{ secrets.NEXLAYER_AUTH_TOKEN }}
run: nexlayer deploy my-app --env production
File Security
Ensure these files are in your .gitignore
:
.env
and .env.*
files
*.pem
, *.key
, *.cert
files
- Local development configurations
- Build artifacts and logs
Troubleshooting
Common Error Messages
-
Authentication Error
β Authentication required
π‘ Quick fixes:
β’ Make sure NEXLAYER_AUTH_TOKEN is set in your environment
β’ Run 'nexlayer auth login' to authenticate
β’ Visit https://app.nexlayer.io/settings/tokens to generate a token
-
YAML Validation Error
β Invalid template YAML
π‘ Quick fixes:
β’ Check the YAML syntax
β’ Ensure all required fields are present
β’ Run 'nexlayer validate' to check template structure
-
Deployment Error
β Deployment failed
π‘ Quick fixes:
β’ Check your network connection
β’ Verify your authentication token
β’ Run with --debug flag for more information
Debug Mode
Add the --debug
flag to any command for detailed output:
nexlayer deploy my-app --debug
Best Practices
- Version Control: Always commit your
nexlayer.yaml
configuration
- Environment Variables: Use
.env
files for local development
- CI/CD: Use environment-specific configurations
- Monitoring: Regularly check
nexlayer status
and nexlayer logs
Support