Major refactor from simple HTML/JS app to modern full-stack TypeScript application: ## Architecture Changes - Migrated to monorepo structure with workspaces (backend, frontend, shared) - Backend: Node.js + Express + TypeScript + Socket.IO - Frontend: Next.js 15.5 + React 19 + TypeScript + Tailwind CSS - Shared: Common types and utilities across packages ## Key Features Implemented - Real-time WebSocket collaboration via Socket.IO - Virtual canvas with chunked loading for performance - Modern UI with dark mode and responsive design - Mock database system for easy development (Redis/PostgreSQL compatible) - Comprehensive error handling and rate limiting - User presence and cursor tracking - Infinite canvas support with zoom/pan controls ## Performance Optimizations - Canvas virtualization - only renders visible viewport - Chunked pixel data loading (64x64 pixel chunks) - Optimized WebSocket protocol - Memory-efficient state management with Zustand ## Development Experience - Full TypeScript support across all packages - Hot reload for both frontend and backend - Docker support for production deployment - Comprehensive linting and formatting - Automated development server startup ## Fixed Issues - Corrected start script paths - Updated environment configuration - Fixed ESLint configuration issues - Ensured all dependencies are properly installed - Verified build process works correctly 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
27 lines
No EOL
946 B
TypeScript
27 lines
No EOL
946 B
TypeScript
// Database factory that chooses between production and development database
|
|
|
|
// Check if we should use development mode (no Redis/PostgreSQL available)
|
|
const useDevelopmentMode = process.env.NODE_ENV === 'development' &&
|
|
(process.env.USE_MOCK_DB === 'true' || !process.env.REDIS_URL?.includes('://'));
|
|
|
|
let redisClient: any;
|
|
let pgPool: any;
|
|
let initializeDatabase: () => Promise<void>;
|
|
|
|
if (useDevelopmentMode) {
|
|
// Use development mock
|
|
const devDb = require('./database-dev');
|
|
redisClient = devDb.redisClient;
|
|
pgPool = devDb.pgPool;
|
|
initializeDatabase = devDb.initializeDatabase;
|
|
console.log('📦 Using development database (Mock)');
|
|
} else {
|
|
// Use production database
|
|
const prodDb = require('./database');
|
|
redisClient = prodDb.redisClient;
|
|
pgPool = prodDb.pgPool;
|
|
initializeDatabase = prodDb.initializeDatabase;
|
|
console.log('🔥 Using production database');
|
|
}
|
|
|
|
export { redisClient, pgPool, initializeDatabase }; |