1Install the CLI
npm install -g xtra-cliIntegrate XtraSecurity into your application in 3 minutes. Use the CLI for local development, the REST API for programmatic access, or the SDK for framework-native integration.
Get from zero to secure secret injection in under 3 minutes.
npm install -g xtra-cli# Login to your XtraSecurity account
xtra login
# Link your current directory to a project
xtra projects set <your-project-id>
# Set branch and environment
xtra checkout main --env development# Inject secrets into your process (recommended — no .env file created)
xtra run -e development -b main -- npm run dev
# Or sync to a local .env.local file
xtra local sync -e development -b mainProgrammatic access to all XtraSecurity features. Authenticate with API keys or JWT tokens.
# All API requests require a Bearer token
curl -X GET https://xtrasecurity.in/api/secret?branchId=<branch-id> \
-H "Authorization: Bearer <your-api-token>" \
-H "Content-Type: application/json"| Method | Endpoint | Description |
|---|---|---|
| GET | /api/secret?branchId=:id | List all secrets in a branch |
| POST | /api/secret | Create a new secret |
| PUT | /api/secret?id=:id | Update an existing secret |
| DELETE | /api/secret?id=:id | Delete a secret |
| GET | /api/branch?projectId=:id | List branches in a project |
| POST | /api/branch | Create a new branch |
| GET | /api/projects | List all projects |
| POST | /api/projects | Create a new project |
| GET | /api/audit?projectId=:id | Get audit logs for a project |
| POST | /api/access/request | Request JIT access to a secret |
| POST | /api/access/approve | Approve or reject an access request |
| POST | /api/rotation/schedules | Create a rotation schedule |
curl -X POST https://xtrasecurity.in/api/secret \
-H "Authorization: Bearer <your-api-token>" \
-H "Content-Type: application/json" \
-d '{
"key": "DATABASE_URL",
"value": "postgresql://user:pass@host:5432/db",
"branchId": "<branch-id>",
"environmentType": "production",
"description": "Primary PostgreSQL connection string"
}'{
"id": "sec_abc123",
"key": "DATABASE_URL",
"type": "credential",
"environmentType": "production",
"version": 1,
"createdAt": "2025-06-01T12:00:00Z",
"description": "Primary PostgreSQL connection string"
}XtraSecurity works with any framework. Here are quick examples for popular tech stacks.
Use the CLI to inject env vars, then access them with process.env:
# Terminal: Start your Express server with injected secrets
xtra run -e production -b main -- node server.js
# server.js — access secrets normally via process.env
const express = require('express');
const app = express();
const dbUrl = process.env.DATABASE_URL; // Injected by xtra-cli
const apiKey = process.env.STRIPE_API_KEY; // Injected by xtra-cli
app.listen(3000, () => {
console.log('Server running on port 3000');
});Sync secrets to .env.local for Next.js development:
# Sync secrets to .env.local (Next.js reads this automatically)
xtra local sync -e development -b main
# Or inject directly without .env.local
xtra run -e development -b main -- npm run dev
# Access in your Next.js code:
# Server components: process.env.DATABASE_URL
# Client components: process.env.NEXT_PUBLIC_API_URLThe CLI injects secrets as environment variables, accessible via os.environ:
# Terminal: Run your Python app with injected secrets
xtra run -e production -b main -- python manage.py runserver
# settings.py — access secrets normally
import os
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'HOST': os.environ.get('DB_HOST'),
'NAME': os.environ.get('DB_NAME'),
'USER': os.environ.get('DB_USER'),
'PASSWORD': os.environ.get('DB_PASSWORD'),
}
}Pull secrets at build time without storing them in CI/CD configuration files.
# .github/workflows/deploy.yml
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install xtra-cli
run: npm install -g xtra-cli
- name: Authenticate with XtraSecurity
run: xtra login --token ${{ secrets.XTRA_API_TOKEN }}
- name: Set project
run: xtra projects set ${{ vars.XTRA_PROJECT_ID }}
- name: Build with injected secrets
run: xtra run -e production -b main -- npm run build
- name: Deploy
run: npm run deploy# .gitlab-ci.yml
deploy:
stage: deploy
image: node:20
script:
- npm install -g xtra-cli
- xtra login --token $XTRA_API_TOKEN
- xtra projects set $XTRA_PROJECT_ID
- xtra run -e production -b main -- npm run build
- npm run deploy
only:
- mainStart integrating XtraSecurity into your project today. Free plan includes 3 projects and 50 secrets.