- Create monorepo structure with apps/ and packages/ - Add Docker Compose for api, web, db, redis, worker services - Migrate existing Express.js logic to TypeScript with 100% backward compatibility - Preserve all existing API endpoints (/api/track, /api/v1/track) with identical behavior - Setup development environment with hot reload and proper networking - Add comprehensive TypeScript configuration with path mapping - Include production-ready Dockerfiles with multi-stage builds - Maintain existing rate limiting (100 req/hour/IP) and response formats - Add health checks and graceful shutdown handling - Setup Turbo for efficient monorepo builds and development
2.6 KiB
2.6 KiB
Redirect Intelligence v2
A comprehensive URL redirect tracking and analysis platform built with Node.js, React, and PostgreSQL.
🚀 Quick Start
Prerequisites
- Node.js 20+
- Docker & Docker Compose
- Git
Development Setup
-
Clone and setup environment:
git clone <your-repo-url> cd redirect-intelligence-v2 cp .env.example .env -
Start development environment:
npm run devThis will start all services:
- API: http://localhost:3333
- Web: http://localhost:3000
- PostgreSQL: localhost:5432
- Redis: localhost:6379
-
Access the application:
- Main App: http://localhost:3000
- API Docs: http://localhost:3333/api/docs
- Health Check: http://localhost:3333/health
📋 Project Structure
├── apps/
│ ├── api/ # Express.js API server (TypeScript)
│ ├── web/ # React frontend (Chakra UI)
│ └── worker/ # BullMQ background worker
├── packages/
│ ├── database/ # Prisma schema & migrations
│ └── shared/ # Shared types & utilities
└── docker-compose.yml
🔄 Backward Compatibility
All existing API endpoints are preserved:
POST /api/track(legacy)POST /api/v1/trackGET /api/v1/track
Rate limiting: 100 requests/hour per IP (unchanged)
🛠️ Development Commands
# Start all services
npm run dev
# Individual services
npm run dev:api
npm run dev:web
# Database operations
npm run db:migrate
npm run db:studio
npm run db:seed
# Build & test
npm run build
npm run test
npm run lint
📖 API Documentation
Visit http://localhost:3333/api/docs for interactive API documentation.
🔍 Current Status
Phase 0: Complete ✅
- Docker Compose setup
- TypeScript migration
- Monorepo structure
- Backward compatibility preserved
Next: Phase 1 - PostgreSQL + Prisma + Authentication
🧪 Testing
Test the backward compatibility:
# Test legacy endpoint
curl -X POST http://localhost:3333/api/track \
-H "Content-Type: application/json" \
-d '{"url": "github.com"}'
# Test v1 endpoint
curl -X POST http://localhost:3333/api/v1/track \
-H "Content-Type: application/json" \
-d '{"url": "github.com", "method": "GET"}'
📚 Documentation
- Implementation Plan - Detailed phase-by-phase plan
- Original Plan - High-level requirements
🤝 Contributing
See IMPLEMENTATION_PLAN.md for development phases and guidelines.