alepha@docs:~/docs/guides/observability$
cat 4-devtools.md
2 min read
Last commit:

#DevTools

Alepha has built-in DevTools for development. It's like Redux DevTools but for your entire backend.

#Setup

typescript
1import { Alepha } from "alepha";2import { AlephaDevtools } from "@alepha/devtools";3 4const alepha = Alepha.create()5  .with(AlephaDevtools);6 7// visit http://localhost:3000/devtools

#Features

#Application Metadata

See everything registered in your app:

  • Actions - All HTTP endpoints with their schemas
  • Schedulers - Cron jobs and their schedules
  • Queues - Background job queues
  • Topics - Pub/sub topics
  • Buckets - File storage buckets
  • Caches - Cached computations
  • Realms - Authentication realms
  • Pages - React SSR pages
  • Modules - Registered modules and their services

#Live Logs

The DevTools UI shows the last 10,000 log entries, filterable by:

  • Log level (trace, debug, info, warn, error)
  • Module name
  • Search text

Logs are captured in real-time as your app runs.

#API Endpoints

DevTools also exposes API endpoints for programmatic access:

bash
GET /devtools           # DevTools UI
GET /devtools/metadata  # Application metadata as JSON
GET /devtools/logs      # Last 10,000 log entries as JSON

#Use Cases

#Debugging

When something goes wrong:

  1. Open DevTools
  2. Filter logs by the relevant module
  3. See exactly what happened

#API Discovery

New to a codebase? DevTools shows you:

  • All available endpoints
  • Their request/response schemas
  • What queues and schedulers exist

#Development Workflow

Keep DevTools open while developing:

  • See requests as they come in
  • Watch background jobs execute
  • Monitor scheduler triggers

#Production Warning

DevTools exposes internal application details. Don't enable it in production unless you've secured access:

typescript
1import { AlephaDevtools } from "@alepha/devtools";2 3const alepha = Alepha.create();4 5if (process.env.NODE_ENV !== "production") {6  alepha.with(AlephaDevtools);7}

Or protect it with authentication:

typescript
 1import { $route } from "alepha/server"; 2  3class SecureDevtools { 4  devtools = $route({ 5    method: "GET", 6    path: "/devtools/*", 7    handler: async (c) => { 8      const token = c.req.header("Authorization"); 9      if (token !== `Bearer ${process.env.DEVTOOLS_TOKEN}`) {10        return c.text("Unauthorized", 401);11      }12      // proxy to devtools...13    },14  });15}

#Tips

  1. Bookmark it - http://localhost:3000/devtools should be in your browser favorites
  2. Use log filtering - Don't scroll through thousands of logs, filter by module
  3. Check metadata first - When debugging, see what's registered before diving into logs
  4. Keep it open - Run it alongside your app during development
On This Page
No headings found...
ready
mainTypeScript
UTF-8guides_observability_devtools.md