Skip to content
EANVI

Docs

Developer Cheatsheet

Complete step-by-step cheatsheet from web setup to CLI, SDK, and CI/CD integration.

Architecture at a Glance

Organization (e.g., Acme Corp)
 └── Project (e.g., my-api, web-dashboard)
      └── Environments (development, staging, production)
           └── Encrypted Secrets (DATABASE_URL, STRIPE_KEY, etc.)

1. Web Console Setup (2 Minutes)

  1. Sign Up / Log In: Navigate to your Eanvi web console and log in.
  2. Create Organization: Create your workspace (e.g., acme-corp).
  3. Create Project: Click ProjectsNew Project (e.g. slug: backend-api).
  4. Select Environment: Default environments (development, staging, production) are ready.
  5. Add Secrets:
    • Manually: Click Add Secret (e.g., DATABASE_URL=postgres://...).
    • Bulk: Click Import and drag-and-drop your existing .env file.
  6. Generate API Key (for CLI & CI/CD):
    • Go to SettingsAPI KeysCreate Key.
    • Copy the key (eanvi_live_... or eanvi_sk_...).

2. CLI Setup & Project Linking

Step 2.1: Install CLI

# Global install (recommended)
npm install -g @eanvi/cli

# Verify installation
eanvi --version

Step 2.2: Authenticate

# Interactive login (browser / email / token)
eanvi login

# Or non-interactive login via API Key (for CI/CD or scripts)
eanvi login --api-key <YOUR_API_KEY>

Step 2.3: Link Your Local Project

Run this in the root directory of your codebase:

# Interactive selection
eanvi init

# Or one-liner specification
eanvi init --project backend-api --environment development --env-file .env

This creates a .eanvi/config.json linking your directory to Eanvi.


3. Daily Developer Workflows

Pull Secrets (Remote → Local .env)

# Pull into configured .env file
eanvi pull

# Pull for a specific environment (e.g. production)
eanvi pull --environment production --output .env.production

# Hard reset local keys to match remote exactly
eanvi pull --force

Push Secrets (Local .env → Remote)

# Push local .env changes to remote
eanvi push

# Preview changes before pushing
eanvi push --dry-run

# Push and delete remote keys that are missing locally
eanvi push --delete-missing

Compare Local & Remote Differences

# View diff between local .env and remote vault
eanvi diff

Bidirectional Sync (Merge & Resolve Conflicts)

eanvi sync

# Auto-accept non-conflicting changes
eanvi sync --yes

Inspect Secrets

# List all keys with masked values
eanvi list

# Reveal secret values in terminal
eanvi list --reveal

Diagnostics & Account Check

# Verify connection, auth, and local configuration
eanvi doctor

# Check active user and organization
eanvi whoami

4. Using the TypeScript SDK (Runtime Access)

If your application needs to fetch secrets dynamically at runtime:

Step 4.1: Install SDK

npm install @eanvi/sdk

Step 4.2: Fetch Secrets in Code

import { createClient } from '@eanvi/sdk';

const eanvi = createClient({
  apiKey: process.env.EANVI_API_KEY, // Set in hosting provider or runtime env
});

async function loadConfig() {
  // 1. Fetch all secrets as a key-value map for an environment
  const config = await eanvi.cli.pull({
    project: 'backend-api',
    environment: process.env.NODE_ENV || 'development',
  });

  console.log('Database URL:', config.secrets['DATABASE_URL']);
  return config.secrets;
}

// 2. Fetch individual secret details
const secret = await eanvi.secrets.get('secret_id');
const decrypted = await eanvi.secrets.reveal('secret_id');
console.log('Decrypted Secret:', decrypted.value);

5. CI/CD & Production Integration

GitHub Actions Workflow Example

Store EANVI_API_KEY in GitHub Repo Secrets (Settings → Secrets and variables → Actions).

name: Deploy Application

on:
  push:
    branches: [main]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: 20

      - name: Install Eanvi CLI
        run: npm install -g @eanvi/cli

      - name: Pull Production Secrets
        env:
          EANVI_API_KEY: ${{ secrets.EANVI_API_KEY }}
        run: |
          eanvi pull \
            --project backend-api \
            --environment production \
            --output .env.production

      - name: Build Application
        run: npm run build

Docker Container Example

FROM node:20-alpine AS builder
WORKDIR /app

# Copy files
COPY package*.json ./
RUN npm install

# Install Eanvi CLI
RUN npm install -g @eanvi/cli

COPY . .

# Pass build-time API Key argument
ARG EANVI_API_KEY
RUN eanvi pull --project backend-api --environment production --output .env

RUN npm run build
CMD ["npm", "start"]

6. Command Quick Reference

ActionCommand
Authenticateeanvi login or eanvi login --api-key <key>
Check Sessioneanvi whoami
Link Projecteanvi init -p <project-slug> -e <env-slug>
Pull to .enveanvi pull
Pull Productioneanvi pull -e production -o .env.production
Push .env to Cloudeanvi push
Preview Pusheanvi push --dry-run
Diff Local vs Cloudeanvi diff
Two-way Synceanvi sync -y
List Secretseanvi list (or eanvi list --reveal)
Import from Fileeanvi import ./secrets.json --format json
Export to Fileeanvi export --format yaml --output secrets.yaml
Troubleshooteanvi doctor
Logouteanvi logout

7. Security Best Practices & Git Rules

  1. Always Gitignore Secret Files: Add this to your project's .gitignore:
    # Eanvi local state and downloaded secret files
    .env
    .env.*
    !.env.example
    .eanvi/secrets-state.json
    
  2. Commit Project Link Configuration: You should commit .eanvi/config.json so all team members automatically link to the correct project & environment.
  3. Use Scoped API Keys: Use read-only or environment-specific keys for CI/CD runners.
  4. Audit Logs: Track who accessed or revealed any secret in Organization Settings → Audit Logs.