Modernization Initiative: Frontend and Backend Codebase Improvements
Summary
A comprehensive modernization initiative to improve the Darkan website's frontend and backend codebases. This initiative focuses on leveraging the latest features of Next.js 16, React 19, NestJS 11, and TypeScript 5 while improving code quality, maintainability, security, and developer experience.
Current State Analysis
Frontend (Next.js 16 + React 19)
- Framework: Already using Next.js 16.1.1 with Turbopack and React 19.2.3
- Styling: Bulma CSS framework with inline styles in some components
- State Management: Local component state with custom hooks (useAuth, useWebsocket)
- API Client: Manual fetch wrapper with OpenAPI TypeScript for type generation
- Components: Mix of client and server components, some with inline styles
- TypeScript: Strict mode enabled but some areas could use better typing
Backend (NestJS 11)
- Framework: Already using NestJS 11.1.11 with Mongoose 9
- Authentication: JWT-based with Passport, using custom encryption
- API Documentation: Swagger/OpenAPI with SwaggerModule
- WebSockets: Using ws library via NestJS platform-ws
- Rate Limiting: ThrottlerModule with basic configuration
- Error Handling: Basic validation pipe, limited custom error responses
- Testing: Jest configured but minimal test coverage
Goals
Frontend Modernization
- Component Architecture: Establish consistent patterns for client/server components
- State Management: Improve global state handling with React 19 features
- TypeScript Improvements: Strengthen type safety across the codebase
- Error Handling: Implement consistent error boundaries and user feedback
- Performance: Optimize bundle size and implement proper code splitting
- Accessibility: Ensure WCAG compliance across all components
- Testing: Add unit and integration tests for critical components
Backend Modernization
- API Patterns: Standardize response formats and error handling
- Security Enhancements: Review and improve authentication/authorization
- Code Quality: Improve service layer architecture and reduce coupling
- Error Handling: Implement global exception filters with proper logging
- Validation: Strengthen DTO validation and sanitization
- Testing: Increase test coverage for services and controllers
- Documentation: Improve OpenAPI documentation with examples
Infrastructure/Tooling
- CI/CD Improvements: Enhance build and deployment pipelines
- Development Environment: Improve local development experience
- Monitoring: Add better logging and observability
Technical Tickets to Create
Frontend (darkanrs/website)
- Refactor component architecture and establish patterns
- Implement centralized state management solution
- Improve API client with better error handling and caching
- Add error boundaries and loading states
- Implement comprehensive TypeScript improvements
- Add frontend testing infrastructure
Backend (darkanrs/api)
- Standardize API response format and error handling
- Implement global exception filter with logging
- Security audit and improvements
- Strengthen DTO validation across all endpoints
- Improve service layer architecture
- Add comprehensive test coverage
Success Criteria
- All technical tickets completed and reviewed
- Build passes with no TypeScript errors
- Test coverage meets minimum threshold (70% for backend, 50% for frontend)
- No critical security vulnerabilities
- Improved developer experience and code maintainability
Priority
MEDIUM - This is an improvement initiative that should be completed incrementally alongside other work.
Related Links
- Frontend Repository: https://gitlab.com/darkanrs/website
- Backend Repository: https://gitlab.com/darkanrs/api