Co-Pilot
Updated a month ago

sgcarstrends

Ssgcarstrends
0.0k
sgcarstrends/sgcarstrends
82
Agent Score

πŸ’‘ Summary

SG Cars Trends tracks Singapore's car registration statistics and COE data through a comprehensive web platform.

🎯 Target Audience

Data analysts interested in automotive trendsDevelopers looking for a robust API for car dataMarketing professionals needing insights for campaignsCar enthusiasts wanting to stay updated on registrationsGovernment agencies monitoring vehicle statistics

πŸ€– AI Roast: β€œPowerful, but the setup might scare off the impatient.”

Security AnalysisCritical Risk

Risk: Critical. Review: shell/CLI command execution; outbound network access (SSRF, data egress); filesystem read/write scope and path traversal. Run with least privilege and audit before enabling in production.

SG Cars Trends

License: MIT

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.
  • REST API: Hono-based API with type-safe endpoints for car registrations and COE results
  • Integrated Data Updater: QStash 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)
  • Infrastructure: SST v3 serverless deployment on AWS with multi-stage environments

System Overview

graph TB subgraph "Frontend & Workflows" WEB[Web App<br/>Next.js 16] BLOG[Blog Posts<br/>AI Generated] WORKFLOWS[Data Workflows<br/>QStash] LLM[Vercel AI SDK<br/>Blog Generation] end subgraph "Backend Services" API[API Service<br/>Hono Framework] 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" AWS[AWS Lambda<br/>SST v3] end WEB --> API WEB --> WORKFLOWS API --> DB API --> REDIS WORKFLOWS --> LTA WORKFLOWS --> DB WORKFLOWS --> LLM LLM --> BLOG WORKFLOWS --> DISCORD WORKFLOWS --> LINKEDIN WORKFLOWS --> TWITTER WORKFLOWS --> TELEGRAM API --> AWS WEB --> AWS 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 API backend class DB,REDIS data class LTA external class DISCORD,LINKEDIN,TWITTER,TELEGRAM social class AWS infra

Project Structure

sgcarstrends/
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ api/          # REST API service
β”‚   β”‚   β”œβ”€β”€ src/v1/          # API endpoints for data access
β”‚   β”‚   β”œβ”€β”€ src/features/    # Feature modules (cars, coe, deregistrations, health, etc.)
β”‚   β”‚   β”œβ”€β”€ src/lib/         # Utility functions (health checks, date helpers)
β”‚   β”‚   └── src/config/      # Database and Redis configurations
β”‚   β”œβ”€β”€ 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/  # QStash 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, QStash, 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
β”œβ”€β”€ infra/            # SST v3 infrastructure configuration
β”‚   β”œβ”€β”€ api.ts              # API service configuration
β”‚   β”œβ”€β”€ web.ts              # Web application configuration
β”‚   └── router.ts           # Domain routing and DNS management

Technologies

  • Frontend: Next.js 16.1 with Cache Components, React 19.2, TypeScript 5.8
  • UI Library: HeroUI (NextUI successor) with professional design system
  • Styling: Tailwind CSS v4.1 with custom configuration
  • Backend: Node.js 22, TypeScript with strict mode
  • API Framework: Hono with OpenAPI documentation
  • Database: Neon Serverless PostgreSQL with Drizzle ORM
  • Caching: Upstash Redis for API responses and analytics
  • Infrastructure: SST v3 (Serverless Stack) on AWS
  • Scheduling: QStash Workflows for data processing
  • LLM Integration: Vercel AI SDK with Google Gemini for blog content generation
  • Package Management: pnpm v10.22.0 workspace with catalog for centralised dependency management
  • Build Tools: Turbo v2.6.3 for monorepo orchestration, Turbopack for fast development builds
  • Testing: Vitest v4.0.15 (unit), Playwright (E2E) with comprehensive coverage
  • Linting & Formatting: Biome v2.3.0 for consistent code style, formatting, and import organisation

Documentation

For developers working on this codebase, detailed component-specific guidance is available:

  • Root CLAUDE.md - Overall project guidance and conventions
  • API Service - REST API with Hono framework and OpenAPI documentation
  • Web Application - Next.js development, HeroUI components, blog features, and data updater workflows
  • Database Package - Schema management, migrations, and TypeScript integration
  • AI Package - AI-powered blog generation with Vercel AI SDK and Google Gemini
  • Logos Package - Car logo management with Vercel Blob storage
  • UI Package - Shared component library with shadcn/ui and Tailwind CSS
  • Infrastructure - SST deployment, AWS configuration, and domain management

Architecture Documentation

System architecture diagrams are available in the docs/ directory:

Getting Started

Prerequisites

  • Node.js >= 22
  • pnpm v10.22.0

Installation

# Clone the repository git clone https://github.com/sgcarstrends/sgcarstrends.git cd sgcarstrends # Install dependencies pnpm install

Dependency Management

This project uses pnpm catalog for centralised dependency version management. Shared dependencies (React, Next.js, TypeScript, testing tools, etc.) are defined in pnpm-workspace.yaml and referenced by workspace packages using the catalog: protocol.

Key catalog packages:

  • React ecosystem: react (^19.2.3), react-dom (^19.2.3), next (^16.1.0)
  • TypeScript & types: typescript (^5.8.3), @types/node (^22.16.4), @types/react (^19.2.0), @types/react-dom (^19.2.0)
  • Testing tools: vitest (^4.0.15), @vitest/coverage-v8 (^4.0.15)
  • AI & LLM: ai (^6.0.1), @ai-sdk/google (^3.0.6), @langfuse/otel (^4.4.2)
  • Utilities: date-fns (^3.6.0), zod (^4.1.13), sonner (2.0.7)
  • Workflows: @upstash/workflow (0.3.0-rc)

Root-level dependencies (not in catalog):

  • Build tools: sst (3.17.25), turbo (^2.6.3)
  • Code quality: @biomejs/biome (2.3.0), husky (^9.1.7), lint-staged (^16.1.5)
  • Release management: semantic-release (^24.0.0)

This ensures version consistency across all workspace packages and simplifies dependency upgrades.

Development

# Development pnpm dev # Run web application in development mode (SST dev with local stage) pnpm dev:web # Web application only # Working within specific apps cd apps/api && pnpm dev # API service development cd apps/web && pnpm dev # Web application development # Build pnpm build # Build all applications pnpm build:web # Build web application only # Testing pnpm test # Run all unit tests pnpm test:watch # Run tests in watch mode pnpm test:coverage # Run tests with coverage pnpm test:web # Run web tests only # Working within specific apps for testing cd apps/api && pnpm test # API tests only cd apps/web && pnpm test # Web tests only # E2E Testing (Web App) pnpm -F @sgcarstrends/web test:e2e # Run Playwright E2E tests pnpm -F @sgcarstrends/web test:e2e:ui # Run E2E tests with Playwright UI # Code Quality pnpm lint # Run Biome linting on all packages pnpm format # Run Biome formatting on all packages pnpm lint:web # Lint web application only # Working within specific apps for linting cd apps/api && pnpm lint # Lint API service only cd apps/web && pnpm lint # Lint web application on
5-Dim Analysis
Clarity8/10
Novelty7/10
Utility9/10
Completeness8/10
Maintainability9/10
Pros & Cons

Pros

  • Comprehensive data tracking
  • Robust API for developers
  • Automated blog generation for insights
  • Multi-platform social media integration

Cons

  • Complex setup process
  • Dependency on external data sources
  • Requires knowledge of multiple technologies
  • Potential performance issues with large datasets

Related Skills

pytorch

S
toolCode Lib
92/ 100

β€œIt's the Swiss Army knife of deep learning, but good luck figuring out which of the 47 installation methods is the one that won't break your system.”

agno

S
toolCode Lib
90/ 100

β€œIt promises to be the Kubernetes for agents, but let's see if developers have the patience to learn yet another orchestration layer.”

nuxt-skills

S
toolCo-Pilot
90/ 100

β€œIt's essentially a well-organized cheat sheet that turns your AI assistant into a Nuxt framework parrot.”

Disclaimer: This content is sourced from GitHub open source projects for display and rating purposes only.

Copyright belongs to the original author sgcarstrends.