This project is built using Go and follows the principles of Clean Architecture. The structure of the project ensures separation of concerns, making the codebase maintainable, testable, and scalable.
Contains application configurations such as middleware and routing.
-
middlewares
- auth.go: Middleware for authentication, verifying tokens or user credentials for accessing specific endpoints.
- logger.go: Middleware for logging, recording requests and responses for debugging and audit purposes.
-
routes
- routes.go: Sets up the application's routes, connecting HTTP endpoints with the appropriate handlers.
Contains the business logic and domain rules.
- admin
- domain.go: Defines the domain entities and repository interfaces for the admin, specifying the contracts that must be implemented by the repository layer.
- usecase.go: Contains use cases or application services, implementing the business logic related to admin.
Handles HTTP requests and directs them to the appropriate use case.
- admin
- request
- json.go: Defines the JSON request structures for admin, used for parsing data from client requests.
- response
- json.go: Defines the JSON response structures for admin, used for sending data back to clients.
- http.go: Contains the HTTP handlers for requests related to admin, connecting routes with use cases.
- request
- base_response.go: Defines the base response structure used throughout the application.
Handles interactions with external resources such as databases.
- mysql
- admin
- mysql.go: Implementation of the repository for admin using MySQL, connecting to the database and performing CRUD operations.
- record.go: Defines the database model for admin, mapping domain entities to database tables.
- domain_factory.go: Contains code for initializing and connecting all domain parts to the corresponding repositories.
- admin
Contains schema files for the MariaDB database.
- schema.sql: SQL file that defines the MariaDB database schema, including tables, columns, and indexes.
Contains utility functions used throughout the application.
- utils.go: General utility functions that can be used by various parts of the application.
Configuration file that stores environment variables, such as database credentials and other settings.
Docker Compose configuration file that defines the services, networks, and volumes needed to run the application in a Docker environment.
File that defines how to build the Docker image for the application, including installation and configuration steps.
Go module file that defines the module name and dependencies used by the project.
Checksum file to ensure the integrity of dependencies defined in go.mod
.
The main application file containing the main()
function, the entry point of the application.
Documentation file that contains information about setting up, running, and using the application.
This project structure follows clean architecture principles, separating business logic, application logic, and infrastructure details. Each directory and file has a specific role:
- app: Application setup and middleware.
- businesses: Business logic and domain rules.
- controller: HTTP request handlers and request/response handling.
- drivers: Interaction with external resources like databases.
- mariadb: Database schema.
- utils: General utility functions.
- .env: Environment variables.
- docker-compose.yml: Docker Compose configuration.
- Dockerfile: Docker image definition.
- go.mod: Go module dependencies.
- go.sum: Dependency checksums.
- main.go: Application entry point.
- Readme.md: Project documentation.