feat(phase-0): setup Docker Compose with TypeScript monorepo structure

- 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
This commit is contained in:
Andrei
2025-08-18 07:03:08 +00:00
parent fb63d91b7d
commit 956f1aeadb
28 changed files with 1748 additions and 14 deletions

View File

@@ -0,0 +1,30 @@
import winston from 'winston';
const logger = winston.createLogger({
level: process.env.LOG_LEVEL || 'info',
format: winston.format.combine(
winston.format.timestamp(),
winston.format.errors({ stack: true }),
winston.format.json()
),
defaultMeta: { service: 'redirect-intelligence-api' },
transports: [
// Write all logs with importance level of `error` or less to `error.log`
new winston.transports.File({ filename: 'logs/error.log', level: 'error' }),
// Write all logs with importance level of `info` or less to `combined.log`
new winston.transports.File({ filename: 'logs/combined.log' }),
],
});
// If we're not in production then log to the `console` with the format:
// `${info.level}: ${info.message} JSON.stringify({ ...rest }) `
if (process.env.NODE_ENV !== 'production') {
logger.add(new winston.transports.Console({
format: winston.format.combine(
winston.format.colorize(),
winston.format.simple()
)
}));
}
export { logger };