DeployCode Deployment
Deployment Configuration
Configure MDX deployment targets, build settings, and environment
Documentation Status: This documentation describes the planned API design for the .do platform. Code examples represent the intended interface and may not reflect the current implementation state. See roadmap for implementation status.
Complete reference for configuring MDX deployments across all targets.
Configuration File
graph TB
A[do.config.ts] --> B[Base Configuration]
B --> C[APIs]
B --> D[Apps]
B --> E[Agents]
B --> F[Services]
B --> G[Sites]
B --> H[Workflows]
B --> I[Businesses]
C --> J[Environment Variables]
D --> J
E --> J
F --> J
G --> J
H --> J
I --> J
J --> K{Environment}
K --> L[Development]
K --> M[Staging]
K --> N[Production]
Create do.config.ts in your project root:
import { defineConfig } from 'sdk.do'
export default defineConfig({
// Project metadata
name: 'my-project',
version: '1.0.0',
// Deployment targets
apis: [],
apps: [],
agents: [],
sites: [],
services: [],
workflows: [],
businesses: [],
})API Configuration
export default defineConfig({
apis: [
{
// Identifier
name: 'user-api',
// Source file
source: './api/users.mdx',
// Deployment settings
deployment: {
// Domain
domain: 'api.example.do',
// Base path
basePath: '/v1',
// CORS
cors: {
origin: ['https://example.com', 'https://app.example.com'],
methods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'],
credentials: true,
maxAge: 86400,
},
// Rate limiting
rateLimit: {
global: {
requests: 10000,
window: '1h',
},
byEndpoint: {
'/users': { requests: 100, window: '1m' },
'/auth/login': { requests: 5, window: '15m' },
},
},
// Authentication
auth: {
type: 'jwt',
secret: process.env.JWT_SECRET,
expiresIn: '7d',
},
// Timeout
timeout: 30000, // 30 seconds
// Retry policy
retry: {
attempts: 3,
backoff: 'exponential',
maxDelay: 60000,
},
},
// Environment variables
environment: {
DATABASE_URL: process.env.DATABASE_URL,
REDIS_URL: process.env.REDIS_URL,
API_SECRET: process.env.API_SECRET,
},
// Monitoring
monitoring: {
enabled: true,
sampleRate: 1.0,
alerts: [
{
condition: 'error_rate > 0.01',
notify: '[email protected]',
},
{
condition: 'p95_latency > 1000',
notify: '[email protected]',
},
],
},
},
],
})App Configuration
export default defineConfig({
apps: [
{
// Identifier
name: 'dashboard',
// Source
source: './apps/dashboard.mdx',
// Deployment
deployment: {
// Rendering strategy
type: 'ssr', // 'static' | 'ssr' | 'isr' | 'spa'
// Domain
domain: 'app.example.do',
// Routes
routes: {
'/': {
component: 'HomePage',
prerender: true,
},
'/dashboard': {
component: 'DashboardPage',
auth: true,
},
'/settings': {
component: 'SettingsPage',
auth: true,
roles: ['admin'],
},
},
// SSR options
ssr: {
enabled: true,
cache: {
ttl: 3600,
key: (req) => `page:${req.path}:${req.user?.id}`,
},
},
// ISR options
isr: {
revalidate: 60, // seconds
paths: ['/blog/*', '/docs/*'],
},
// Static generation
ssg: {
paths: ['/', '/about', '/pricing'],
fallback: 'blocking', // 'blocking' | true | false
},
},
// Build configuration
build: {
// Output directory
outDir: 'dist/apps/dashboard',
// Target environment
target: 'es2020',
// Minification
minify: true,
// Source maps
sourcemap: true,
// Code splitting
splitting: {
enabled: true,
strategy: 'route', // 'route' | 'size' | 'manual'
},
// Asset optimization
optimization: {
images: {
formats: ['webp', 'avif'],
quality: 80,
sizes: [640, 750, 828, 1080, 1200, 1920],
},
css: {
minify: true,
modules: true,
},
},
},
// Environment
environment: {
API_URL: process.env.API_URL,
ANALYTICS_ID: process.env.ANALYTICS_ID,
},
},
],
})Agent Configuration
export default defineConfig({
agents: [
{
// Identifier
name: 'support-agent',
// Source
source: './agents/support.mdx',
// Deployment
deployment: {
// Trigger configuration
triggers: [
{
type: 'event',
event: 'support.request.created',
},
{
type: 'schedule',
schedule: '*/5 * * * *', // Every 5 minutes
},
{
type: 'webhook',
path: '/webhooks/support',
},
],
// Concurrency
concurrency: 10,
// Timeout
timeout: 300000, // 5 minutes
// Retry policy
retry: {
attempts: 3,
backoff: 'exponential',
},
// Memory
memory: {
enabled: true,
store: 'redis',
ttl: 86400, // 24 hours
},
},
// AI configuration
ai: {
model: 'claude-sonnet-4.5',
temperature: 0.7,
maxTokens: 2000,
systemPrompt: 'You are a helpful customer support agent...',
},
// Environment
environment: {
AI_API_KEY: process.env.AI_API_KEY,
KNOWLEDGE_BASE_ID: process.env.KB_ID,
},
},
],
})Site Configuration
export default defineConfig({
sites: [
{
// Identifier
name: 'marketing-site',
// Source directory
source: './sites/marketing',
// Deployment
deployment: {
// Type
type: 'static', // 'static' | 'ssr' | 'isr'
// Domain
domain: 'example.do',
// Build
build: {
// Output format
output: 'static', // 'static' | 'hybrid'
// Prerender paths
prerender: ['/', '/about', '/pricing', '/blog'],
// Sitemap
sitemap: {
enabled: true,
exclude: ['/admin/*', '/private/*'],
},
// RSS feed
rss: {
enabled: true,
title: 'Blog',
description: 'Latest posts',
path: '/feed.xml',
},
},
// CDN
cdn: {
enabled: true,
cache: {
static: '1y',
html: '1h',
api: '5m',
},
compression: 'brotli', // 'gzip' | 'brotli'
},
// SEO
seo: {
// Default metadata
defaults: {
title: 'Example Company',
description: 'We build amazing products',
image: '/og-image.jpg',
},
// Robots.txt
robots: {
allow: '/',
disallow: ['/admin', '/private'],
},
},
},
},
],
})Service Configuration
export default defineConfig({
services: [
{
// Identifier
name: 'seo-analyzer',
// Version
version: '1.0.0',
// Source
source: './services/seo.mdx',
// Marketplace
marketplace: {
enabled: true,
category: 'marketing',
tags: ['seo', 'analytics', 'ai'],
featured: false,
},
// Pricing
pricing: {
model: 'subscription', // 'subscription' | 'usage' | 'hybrid'
currency: 'USD',
plans: [
{
id: 'starter',
name: 'Starter',
price: 29,
interval: 'month',
features: ['10 analyses/month', 'Email support'],
limits: {
analyzeSEO: { calls: 10, period: 'month' },
},
},
{
id: 'pro',
name: 'Professional',
price: 99,
interval: 'month',
features: ['100 analyses/month', 'Priority support', 'API access'],
limits: {
analyzeSEO: { calls: 100, period: 'month' },
},
},
],
},
// API
api: {
rateLimit: {
free: { requests: 10, window: '1m' },
starter: { requests: 50, window: '1m' },
pro: { requests: 200, window: '1m' },
},
timeout: 60000,
},
// Webhooks
webhooks: {
events: ['user.subscribed', 'user.upgraded', 'user.canceled', 'limit.reached'],
},
},
],
})Workflow Configuration
export default defineConfig({
workflows: [
{
// Identifier
name: 'order-fulfillment',
// Source
source: './workflows/orders.mdx',
// Deployment
deployment: {
// Triggers
triggers: [
{ type: 'event', event: 'order.created' },
{ type: 'api', path: '/workflows/fulfill/:orderId' },
],
// Execution
timeout: 300000, // 5 minutes
concurrency: 100,
// Retry
retry: {
enabled: true,
maxAttempts: 3,
backoff: 'exponential',
},
// State persistence
persistence: {
enabled: true,
store: 'durable-objects',
},
// Idempotency
idempotency: {
enabled: true,
keyGenerator: (input) => `order:${input.orderId}`,
},
},
// Monitoring
monitoring: {
alerts: [
{
condition: 'failure_rate > 0.05',
notify: '[email protected]',
},
{
condition: 'avg_duration > 60000',
notify: '[email protected]',
},
],
},
},
],
})Business Configuration
export default defineConfig({
businesses: [
{
// Identifier
name: 'ai-agency',
// Source
source: './business/agency.mdx',
// Deployment
deployment: {
// Domains
domains: {
website: 'aiagency.do',
app: 'app.aiagency.do',
api: 'api.aiagency.do',
docs: 'docs.aiagency.do',
},
// Infrastructure
infrastructure: {
database: 'postgres',
cache: 'redis',
storage: 'r2',
email: 'resend',
payments: 'stripe',
analytics: 'plausible',
},
// Scaling
scaling: {
agents: { min: 1, max: 10 },
workflows: { concurrency: 100 },
api: { instances: 'auto' },
database: {
connections: { min: 5, max: 20 },
},
},
},
// Business operations
operations: {
// Billing
billing: {
provider: 'stripe',
mode: 'automatic',
invoices: true,
receipts: true,
},
// CRM
crm: {
enabled: true,
provider: 'builtin',
automate: ['onboarding', 'follow-ups', 'renewals'],
},
// Support
support: {
channels: ['email', 'chat'],
agent: 'support-agent',
escalation: {
to: '[email protected]',
when: 'agent_uncertain',
},
},
// Analytics
analytics: {
enabled: true,
track: ['revenue', 'users', 'orders', 'satisfaction'],
dashboards: ['revenue', 'operations', 'customer-health'],
},
},
},
],
})Environment-Specific Configuration
flowchart LR
A[Base Config] --> B{Environment}
B --> C[Development]
B --> D[Staging]
B --> E[Production]
C --> C1[Local APIs]
C --> C2[CORS: *]
C --> C3[Debug Mode]
D --> D1[Staging APIs]
D --> D2[Reduced Monitoring]
D --> D3[Test Data]
E --> E1[Production APIs]
E --> E2[Full Monitoring]
E --> E3[Rate Limiting]
E --> E4[Alerting]
// do.config.ts
export default defineConfig({
// Base configuration
name: 'my-app',
// Environment-specific overrides
environments: {
development: {
apis: [
{
domain: 'localhost:3000',
cors: { origin: '*' },
},
],
},
staging: {
apis: [
{
domain: 'staging-api.example.do',
},
],
monitoring: {
sampleRate: 0.1,
},
},
production: {
apis: [
{
domain: 'api.example.do',
rateLimit: {
global: { requests: 10000, window: '1h' },
},
},
],
monitoring: {
sampleRate: 1.0,
alerts: true,
},
},
},
})TypeScript Configuration
// Full type safety
import { defineConfig, type APIConfig, type AppConfig } from 'sdk.do'
const apiConfig: APIConfig = {
name: 'my-api',
source: './api/index.mdx',
// ... fully typed
}
const appConfig: AppConfig = {
name: 'my-app',
source: './app/index.mdx',
// ... fully typed
}
export default defineConfig({
apis: [apiConfig],
apps: [appConfig],
})Related Documentation
- Build Process - Build and deployment
- Examples - Configuration examples
- Code Deployment - Overview
-
- Environment Variables - Managing secrets