Skip to content

Project Structure

Understanding the project layout helps navigate and extend Uranus effectively.

Directory Overview

uranus/manage/
├── src/                    # Frontend source code
│   ├── main.tsx           # React entry point
│   ├── App.tsx            # Router configuration
│   ├── worker.ts          # Cloudflare Worker entry
│   ├── agent/             # Durable Object implementation
│   ├── pages/             # React page components
│   ├── components/        # Reusable UI components
│   ├── contexts/          # React Context providers
│   ├── hooks/             # Custom React hooks
│   └── lib/               # Utility libraries
├── functions/             # Cloudflare Pages Functions (API)
│   └── api/               # API route handlers
├── lib/                   # Shared backend utilities
├── migrations/            # Database migration files
├── public/                # Static assets
├── dist/                  # Build output
├── schema.sql            # Database schema
├── wrangler.toml         # Cloudflare configuration
├── vite.config.ts        # Vite build configuration
├── tailwind.config.ts    # Tailwind CSS configuration
└── package.json          # Dependencies and scripts

Frontend (src/)

Entry Points

FilePurpose
main.tsxReact DOM rendering, app initialization
App.tsxReact Router configuration, route definitions
worker.tsCloudflare Worker entry, request routing

Pages (src/pages/)

pages/
├── index.tsx              # Dashboard home
├── Login.tsx              # Authentication page
├── Signup.tsx             # User registration
└── agents/                # Agent-specific pages
    ├── state.tsx          # State management UI
    ├── sql.tsx            # SQL query editor
    ├── schedules.tsx      # Task scheduling
    ├── calendar.tsx       # Calendar view
    ├── websocket.tsx      # WebSocket monitoring
    ├── mcp.tsx            # MCP server management
    ├── chat.tsx           # AI chat interface
    ├── tools.tsx          # Tool configuration
    ├── contacts.tsx       # Contact directory
    ├── workflows.tsx      # Visual workflow editor
    ├── services.tsx       # Service integrations
    ├── context.tsx        # Context management
    ├── browser.tsx        # Browser control
    └── settings.tsx       # Agent settings

Components (src/components/)

components/
├── ui/                    # Radix UI components
│   ├── button.tsx
│   ├── input.tsx
│   ├── dialog.tsx
│   ├── dropdown-menu.tsx
│   ├── tabs.tsx
│   └── ...               # 20+ UI primitives
├── layout/
│   └── DashboardLayout.tsx # Main layout wrapper
├── ProtectedRoute.tsx     # Auth route guard
└── scheduling/
    └── CronBuilder.tsx    # Cron expression builder

Contexts (src/contexts/)

ContextPurpose
AuthContext.tsxUser authentication state
AgentContext.tsxCurrent agent selection

Hooks (src/hooks/)

HookPurpose
useAgent.tsAgent data fetching and state
use-mobile.tsxMobile device detection
index.tsHook exports

Library (src/lib/)

FilePurpose
types.tsTypeScript type definitions
api-client.tsFrontend API client
db.tsDatabase utilities
auth.tsAuthentication helpers
response.tsHTTP response helpers
browserbase.tsBrowserbase integration
novnc-browser.tsNoVNC browser client
workflow-codegen.tsWorkflow code generation

Backend (functions/api/)

API Route Structure

functions/api/
├── agents/
│   ├── index.ts           # GET/POST /api/agents
│   └── [id].ts            # GET/PUT/DELETE /api/agents/:id
├── workflows/
│   ├── index.ts           # List/create workflows
│   ├── [id].ts            # CRUD workflow
│   └── execute.ts         # Trigger execution
├── schedules/
│   ├── index.ts           # List/create schedules
│   └── [id].ts            # CRUD schedule
├── calendar/
│   ├── index.ts           # Calendar tasks
│   └── [id].ts            # CRUD calendar task
├── chat.ts                # Chat messages & AI
├── state.ts               # Agent state
├── sql/
│   ├── execute.ts         # Execute SQL
│   └── schema.ts          # Get schema
├── browser/
│   ├── index.ts           # Browser sessions
│   └── [id]/
│       ├── execute.ts     # Browser actions
│       ├── live-view.ts   # Live view
│       └── takeover.ts    # Human takeover
├── contacts/
│   ├── index.ts           # Contact list
│   └── [id].ts            # CRUD contact
├── sources/
│   ├── index.ts           # Data sources
│   ├── search.ts          # RAG search
│   └── [id].ts            # CRUD source
├── mcp/
│   └── index.ts           # MCP servers
├── gateways/
│   ├── index.ts           # Gateways
│   └── [id].ts            # CRUD gateway
├── conversations/
│   └── index.ts           # Conversations
├── agent-connections/
│   └── index.ts           # A2A connections
├── tools/
│   └── index.ts           # Agent tools
├── services/
│   └── [id].ts            # Service config
├── metrics.ts             # System metrics
└── logs.ts                # Event logs

Durable Object (src/agent/)

agent/
└── index.ts               # DashboardAgent class
    ├── constructor()      # Initialize state
    ├── fetch()            # HTTP request handler
    ├── webSocketMessage() # WebSocket handler
    ├── webSocketClose()   # Connection cleanup
    └── alarm()            # Scheduled execution

Shared Library (lib/)

FilePurpose
types.tsBackend type definitions
db.tsDatabase query helpers
response.tsHTTP response utilities
auth.tsAuthentication logic
browserbase.tsBrowserbase SDK wrapper
novnc-browser.tsNoVNC integration

Configuration Files

wrangler.toml

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

[vars]
ENVIRONMENT = "development"

[[d1_databases]]
binding = "DB"
database_name = "agents-dashboard"

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

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

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

vite.config.ts

typescript
export default defineConfig({
  plugins: [react()],
  build: {
    outDir: './dist'
  },
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src')
    }
  }
})

tailwind.config.ts

typescript
export default {
  darkMode: ['class'],
  content: ['./index.html', './src/**/*.{ts,tsx}'],
  theme: {
    extend: {
      colors: {
        sidebar: { /* custom colors */ }
      }
    }
  }
}

Database Files

FilePurpose
schema.sqlMain database schema
migrations/002_multi_agent.sqlMulti-agent support
migrations/003_agent_auth.sqlAccess control
migrations/004_workflow_executions.sqlExecution tracking
migrations/005_cloudflare_settings.sqlCF integration
migrations/006_browser_actions_types.sqlBrowser actions
migrations/007_puppeteer_action_types.sqlPuppeteer actions

Build Output

dist/
├── index.html            # Entry HTML
├── assets/
│   ├── index-[hash].js   # Main bundle
│   ├── index-[hash].css  # Styles
│   └── ...               # Chunks
└── ...                   # Static assets

Released under the MIT License.