You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These items enhance maintainability and operational stability.
Consistent naming conventions: Standardize action/command naming (e.g., consistently use handle* for local event handlers, sendCommand* for WebSocket actions).
Standardize async patterns: Ensure a consistent approach across the codebase (prefer async/await over mixing with raw Promise.then/.catch chains).
Add JSDoc comments: Implement JSDoc for all public APIs, complex functions, and all TypeScript interfaces/types.
Type safety improvements:
Eliminate any types (especially in test files and error handlers).
Enable stricter TypeScript settings in tsconfig.json (e.g., noImplicitAny, strictNullChecks).
Centralize feature flags: Consolidate environment-based toggles into a single, authoritative configuration object/service.
Create config validation at startup: Implement logic (e.g., using Zod on the server entry point server.ts) to verify that all required environment variables are present and correctly formatted before the server starts.
Add structured logging: Utilize logger.ts consistently across the server-side to log events (e.g., WebSocket connections, API calls, errors) in a structured format (JSON) suitable for aggregation tools.
Implement health check endpoint: Implement and document /health/ready or /health/live to support load balancer and PM2 monitoring.
Error tracking integration: Integrate a simple, low-cost error tracking service (e.g., Sentry free tier) for real-time error reporting.
These items enhance maintainability and operational stability.
handle*for local event handlers,sendCommand*for WebSocket actions).async/awaitover mixing with rawPromise.then/.catchchains).anytypes (especially in test files and error handlers).tsconfig.json(e.g.,noImplicitAny,strictNullChecks).server.ts) to verify that all required environment variables are present and correctly formatted before the server starts.logger.tsconsistently across the server-side to log events (e.g., WebSocket connections, API calls, errors) in a structured format (JSON) suitable for aggregation tools./health/readyor/health/liveto support load balancer and PM2 monitoring.