Alepha has built-in DevTools for development. It's like Redux DevTools but for your entire backend.
1import { Alepha } from "alepha";2import { AlephaDevtools } from "@alepha/devtools";3 4const alepha = Alepha.create()5 .with(AlephaDevtools);6 7// visit http://localhost:3000/devtools
See everything registered in your app:
The DevTools UI shows the last 10,000 log entries, filterable by:
Logs are captured in real-time as your app runs.
DevTools also exposes API endpoints for programmatic access:
GET /devtools # DevTools UI
GET /devtools/metadata # Application metadata as JSON
GET /devtools/logs # Last 10,000 log entries as JSON
When something goes wrong:
New to a codebase? DevTools shows you:
Keep DevTools open while developing:
DevTools exposes internal application details. Don't enable it in production unless you've secured access:
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:
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}
http://localhost:3000/devtools should be in your browser favorites