171 lines
5.6 KiB
Markdown
171 lines
5.6 KiB
Markdown
# WAG Management API Service v4
|
|
|
|
This service provides a comprehensive API for managing WAG (Wide Area Gateway) systems. It handles configuration, monitoring, and control operations for WAG devices in the network infrastructure.
|
|
|
|
## Quick Start
|
|
|
|
To run the tests using Docker Compose:
|
|
|
|
```bash
|
|
docker compose -f docker-compose.test.yml up --build
|
|
```
|
|
|
|
## Project Structure
|
|
|
|
### Core Services and Components
|
|
|
|
- `Services/` - Core service implementations
|
|
- `PostgresDb/` - PostgreSQL database operations and models
|
|
- `MongoDb/` - MongoDB operations and document models
|
|
- `Redis/` - Redis caching and session management
|
|
- `Email/` - Email notification service
|
|
|
|
- `ApiValidations/` - Request validation and data sanitization
|
|
- Input validation rules
|
|
- Data sanitization filters
|
|
- Schema validation middleware
|
|
|
|
- `ApiLibrary/` - Common utilities and helper functions
|
|
- Shared functions and utilities
|
|
- Common constants and configurations
|
|
- Helper classes and decorators
|
|
|
|
### Configuration and Settings
|
|
|
|
- `AllConfigs/` - Configuration management
|
|
- Database configurations
|
|
- Service settings
|
|
- Environment-specific configs
|
|
|
|
- `Schemas/` - Data models and schema definitions
|
|
- Request/Response models
|
|
- Database schemas
|
|
- API contract definitions
|
|
|
|
### Docker and Deployment
|
|
|
|
- `DockerApiServices/` - API service Docker configurations
|
|
- API service Dockerfile
|
|
- Service dependencies
|
|
|
|
- `DockerStoreServices/` - Storage service Docker configurations
|
|
- Database service Dockerfiles
|
|
- Storage service dependencies
|
|
|
|
### Error Handling and Events
|
|
|
|
- `ErrorHandlers/` - Error handling and exception management
|
|
- Custom exceptions
|
|
- Error handlers
|
|
- Exception middleware
|
|
|
|
- `ApiEvents/` - Event handling and processing
|
|
- Event listeners
|
|
- Event dispatchers
|
|
- Message queue handlers
|
|
|
|
### Language and Testing
|
|
|
|
- `LanguageModels/` - Localization and language support
|
|
- Language files
|
|
- Translation models
|
|
- i18n configurations
|
|
|
|
- `Ztest/` - Test suite
|
|
- Unit tests
|
|
- Integration tests
|
|
- Test fixtures and utilities
|
|
|
|
### Additional Components
|
|
|
|
- `scripts/` - Utility scripts and tools
|
|
- Deployment scripts
|
|
- Database migrations
|
|
- Maintenance utilities
|
|
|
|
|
|
use arcjet @frontend
|
|
|
|
## Architecture Overview
|
|
|
|
This project follows a layered architecture with three core services:
|
|
|
|
### Core Services
|
|
1. **AuthServiceApi**: Authentication and authorization
|
|
2. **EventServiceApi**: Event processing and management
|
|
3. **ValidationServiceApi**: Input and schema validation
|
|
|
|
### System Layers
|
|
- **Dependencies Layer**: External dependencies and requirements
|
|
- **Application Layer**: Core business logic
|
|
- **Service Layer**: API implementations
|
|
- **Test Layer**: Testing infrastructure
|
|
- **Dev Layer**: Development utilities
|
|
- **Root Layer**: Configuration and documentation
|
|
|
|
For detailed architecture documentation, see [System Architecture](docs/architecture/system_architecture.md).
|
|
|
|
## Suggested Improvements
|
|
|
|
The following improvements have been identified to enhance the system:
|
|
|
|
### Infrastructure & Deployment
|
|
- **Service Isolation**: Containerize core services (Auth, Event, Validation)
|
|
- **API Gateway**: Add gateway layer for rate limiting, versioning, and security
|
|
- **Monitoring**: Implement distributed tracing and metrics collection
|
|
- **Configuration**: Move to centralized configuration service with feature flags
|
|
|
|
### Performance & Scaling
|
|
- **Caching Strategy**: Enhance Redis implementation with invalidation patterns
|
|
- **Database**: Implement sharding and read replicas
|
|
- **Event System**: Add message queue (RabbitMQ/Kafka) for event handling
|
|
- **Background Jobs**: Implement job processing and connection pooling
|
|
|
|
### Security & Reliability
|
|
- **API Security**: Implement key rotation and rate limiting
|
|
- **Error Handling**: Add centralized tracking and circuit breakers
|
|
- **Testing**: Add integration tests and performance benchmarks
|
|
- **Audit**: Implement comprehensive audit logging
|
|
|
|
### Development Experience
|
|
- **Code Organization**: Move to domain-driven design
|
|
- **Documentation**: Add OpenAPI/Swagger docs and ADRs
|
|
- **Internationalization**: Create translation management system
|
|
- **Developer Tools**: Enhance debugging and monitoring capabilities
|
|
|
|
For implementation details of these improvements, see:
|
|
- [Architecture Documentation](docs/architecture/system_architecture.md)
|
|
- [Detailed Improvement Plan](docs/improvements/detailed_improvement_plan.md) with code examples and implementation timeline
|
|
|
|
## Development Notes with AI-Windsurf
|
|
|
|
This project uses AI-Windsurf's intelligent note-taking system to maintain comprehensive development documentation. Notes are automatically organized and stored in the `/docs/notes/` directory.
|
|
|
|
### Note Structure
|
|
- **Topic-based Organization**: Notes are categorized by topics (architecture, features, bugs, etc.)
|
|
- **Date Tracking**: All notes include creation and modification dates
|
|
- **Automatic Linking**: Related components and documentation are automatically cross-referenced
|
|
- **Action Items**: Tasks and next steps are tracked within notes
|
|
|
|
### Accessing Notes
|
|
1. Browse the `/docs/notes/` directory
|
|
2. Notes are stored in markdown format for easy reading
|
|
3. Each note follows a standard template with:
|
|
- Overview
|
|
- Technical details
|
|
- Related components
|
|
- Action items
|
|
|
|
### Adding Notes
|
|
Work with AI-Windsurf to add notes by:
|
|
1. Describing what you want to document
|
|
2. Mentioning related components or previous notes
|
|
3. Specifying any action items or follow-ups
|
|
|
|
The AI will automatically:
|
|
- Create properly formatted note files
|
|
- Link related documentation
|
|
- Update existing notes when relevant
|
|
- Track development progress
|
|
|
|
For detailed documentation about specific components, refer to the corresponding files in the `/docs/` directory. |