Environment Setup
Configure your development and production environments for Uranus.
Prerequisites
Required Software
| Software | Version | Purpose |
|---|---|---|
| Node.js | 18.x+ | JavaScript runtime |
| npm/pnpm | Latest | Package management |
| Git | Latest | Version 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/manage2. Install Dependencies
bash
npm install3. Configure Wrangler
Login to Cloudflare:
bash
npx wrangler login4. 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=cosine5. 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.sql7. Start Development Server
bash
# Start Wrangler dev server
npm run devAccess 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
| Variable | Description | Required |
|---|---|---|
ENVIRONMENT | Runtime environment (development/production) | Yes |
BROWSERBASE_PROJECT_ID | Browserbase project identifier | No |
BROWSERBASE_API_KEY | Browserbase API key | No |
CF_ACCESS_AUD | Cloudflare Access audience tag | No |
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 = 30Workers AI
Edge AI inference (automatic, no config needed).
Development Modes
Full Development
Run frontend and backend together:
bash
npm run devFrontend Only
Hot-reload React development:
bash
npm run dev:frontendThen proxy API calls to Wrangler.
Preview Build
Test production build locally:
bash
npm run previewIDE Configuration
VS Code Settings
.vscode/settings.json:
json
{
"typescript.tsdk": "node_modules/typescript/lib",
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode"
}Recommended Extensions
- ESLint
- Prettier
- Tailwind CSS IntelliSense
- TypeScript Hero
TypeScript Configuration
Generate Cloudflare Types
bash
npm run cf-typegenThis 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 loginD1 Database Not Found
bash
# Verify database exists
npx wrangler d1 listBuild Errors
bash
# Clear cache and rebuild
rm -rf node_modules dist
npm install
npm run buildType Errors
bash
# Regenerate types
npm run cf-typegenGetting Help
- Check Cloudflare Workers docs
- Review D1 documentation
- Join Cloudflare Discord