Skip to content

feat: add admin API requests log viewer page#180

Open
kiloconnect[bot] wants to merge 1 commit intomainfrom
feat/admin-requests-page
Open

feat: add admin API requests log viewer page#180
kiloconnect[bot] wants to merge 1 commit intomainfrom
feat/admin-requests-page

Conversation

@kiloconnect
Copy link
Contributor

@kiloconnect kiloconnect bot commented Feb 13, 2026

Summary

Adds an admin-only page at /admin/requests for searching and viewing API request logs from the api_request_log table. This is a walking skeleton — functional end-to-end.

Changes

Backend

  • src/routers/admin-requests-router.ts — New tRPC router with list and getById procedures, protected by adminProcedure
    • list: Supports pagination, date range filtering (startTime/endTime), exact request ID match, and fulltext search (ILIKE across user ID, org ID, provider, model, and ID)
    • getById: Returns a single request log entry by ID
  • src/routers/admin-router.ts — Mounted new router as requests

Frontend

  • src/app/admin/requests/page.tsx — Server component page following existing admin page pattern
  • src/app/admin/components/RequestsTable.tsx — Client component with URL-driven state, search filters (request ID, date range, fulltext), results table with color-coded status badges, and pagination
  • src/app/admin/components/RequestDetailDialog.tsx — Detail dialog with "Overview" (structured fields) and "Raw JSON" tabs
  • src/app/admin/api/requests/hooks.ts — tRPC query hooks
  • src/app/admin/components/AppSidebar.tsx — Added "API Requests" link under Analytics & Observability

Tests

  • src/routers/__tests__/admin-requests-router.test.ts — Tests for auth guard, list query shape, filters (requestId, date range, query search), pagination, and getById

How to Test

  1. Log in as an admin user
  2. Navigate to /admin/requests via the sidebar or directly
  3. Try searching by request ID, date range, or fulltext query
  4. Click a row to see the detail dialog with structured and raw JSON views

Built for Marius Wichtner by Kilo for Slack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants