SG Cars Trends

Overview
This monorepo provides a complete platform for SG Cars Trends, tracking Singapore's car registration statistics and Certificate of Entitlement (COE) data. The system includes:
- Web Application: Next.js 16 frontend with Cache Components, co-located route components, enhanced homepage featuring latest COE results, interactive charts, analytics, AI-generated blog content, and integrated admin interface at
/admin path. Also hosts the data updater workflows.
- Integrated Data Updater: Vercel WDK workflow-based system for fetching and processing LTA data (consolidated into web application)
- LLM Blog Generation: Automated blog post creation using Vercel AI SDK with Google Gemini for market insights (runs within web workflows)
- Social Media Integration: Automated posting to Discord, LinkedIn, Telegram, and Twitter with trackable redirect routes (triggered by web workflows)
- MCP Server: Published npm package for blog post CRUD operations via Claude Code
- Documentation Site: Fumadocs-powered documentation for technical guides and API reference
- Infrastructure: Vercel deployment with automatic CI/CD
System Overview
graph TB
subgraph "Frontend & Workflows"
WEB[Web App<br/>Next.js 16]
BLOG[Blog Posts<br/>AI Generated]
WORKFLOWS[Data Workflows<br/>Vercel WDK]
LLM[Vercel AI SDK<br/>Blog Generation]
end
subgraph "Data Layer"
DB[(PostgreSQL<br/>Neon)]
REDIS[(Redis Cache<br/>Upstash)]
end
subgraph "External APIs"
LTA[LTA DataMall<br/>Gov Data]
end
subgraph "Social Platforms"
DISCORD[Discord]
LINKEDIN[LinkedIn]
TWITTER[Twitter]
TELEGRAM[Telegram]
end
subgraph "Infrastructure"
VERCEL[Vercel<br/>Edge Network]
end
WEB --> WORKFLOWS
WEB --> DB
WEB --> REDIS
WORKFLOWS --> LTA
WORKFLOWS --> DB
WORKFLOWS --> LLM
LLM --> BLOG
WORKFLOWS --> DISCORD
WORKFLOWS --> LINKEDIN
WORKFLOWS --> TWITTER
WORKFLOWS --> TELEGRAM
WEB --> VERCEL
classDef frontend fill:#e1f5fe
classDef backend fill:#f3e5f5
classDef data fill:#e8f5e8
classDef external fill:#fff3e0
classDef social fill:#fce4ec
classDef infra fill:#f1f8e9
class WEB,BLOG,WORKFLOWS,LLM frontend
class DB,REDIS data
class LTA external
class DISCORD,LINKEDIN,TWITTER,TELEGRAM social
class VERCEL infra
Project Structure
sgcarstrends/
├── apps/
│ ├── docs/ # Fumadocs documentation site (Next.js 16)
│ │ ├── content/ # MDX documentation files
│ │ ├── src/app/ # Next.js App Router with docs layout
│ │ └── src/lib/ # Fumadocs source adapter and shared config
│ ├── mcp/ # MCP server for blog post CRUD (published to npm)
│ │ └── src/ # TypeScript server implementation
│ ├── web/ # Next.js 16 frontend application with integrated workflows
│ │ ├── src/app/ # Next.js App Router pages and layouts
│ │ │ ├── (social)/ # Social media redirect routes with UTM tracking
│ │ │ ├── admin/ # Integrated admin interface for content management
│ │ │ ├── blog/ # Blog pages with AI-generated content
│ │ │ └── api/workflows/ # Vercel WDK workflow endpoints
│ │ ├── src/lib/workflows/ # Data updater workflows and social media integration
│ │ ├── src/queries/ # Data fetching queries (cars, COE, logos) with comprehensive tests
│ │ ├── src/actions/ # Server actions (maintenance tasks)
│ │ ├── src/components/ # React components with comprehensive tests
│ │ ├── src/utils/ # Web-specific utility functions
│ │ └── src/config/ # Database, Redis, and platform configurations
├── packages/
│ ├── ai/ # AI-powered blog generation package
│ │ ├── src/generate-post.ts # 2-step blog generation
│ │ ├── src/schemas.ts # Zod schemas for structured output
│ │ └── src/instrumentation.ts # Langfuse telemetry
│ ├── database/ # Database schema and migrations (Drizzle ORM)
│ │ ├── src/schema/ # Schema definitions for all tables
│ │ └── migrations/ # Database migration files
│ ├── logos/ # Car logo management with Vercel Blob storage
│ ├── types/ # Shared TypeScript types
│ ├── ui/ # Shared UI component library (shadcn/ui, Radix UI, Tailwind CSS)
│ │ ├── src/components/ # shadcn/ui components
│ │ ├── src/hooks/ # Custom React hooks
│ │ ├── src/lib/ # Utility functions
│ │ └── src/styles/ # Global styles
│ └── utils/ # Shared utility functions and Redis configuration
Technologies