Skip to content

Environment Setup

Configure your development and production environments for Uranus.

Prerequisites

Required Software

SoftwareVersionPurpose
Node.js18.x+JavaScript runtime
npm/pnpmLatestPackage management
GitLatestVersion control

Cloudflare Account

  • Active Cloudflare account
  • Workers Paid plan (recommended) or Free tier
  • API token with Workers permissions

Local Development

1. Clone Repository

bash
git clone https://github.com/anthropics/uranus.git
cd uranus/manage

2. Install Dependencies

bash
npm install

3. Configure Wrangler

Login to Cloudflare:

bash
npx wrangler login

4. Create Resources

bash
# Create D1 database
npx wrangler d1 create agents-dashboard

# Create R2 bucket
npx wrangler r2 bucket create agents-dashboard-files

# Create Vectorize index
npx wrangler vectorize create agents-dashboard-embeddings \
  --dimensions=768 \
  --metric=cosine

5. Update Configuration

Edit wrangler.toml with your resource IDs:

toml
[[d1_databases]]
binding = "DB"
database_name = "agents-dashboard"
database_id = "your-database-id-here"

[[r2_buckets]]
binding = "BUCKET"
bucket_name = "agents-dashboard-files"

[[vectorize]]
binding = "VECTORIZE"
index_name = "agents-dashboard-embeddings"

6. Apply Migrations

bash
# Apply main schema
npx wrangler d1 execute agents-dashboard --local --file=./schema.sql

# Apply migrations
npx wrangler d1 execute agents-dashboard --local --file=./migrations/002_multi_agent.sql
npx wrangler d1 execute agents-dashboard --local --file=./migrations/003_agent_auth.sql
npx wrangler d1 execute agents-dashboard --local --file=./migrations/004_workflow_executions.sql
npx wrangler d1 execute agents-dashboard --local --file=./migrations/005_cloudflare_settings.sql
npx wrangler d1 execute agents-dashboard --local --file=./migrations/006_browser_actions_types.sql
npx wrangler d1 execute agents-dashboard --local --file=./migrations/007_puppeteer_action_types.sql

7. Start Development Server

bash
# Start Wrangler dev server
npm run dev

Access at http://localhost:8787

Environment Variables

wrangler.toml Configuration

toml
name = "cloudflare-agents-pages"
main = "src/worker.ts"
compatibility_date = "2024-12-05"
compatibility_flags = ["nodejs_compat"]

[vars]
ENVIRONMENT = "development"

# Optional: Browser automation
BROWSERBASE_PROJECT_ID = ""
BROWSERBASE_API_KEY = ""

# Optional: Cloudflare Access
CF_ACCESS_AUD = ""

Variable Descriptions

VariableDescriptionRequired
ENVIRONMENTRuntime environment (development/production)Yes
BROWSERBASE_PROJECT_IDBrowserbase project identifierNo
BROWSERBASE_API_KEYBrowserbase API keyNo
CF_ACCESS_AUDCloudflare Access audience tagNo

Cloudflare Resources

D1 Database

SQLite database for persistent storage:

toml
[[d1_databases]]
binding = "DB"
database_name = "agents-dashboard"
database_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

R2 Bucket

Object storage for files:

toml
[[r2_buckets]]
binding = "BUCKET"
bucket_name = "agents-dashboard-files"

Vectorize Index

Vector database for embeddings:

toml
[[vectorize]]
binding = "VECTORIZE"
index_name = "agents-dashboard-embeddings"

Durable Objects

Stateful compute instances:

toml
[[durable_objects.bindings]]
name = "AGENT"
class_name = "DashboardAgent"

[[migrations]]
tag = "v1"
new_classes = ["DashboardAgent"]

Queues

Async task processing:

toml
[[queues.producers]]
binding = "WORKFLOWS_QUEUE"
queue = "agents-dashboard-workflows"

[[queues.consumers]]
queue = "agents-dashboard-workflows"
max_batch_size = 10
max_batch_timeout = 30

Workers AI

Edge AI inference (automatic, no config needed).

Development Modes

Full Development

Run frontend and backend together:

bash
npm run dev

Frontend Only

Hot-reload React development:

bash
npm run dev:frontend

Then proxy API calls to Wrangler.

Preview Build

Test production build locally:

bash
npm run preview

IDE Configuration

VS Code Settings

.vscode/settings.json:

json
{
  "typescript.tsdk": "node_modules/typescript/lib",
  "editor.formatOnSave": true,
  "editor.defaultFormatter": "esbenp.prettier-vscode"
}
  • ESLint
  • Prettier
  • Tailwind CSS IntelliSense
  • TypeScript Hero

TypeScript Configuration

Generate Cloudflare Types

bash
npm run cf-typegen

This generates types for:

  • D1 bindings
  • R2 bindings
  • Vectorize bindings
  • Durable Objects
  • Environment variables

tsconfig.json

json
{
  "compilerOptions": {
    "target": "ES2022",
    "module": "ESNext",
    "strict": true,
    "paths": {
      "@/*": ["./src/*"]
    }
  }
}

Troubleshooting

Common Issues

Wrangler Login Failed

bash
# Clear credentials and retry
npx wrangler logout
npx wrangler login

D1 Database Not Found

bash
# Verify database exists
npx wrangler d1 list

Build Errors

bash
# Clear cache and rebuild
rm -rf node_modules dist
npm install
npm run build

Type Errors

bash
# Regenerate types
npm run cf-typegen

Getting Help

Released under the MIT License.