Logbench is a local log viewer and ingestion service built with TanStack Start, React, and Prisma + SQLite.
It gives you a lightweight UI to create projects, stream logs in real time, inspect log payloads, and delete entries.
- Project-based log organization
- Real-time log updates via Server-Sent Events (SSE)
- JSON log payload rendering with level badges
- Log detail side panel with visual JSON tree and raw syntax-highlighted views
- Bookmark and annotate individual logs with notes
- Fast in-table log search with keyboard shortcut (
Cmd/Ctrl + F) - Source file filter — filter logs by originating source file
- Delete individual logs or bulk clear all logs in a project
- Local SQLite storage through Prisma
- MCP server for AI assistant integration
- TanStack Start + TanStack Router
- React + React Query
- Prisma +
@prisma/adapter-libsql+ SQLite - Tailwind CSS + shadcn/ui
- Vite
- Bun (recommended) or npm
- Node.js 20+
bun installbunx prisma generate
bunx prisma db pushThis creates/updates the local dev.db SQLite database based on prisma/schema.prisma.
bun run devApp runs on http://localhost:1447.
bun run dev- start local dev serverbun run build- build production bundlebun run start- run production build (PORT=1447 node .output/server/index.mjs)bun run preview- preview production buildbun run test- run Vitest test suitebun run lint- run ESLintbun run format- run Prettierbun run check- run Prettier write + ESLint fix
Internal data operations (CRUD for projects and logs) use TanStack Start server functions instead of REST endpoints. These are defined in src/lib/server/ and called directly from React components — no HTTP client needed.
src/lib/server/projects.ts—getProjects,getProject,createProject,updateProject,deleteProjectsrc/lib/server/logs.ts—getLogs,getLog,updateLog,deleteLog,deleteLogs
The ingest endpoint is the only traditional API route, used for external log ingestion:
POST /api/projects/:projectId/logs/ingest- ingest a log payload ({ "content": ..., "level?": ..., "isBookmarked?": ..., "annotation?": ... })GET /api/projects/:projectId/logs/ingest?stream=1- subscribe to SSE events
Example ingest request:
curl -X POST "http://localhost:1447/api/projects/<projectId>/logs/ingest" \
-H "Content-Type: application/json" \
-d '{"content":{"message":"Hello from curl"},"level":"INFO","isBookmarked":true,"annotation":"my note"}'The official JavaScript/TypeScript SDK is available as logbench-js.
bun add -D logbench-jsnpm install -D logbench-jsimport { Logbench } from 'logbench-js'
const logger = new Logbench({
projectId: 'your-project-id',
})
logger.info('Server started on port 3000')
logger.warn('Disk usage above 80%')
logger.err('Failed to connect to database')The SDK provides three log-level methods: info, warn, and err. All methods accept any number of arguments of any type. Values are serialized with superjson, so types like Date, Set, Map, BigInt, and RegExp are preserved.
logger.info('User signed in', { userId: 'abc123', at: new Date() })
logger.err('Request failed', {
status: 500,
headers: new Map([['x-request-id', 'abc']]),
})Errors from the HTTP call are silently caught so logging never crashes your application.
Logbench exposes a local Model Context Protocol (MCP) server at POST /mcp, allowing AI assistants like Claude to read your projects and logs directly.
| Tool | Description |
|---|---|
get_projects |
List all projects with log counts |
get_project |
Get a single project by ID |
get_logs |
List logs for a project (latest 100) |
get_log |
Get a single log by ID |
Add the following to your MCP client config (e.g. Claude Code ~/.claude.json or Cursor settings):
{
"mcpServers": {
"logbench": {
"type": "url",
"url": "http://localhost:1447/mcp"
}
}
}The MCP endpoint is localhost-only and rejects requests from non-local origins.
- Database file (
dev.db) is local and gitignored. - Generated Prisma client is in
generated/prismaand gitignored. - The project header includes a "Copy POST URL" action for quickly sending logs from other local tools.