This monorepo provides a unified backend service for SG Cars Trends, tracking Singapore's car registration statistics and Certificate of Entitlement (COE) data. The system includes:
- REST API: Data access endpoints for car registrations and COE results
- Integrated Data Updater: Workflow-based system for fetching and processing LTA data
- Social Media Integration: Automated posting to Discord, LinkedIn, Telegram, and Twitter
backend/
├── apps/
│ └── api/ # Unified API service with integrated updater
│ ├── src/v1/ # API endpoints for data access
│ └── src/updater/ # Data update workflows and social media integration
├── packages/
│ ├── schema/ # Database schema using Drizzle ORM
│ ├── types/ # Shared TypeScript types
│ └── utils/ # Shared utility functions
- Backend: Node.js, TypeScript
- Framework: Hono
- Database: Neon Serverless PostgreSQL with Drizzle ORM
- Caching: Upstash Redis
- Infrastructure: SST (Serverless Stack)
- Scheduling: QStash Workflows
- Package Management: pnpm workspace
- Build Tools: Turbo
- Testing: Vitest
- Linting: Biome
- Node.js >= 18
- pnpm
# Clone the repository
git clone https://github.com/sgcarstrends/backend.git
cd backend
# Install dependencies
pnpm install
# Run the unified API service
pnpm -F @sgcarstrends/api dev
# Run all tests
pnpm test
# Run tests with coverage
pnpm test:coverage
# Run linting
pnpm lint
# Deploy the API (includes updater functionality)
pnpm -F @sgcarstrends/api deploy
GET /v1/cars
- Car registration dataGET /v1/coe
- COE bidding resultsGET /v1/coe/pqp
- COE Prevailing Quota Premium ratesGET /v1/makes
- Car manufacturersGET /v1/months/latest
- Latest month with data
POST /updater/workflows/trigger
- Trigger data update workflowsPOST /updater/workflow/cars
- Car data workflowPOST /updater/workflow/coe
- COE data workflowPOST /updater/linkedin
- LinkedIn posting webhookPOST /updater/twitter
- Twitter posting webhookPOST /updater/discord
- Discord posting webhookPOST /updater/telegram
- Telegram posting webhook
MIT