A real-time analytics dashboard built with React + Vite. It provides the Readmigo operations team with multi-dimensional visualizations of user behavior, book performance, subscription revenue, and content statistics. Integrates the PostHog HogQL query engine, the MUI component library, and the Recharts charting system.
The hub for Readmigo product operations. It queries the PostHog data lake and the in-house API in real time for user behavior, reading time, retention funnels, subscription conversion, language distribution, and other key metrics, supporting both day-to-day decisions and long-term growth planning. The backend API is provided by the api project.
- Framework: React 18 + Vite 5
- Language: TypeScript
- UI Components: Material UI (MUI) 6
- Forms and Data: react-admin v5 (enterprise admin framework)
- Charts: Recharts
- Data Fetching: PostHog HogQL API
- Internationalization: ra-i18n-polyglot (EN, ZH-Hans, ZH-Hant)
- Styling: MUI sx prop + brand design tokens (brandTokens.ts)
- Testing: Playwright
graph LR
Browser["Browser<br/>react-admin Admin"]
Pages["Pages<br/>Dashboard, Login,<br/>Operations"]
Components["Components<br/>CustomMenu, Charts,<br/>DataGrid"]
Services["Services<br/>PostHog API,<br/>REST API"]
Config["Config<br/>posthog-queries.ts<br/>analytics-config.ts<br/>brandTokens.ts"]
PostHog["PostHog<br/>HogQL Query Engine"]
API["API<br/>readmigo-api.fly.dev"]
Browser --> Pages
Pages --> Components
Components --> Services
Services --> PostHog
Services --> API
Services --> Config
dashboard/
├── src/
│ ├── components/ # React component library
│ │ ├── CustomMenu.tsx # Navigation menu
│ │ ├── CustomAppBar.tsx # Header navigation bar
│ │ ├── common/ # Common components (cards, forms, etc.)
│ │ └── charts/ # Recharts chart components
│ ├── pages/ # react-admin pages
│ │ ├── Dashboard.tsx # Main dashboard
│ │ ├── Login.tsx # Login page
│ │ ├── Operations.tsx # Operations analytics page
│ │ ├── Users.tsx # User management
│ │ ├── Books.tsx # Book management
│ │ ├── Subscription.tsx # Subscription management
│ │ └── ...
│ ├── services/ # API service layer
│ │ ├── posthog.ts # PostHog HogQL client
│ │ ├── api.ts # REST API client
│ │ └── ...
│ ├── contexts/ # React Context
│ │ ├── TimezoneContext.tsx
│ │ └── ...
│ ├── hooks/ # Custom hooks
│ │ ├── usePostHogQuery.ts
│ │ └── ...
│ ├── i18n/ # Internationalization resources
│ │ ├── en.ts
│ │ ├── zh-Hans.ts
│ │ └── zh-Hant.ts
│ ├── config/ # Application config
│ │ ├── posthog-queries.ts # 12 categories of HogQL query templates
│ │ ├── analytics-config.ts # PostHog params, internal user filtering
│ │ └── theme.ts # MUI theme
│ ├── theme/ # Design tokens
│ │ ├── brandTokens.ts # Colors, shadows, radii, spacing
│ │ └── chartColors.ts # Chart palette
│ ├── App.tsx # Root component (react-admin Admin)
│ ├── main.tsx # Vite entry
│ └── vite-env.d.ts
├── public/ # Static assets
├── tests/ # Playwright E2E tests
├── playwright.config.ts
├── tsconfig.json
└── package.json
- Node.js 20.x
- pnpm (recommended) or npm
# Clone the project
git clone https://github.com/readmigo/dashboard.git
cd dashboard
# Install dependencies
pnpm install
# Set up environment variables
cp .env.example .env.local
# Start the dev server (http://localhost:5173)
pnpm dev
# Production build
pnpm build
# Preview the production build
pnpm preview
# Run Playwright E2E tests
pnpm test
# Run tests visually in the browser
pnpm test:uipnpm lint # ESLint checkAutomated deployment workflow:
- Trigger: Code pushed to the main branch
- Workflow:
.github/workflows/ci.yml - Target: GitHub Pages / Vercel
- URL: https://dashboard.readmigo.com
Manual deployment (if needed):
pnpm build
# Commit the dist/ directory to GitHub Pages, or connect to VercelVITE_POSTHOG_HOST— PostHog instance URL (default: https://us.i.posthog.com)VITE_POSTHOG_PROJECT_ID— PostHog project ID (312868)VITE_POSTHOG_API_KEY— PostHog Personal API Key (requires Dashboard:Write, Insight:Read)VITE_API_URL— Readmigo API base URL (https://readmigo-api.fly.dev)
VITE_APP_TITLE— Application titleVITE_TIMEZONE— Default timezone (UTC+8, etc.)
Contains 12 categories of core HogQL queries:
- DAU / MAU — Daily and monthly active users
- New User Signups — By source (Google OAuth, Apple Sign-In)
- Reading Behavior — Reading starts, reading time, page count
- Retention — D1, D7, D30 user retention
- Subscription Conversion — Paywall views, purchase conversion rate
- Language Distribution — Stats by user locale
- Platform Distribution — iOS/Android/Web/Cloudflare marketing site
- Error Rates — Error counts via Sentry integration
- Push Open Rate — Notification clicks and conversion
- Book Popularity — Top 50 reading volume ranking
- Revenue Metrics — MRR, ARPU, Paywall→Purchase conversion
- Internal User Filtering — Excludes 4 test user IDs
INTERNAL_USER_IDS = [
'88952c83-83f1-4bdc-a7a0-85f3c3e4c2ab', // iOS multi-device
'a14b013d-fd4c-4f23-91e0-41e0dcf92417', // Android Pixel 3a
'7ca8da67-4861-4267-a1b5-be3b357b438d', // Android OnePlus 8Pro
'88c99ab9-4f25-52cc-8999-3e58d559ec41', // iOS iPhone 11 Pro Max
];
LANGUAGE_MAPPING = { en, zh, ja, ko, es, ... }; // ISO 639-1 mapping
DATA_SOURCES = { posthog, amplitude, sentry, checkly, cloudflare, ... };All colors, spacing, and radii must be imported from brandTokens — hardcoded hex values are not allowed:
import { brandColors, semanticColors, textColors, chartPalette } from './brandTokens';- api — Backend API providing data endpoints
- docs — Online documentation and analytics SOP
- posthog — PostHog configuration backup (optional)
- iOS / Android / Web — Frontend applications that emit event data
- Online docs: https://docs.readmigo.app
- Operations analytics SOP: https://docs.readmigo.app/05-operations/monitoring/operations-analysis-playbook
- Daily report template: https://docs.readmigo.app/05-operations/monitoring/operations-analysis-template
- Daily report backfill guide: see the daily-report backfill workflow in
MEMORY.md