Admin Dashboard & Operations Overview
Relevant source files
The following files were used as context for generating this wiki page:
- src/app/[locale]/admin/(general)/page.tsx
- src/app/[locale]/admin/integrations/_components/AdminIntegrationsForm.tsx
- src/app/[locale]/admin/events/_components/AdminEventsTable.tsx
- src/lib/db/queries/admin-dashboard.ts
- src/app/[locale]/admin/api/event-creations/ai/route.ts
- src/app/[locale]/admin/events/calendar/new/page.tsx
- src/app/[locale]/admin/affiliate/_components/AdminAffiliateContentClient.tsx
The Admin Dashboard is the central management hub for the prediction market platform, designed to provide administrators with a high-level overview of platform health, user activity, and pending operational tasks. It aggregates data from multiple repositories to present real-time metrics, including event resolution statuses, user growth, and financial history.
Beyond simple monitoring, the admin system facilitates complex operational workflows such as AI-assisted event creation, sports data integration management, and comprehensive platform configuration. These tools ensure that administrators can efficiently maintain market integrity and platform performance.
Dashboard Metrics & Monitoring
The primary dashboard provides a summarized view of critical operational metrics. It utilizes a series of cards to highlight items requiring immediate attention and visualizes long-term trends through sparkline charts.
Key Metrics Tracked
| Metric | Description | Data Source |
|---|---|---|
| Missing Sports ID | Active sports events without a linked external data source ID. | AdminDashboardRepository.getMetrics |
| Pending Resolution | Events that have passed their end time but remain unresolved. | AdminDashboardRepository.getMetrics |
| Resolution Reports | User-submitted proposals for event outcomes awaiting admin review. | ResolutionReportContextRepository |
| Registered Users | Total user count and growth over the last 7 and 30 days. | users table |
| Fee History | Total and daily fees received across Builder and Affiliate programs. | Data API (Fees) |
| Trading Volume | Cumulative site-specific order volume over the last 30 days. | orders table |
Sources: src/app/[locale]/admin/(general)/page.tsx:128-195, src/lib/db/queries/admin-dashboard.ts:47-104
Data Flow for Metrics
The dashboard aggregates data using the AdminDashboardRepository, which performs concurrent SQL queries to fetch counts and time-series data.
The system fills daily series gaps to ensure sparklines represent a continuous 30-day window, even if specific days have zero activity.
Sources: src/lib/db/queries/admin-dashboard.ts:38-45, src/app/[locale]/admin/(general)/page.tsx:150-165
Event Management & Operations
The administration of events is handled through a comprehensive data table that supports filtering, visibility toggles, and detailed configuration of external data integrations.
Operational Actions
Administrators can perform several key actions directly from the event management interface:
- Visibility Control: Toggling
is_hiddenstate to manage event listing in public views. - Livestream Configuration: Adding or updating URLs for event broadcasts.
- Additional Context: Appending custom text to event rules to clarify specific conditions.
- Sports Finalization: Manually entering match scores and segment-specific results (e.g., esports map scores).
Sources: src/app/[locale]/admin/events/_components/AdminEventsTable.tsx:29-33, src/app/[locale]/admin/events/_components/AdminEventsTable.tsx:438-445
Sports Data Integration
For sports and esports events, the dashboard integrates with external providers like TheSportsDB and PandaScore.
AI-Assisted Market Creation
The platform leverages AI (via OpenRouter) to streamline the creation of event rules and to validate market content against deterministic logic and safety guidelines.
Rule Generation Flow
The generation process follows a strict prompt engineering strategy to ensure rules are objective and follow a specific "Polymarket" style.
- Context Assembly: Gathers event title, end date, category, and sports metadata.
- Gamma Sampling: Fetches real rule samples from the Polymarket Gamma API to use as few-shot context for the AI.
- Prompt Execution: Sends a system message enforcing English, objective conditions, and UTC cutoffs.
- Formatting: Repairs punctuation spacing and strips internal field references from the AI output.
Sources: src/app/[locale]/admin/api/event-creations/ai/route.ts:446-521, src/app/[locale]/admin/api/event-creations/ai/route.ts:285-334
Content Validation
The AI validator checks for several error codes before allowing event deployment:
| Code | Validation Check |
|---|---|
english | Checks for language errors, ignoring proper nouns. |
url | Ensures provided resolution source URLs are valid and reachable. |
rules | Detects non-deterministic logic or safety violations (harmful content). |
mandatory | Ensures required fields like outcomes and categories are populated. |
date | Validates that the resolution date is consistent with the event context. |
Sources: src/app/[locale]/admin/api/event-creations/ai/route.ts:607-640
Platform Integrations & Settings
The AdminIntegrationsForm allows for the configuration of third-party services that power various platform features.
Configuration Categories
- AI Providers: Setting OpenRouter API keys and selecting preferred models for automated workflows.
- KYC/Identity: Configuring Sumsub for user verification, including app tokens, secret keys, and enforcement levels (Disabled, Observe, or Required).
- Cross-Chain Fees: Integrating LI.FI for swaps and deposits.
- Custom JavaScript: Adding third-party snippets (e.g., chat widgets or analytics) with the ability to disable them on specific routes like
/adminor/portfolio.
Sources: src/app/[locale]/admin/integrations/_components/AdminIntegrationsForm.tsx:135-240, src/app/[locale]/admin/integrations/_components/AdminIntegrationsForm.tsx:490-550
Summary
The Admin Dashboard & Operations system provides a robust infrastructure for platform governance. By combining automated AI tools for content generation with granular controls for event management and third-party integrations, the system enables efficient scaling and maintenance of the prediction market ecosystem. The architecture ensures that critical data regarding users, fees, and market states are always accessible to decision-makers.