# Tender Management System A comprehensive tender management backend system built with Go, following Clean Architecture principles with Domain-Driven Design (DDD) patterns. ## ๐Ÿ“š Documentation All documentation has been organized in the [`docs/`](./docs/) directory for better structure and maintainability. ### Quick Links - **[๐Ÿ“– Main Documentation](./docs/README.md)** - Comprehensive project overview and guidelines - **[๐Ÿ”ง Setup Guides](./docs/setup/)** - HTTP server and Swagger setup - **[๐Ÿš€ Implementation Details](./docs/implementation/)** - Architecture and implementation overview - **[๐Ÿ“ก API Examples](./docs/examples/)** - API usage examples and endpoints ## ๐Ÿš€ Quick Start 1. **Setup Environment** ```bash # Follow setup guides in docs/setup/ ``` 2. **Run the Application** ```bash make run ``` 3. **Access API Documentation** - Swagger UI: `http://localhost:8081/swagger/index.html` - API Base URL: `http://localhost:8081/api/v1` ## ๐Ÿ—๏ธ Architecture This system implements **Clean Architecture** with: - **Domain Layer**: Business entities and core rules - **Service Layer**: Business logic and use cases - **Handler Layer**: HTTP controllers and request handling - **Repository Layer**: Data access implementations - **Infrastructure Layer**: External dependencies ## ๐Ÿ“‹ Key Features - **Clean Architecture**: DDD principles with clear separation of concerns - **MongoDB Integration**: Robust data persistence with proper indexing - **Structured Logging**: Comprehensive logging with context - **Input Validation**: Govalidator integration for request validation - **Error Handling**: Consistent error responses and logging - **Time Handling**: Unix timestamps throughout the application - **Generic XML Parser**: Parse any XML structure into Go structs using generics ## ๐Ÿ”ง New Features ### Generic XML Parser A powerful, generic XML parser built with Go generics that can parse any XML structure into Go structs. Perfect for handling complex XML formats like TED (Tenders Electronic Daily) notices. #### Features - **Generic Support**: Parse any XML structure that implements the `Parseable` interface - **Flexible Configuration**: Customizable parsing options for different use cases - **Built-in Validation**: Automatic validation of parsed structures - **Metadata Extraction**: Extract XML metadata and parsing information - **TED XML Support**: Pre-built models for TED contract notices - **Error Reporting**: Detailed error and warning reporting #### Quick Example ```go // Define your XML structure type Contract struct { XMLName xml.Name `xml:"Contract"` ID string `xml:"id,attr"` Name string `xml:"name"` Value string `xml:"value"` } func (c Contract) Validate() error { /* validation logic */ } func (c Contract) GetID() string { return c.ID } // Parse XML parser := xmlparser.NewParser[Contract](nil) contract, err := parser.ParseString(xmlData) ``` See [pkg/xmlparser/README.md](pkg/xmlparser/README.md) for complete documentation and examples. ## ๐Ÿ“ฆ Package Structure ``` โ”œโ”€โ”€ cmd/ # Application entry points โ”œโ”€โ”€ internal/ # Private application code โ”‚ โ”œโ”€โ”€ company/ # Company domain โ”‚ โ”œโ”€โ”€ customer/ # Customer domain โ”‚ โ””โ”€โ”€ user/ # User domain โ”œโ”€โ”€ pkg/ # Public packages โ”‚ โ”œโ”€โ”€ authorization/ # Authorization utilities โ”‚ โ”œโ”€โ”€ logger/ # Structured logging โ”‚ โ”œโ”€โ”€ mongo/ # MongoDB utilities โ”‚ โ”œโ”€โ”€ redis/ # Redis utilities โ”‚ โ”œโ”€โ”€ response/ # HTTP response utilities โ”‚ โ””โ”€โ”€ xmlparser/ # Generic XML parser โ”œโ”€โ”€ infra/ # Infrastructure configuration โ””โ”€โ”€ docs/ # Documentation ``` ## ๐Ÿงช Testing ```bash # Run all tests make test # Test specific package go test ./pkg/xmlparser/... # Test with coverage make test-coverage ``` ## ๐Ÿ› ๏ธ Development ### Prerequisites - Go 1.23+ - MongoDB - Redis (optional) ### Local Development ```bash # Clone repository git clone cd tm_back # Install dependencies go mod tidy # Run tests make test # Start development server make dev ``` ### Adding New Features 1. Follow Clean Architecture principles 2. Implement proper logging in service layer 3. Add comprehensive validation 4. Write unit tests 5. Update documentation ## ๐Ÿ“ Contributing 1. Fork the repository 2. Create a feature branch 3. Follow coding standards 4. Add tests for new features 5. Update documentation 6. Submit a pull request ## ๐Ÿ“„ License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.