Next.js 14 dashboard for visualizing GitHub trending analytics with real-time data from PostgreSQL.
Server-side rendered (SSR) dashboard that displays:
- Top trending repositories across Python, TypeScript, Go
- Render ecosystem projects spotlight
- Momentum scores and analytics
- Historical trends and rankings
- Workflow execution traces
app/ # Next.js App Router
├── page.tsx # Home page (server component)
├── layout.tsx # Root layout
├── globals.css # Global styles + animations
└── api/
└── workflow-status/
└── route.ts # API endpoint for workflow traces
components/ # React components
├── HomeClient.tsx # Client wrapper with state management
├── RepoCard.tsx # Repository card with metadata
├── ScrollableRow.tsx # Horizontal scrolling container
├── TaskTimeline.tsx # Workflow execution timeline
├── TaskTree.tsx # Hierarchical task visualization
├── WorkflowPanel.tsx # Workflow trace viewer
├── ReadmePanel.tsx # Markdown README viewer
├── Header.tsx # Site header
├── TypingTagline.tsx # Animated typing effect
└── LoadingSkeleton.tsx # Loading states
lib/ # Utilities
├── db.ts # PostgreSQL connection & queries
├── formatters.ts # Data formatting helpers
├── content.ts # Copy text content
└── markdown.ts # Markdown rendering (marked.js)
- Data fetched on server via PostgreSQL queries
- Fast initial page load with pre-rendered content
- Automatic revalidation on navigation
- Language-specific icons (Python, TypeScript, Go, Render)
- Star counts with formatting (1.2k, 3.4M)
- Momentum scores with visual indicators
- README previews with markdown rendering
- Real-time workflow status polling
- Interactive task tree with expand/collapse
- Execution timeline with color-coded states
- Duration calculations
- Horizontal scrolling for repo lists
- Mobile-optimized layouts
- Smooth animations (Framer Motion)
- Loading skeletons for better UX
The dashboard queries these analytics views:
| View | Purpose |
|---|---|
analytics_trending_repos_current |
Top repos across all languages |
analytics_render_showcase |
Render ecosystem projects |
analytics_language_rankings |
Per-language leaderboards |
analytics_language_trends |
Aggregate statistics |
fact_workflow_runs |
Workflow execution traces |
const repos = await pool.query(`
SELECT
repo_full_name,
language,
stars,
momentum_score,
description,
readme_content
FROM analytics_trending_repos_current
ORDER BY momentum_score DESC
LIMIT 25
`);Client component - Manages UI state and interactions.
Features:
- Repository filtering by language
- README panel toggle
- Workflow trace panel toggle
- Local state management
Display component - Shows repository metadata.
Props:
{
repo: Repository;
onClick?: () => void;
rank?: number;
showLanguage?: boolean;
}Displays:
- Language icon
- Repo name (owner/name split)
- Description (truncated)
- Stars + momentum score
- Creation date
Interactive component - Visualizes workflow execution.
Features:
- Fetches latest workflow run from
/api/workflow-status - Polls every 3 seconds if workflow is running
- Displays task tree with expand/collapse
- Shows execution timeline
States:
- Loading: Fetching workflow data
- Running: Active execution with live updates
- Completed: Final results with duration
- Failed: Error message and trace
Modal component - Renders markdown README content.
Features:
- Markdown rendering via marked.js
- Syntax highlighting (if configured)
- Sanitized HTML output (DOMPurify)
- Smooth slide-in animation
- Click outside to close
Visualization component - Horizontal timeline of task execution.
Props:
{
tasks: Task[];
startTime: Date;
endTime: Date;
}Features:
- Color-coded status bars (green=completed, yellow=running, red=failed)
- Duration labels
- Proportional widths based on execution time
Hierarchical component - Recursive task tree visualization.
Props:
{
task: TaskNode;
level?: number;
}Features:
- Expand/collapse nested tasks
- Color-coded status indicators
- Indentation for hierarchy
- Duration display
- Utility-first styling
- Responsive breakpoints
- Custom color palette (purple accents)
@keyframes fade-in-up
@keyframes pulse-slow
@keyframes shimmer
@keyframes gradient-shiftUsage examples:
animate-fade-in-up: Card entrance animationsanimate-pulse-slow: Loading statesanimate-shimmer: Skeleton loadersanimate-gradient-shift: Background effects
# Required
DATABASE_URL=postgresql://...
# Optional
NEXT_PUBLIC_API_URL=https://trender-dashboard.onrender.com
NODE_ENV=productioncd dashboard
npm install
npm run dev
# Visit http://localhost:3000Hot reload: Changes auto-refresh in browser
npm run build
npm startOptimizations:
- Static page generation where possible
- Image optimization
- CSS minification
- JavaScript tree-shaking
Returns:
{
"run_id": "wfr_abc123",
"status": "completed",
"started_at": "2026-02-02T12:00:00Z",
"completed_at": "2026-02-02T12:00:15Z",
"task_tree": { ... },
"repos_processed": 150,
"execution_time_seconds": 15.2
}Error handling:
- Returns latest run, or empty object if none found
- Logs database errors to console
- Never crashes (graceful degradation)
| Issue | Solution |
|---|---|
| "Cannot connect to database" | Check DATABASE_URL in .env |
| No data displayed | Ensure workflow has run at least once |
| Styles not loading | Run npm install to install Tailwind |
| API errors in console | Verify PostgreSQL views exist |
| Slow page loads | Check database query performance |
- Server components: Use by default for data fetching
- Client components: Only for interactivity (marked with 'use client')
- Image optimization: Use Next.js
<Image>component - Code splitting: Automatic via Next.js App Router
- Database indexes: Ensure indexes on frequently queried columns
See package.json:
Core:
next: Frameworkreact,react-dom: UI librarypg: PostgreSQL clienttypescript: Type safety
UI/styling:
tailwindcss: Utility CSSframer-motion: Animationsrecharts: Charts (if used)
Markdown:
marked: Markdown parserdompurify: HTML sanitization
- Create feature branch
- Test locally:
npm run dev - Build check:
npm run build - Deploy: Push to GitHub (auto-deploy)
- Monitor: Check dashboard.onrender.com