xiaohongshu
xiaohongshu
juicebox-multi-env-setup
Configure Juicebox multi-environment setup. Use when setting up dev/staging/production environments, managing per-environment configurations, or implementing environment isolation. Trigger with phrases like "juicebox environments", "juicebox staging", "juicebox dev prod", "juicebox environment se...
Full skill instructions
Configure Juicebox across development, staging, and production environments with proper isolation and security.
| Environment | Purpose | API Key | Rate Limits | Data |
|---|---|---|---|---|
| Development | Local dev | Sandbox | Relaxed | Mock/Test |
| Staging | Pre-prod testing | Test | Production | Subset |
| Production | Live system | Production | Full | Real |
// config/environments.ts
interface JuiceboxEnvConfig {
apiKey: string;
baseUrl: string;
timeout: number;
retries: number;
sandbox: boolean;
}
const configs: Record<string, JuiceboxEnvConfig> = {
development: {
apiKey: process.env.JUICEBOX_API_KEY_DEV!,
baseUrl: 'https://sandbox.api.juicebox.ai',
timeout: 30000,
retries: 1,
sandbox: true
},
staging: {
apiKey: process.env.JUICEBOX_API_KEY_STAGING!,
baseUrl: 'https://api.juicebox.ai',
timeout: 30000,
retries: 2,
sandbox: false
},
production: {
apiKey: process.env.JUICEBOX_API_KEY_PROD!,
baseUrl: 'https://api.juicebox.ai',
timeout: 60000,
retries: 3,
sandbox: false
}
};
export function getConfig(): JuiceboxEnvConfig {
const env = process.env.NODE_ENV || 'development';
const config = configs[env];
if (!config) {
throw new Error(`Unknown environment: ${env}`);
}
if (!config.apiKey) {
throw new Error(`JUICEBOX_API_KEY not set for ${env}`);
}
return config;
}
// lib/secrets.ts
import { SecretsManager } from '@aws-sdk/client-secrets-manager';
const secretPaths: Record<string, string> = {
development: 'juicebox/dev/api-key',
staging: 'juicebox/staging/api-key',
production: 'juicebox/prod/api-key'
};
export async function getApiKey(): Promise<string> {
const env = process.env.NODE_ENV || 'development';
// In development, allow env var fallback
if (env === 'development' && process.env.JUICEBOX_API_KEY_DEV) {
return process.env.JUICEBOX_API_KEY_DEV;
}
// Production environments must use secret manager
const client = new SecretsManager({ region: process.env.AWS_REGION });
const result = await client.getSecretValue({
SecretId: secretPaths[env]
});
return JSON.parse(result.SecretString!).apiKey;
}
// lib/client-factory.ts
import { JuiceboxClient } from '@juicebox/sdk';
import { getConfig } from '../config/environments';
import { getApiKey } from './secrets';
let clientInstance: JuiceboxClient | null = null;
export async function getJuiceboxClient(): Promise<JuiceboxClient> {
if (clientInstance) return clientInstance;
const config = getConfig();
const apiKey = await getApiKey();
clientInstance = new JuiceboxClient({
apiKey,
baseUrl: config.baseUrl,
timeout: config.timeout,
retries: config.retries
});
// Add environment-specific middleware
if (process.env.NODE_ENV === 'development') {
clientInstance.use(logRequestsMiddleware);
}
return clientInstance;
}
# k8s/base/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: juicebox-config
data:
JUICEBOX_TIMEOUT: "30000"
JUICEBOX_RETRIES: "3"
---
# k8s/overlays/development/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: juicebox-config
data:
JUICEBOX_BASE_URL: "https://sandbox.api.juicebox.ai"
JUICEBOX_SANDBOX: "true"
---
# k8s/overlays/staging/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: juicebox-config
data:
JUICEBOX_BASE_URL: "https://api.juicebox.ai"
JUICEBOX_SANDBOX: "false"
---
# k8s/overlays/production/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: juicebox-config
data:
JUICEBOX_BASE_URL: "https://api.juicebox.ai"
JUICEBOX_SANDBOX: "false"
JUICEBOX_TIMEOUT: "60000"
// lib/environment-guards.ts
export function requireProduction(): void {
if (process.env.NODE_ENV !== 'production') {
throw new Error('This operation is only allowed in production');
}
}
export function preventProduction(): void {
if (process.env.NODE_ENV === 'production') {
throw new Error('This operation is not allowed in production');
}
}
// Usage
async function resetTestData(): Promise<void> {
preventProduction();
await db.profiles.deleteMany({});
}
async function sendBulkOutreach(): Promise<void> {
requireProduction();
// ... production-only logic
}
## Environment Setup Verification
### Development
- [ ] Sandbox API key configured
- [ ] Mock data available
- [ ] Debug logging enabled
- [ ] Rate limits relaxed
### Staging
- [ ] Test API key configured
- [ ] Production-like data subset
- [ ] Monitoring enabled
- [ ] Matches production config
### Production
- [ ] Production API key in secret manager
- [ ] All guards enabled
- [ ] Monitoring and alerting
- [ ] Backup and recovery tested
After environment setup, see juicebox-observability for monitoring.
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience