Introduction
Due to its modular design, the GoFrame
framework can be used as a utility library or for complete business project development.
Considering that most scenarios for using the framework are for developing business projects (microservices projects), the framework also provides some design and practices for engineering development for direct out-of-the-box use.
Precautions
Engineering development design is a complex "discipline." Different teams have different design styles, and in some scenarios, it is often influenced by the preferences of the team leader
.
The engineering development design provided on the framework's official website is based on the author's experience in writing this section and through project pitfalls encountered in Go
practice. It can help solve common engineering development problems, but we do not believe it can meet the preferences of all development teams.
Reviewing all the design sections here and understanding the background and ideas of each piece of design itself is more valuable than directly using framework components and tools.
Documents
📄️ Code Layering
The code layering design of the GoFrame framework, including the MVC design pattern and the 3-tier architecture design. The MVC design pattern is suitable for business scenarios requiring server-side rendered pages, while the 3-tier architecture design emphasizes the idea of high cohesion and low coupling by separating the business logic layer from the data access layer, improving the project's maintainability and flexibility.
📄️ Project Structure🔥
The method of project directory design in the GoFrame framework, based on the three-layer architecture model and improved with modern engineering practices to provide a universal and flexible directory structure design for complex business projects. Directory components include modules such as api, internal, dao, and logic, supporting various business scenarios while encouraging developers to flexibly add or remove directories for specific application implementations.
🗃️ DAO Encapsulation
2 items
📄️ Structured Programming
How to improve code design through structured programming in the GoFrame framework, detailed analysis of unstructured problems encountered in the controller and service layers, and provides the advantages and examples of using structs to manage parameters. By structurally managing interface input and output, it simplifies parameter reception, validation, and conversion processes, boosts productivity, reduces maintenance costs, and facilitates easier interface documentation generation and standardized error handling mechanisms.
📄️ Data and Business Models
Data models and business models in the GoFrame framework, including data models for databases like MySQL, Redis, and input/output models for interface interactions. Detailed explanation of the definition and usage of business input/output models, with a special introduction to the special business model DO integrated with the ORM component to simplify DAO data access operations.
📄️ Mono-Repo Management
GoFrame framework's support for microservices-mono-repo management mode, detailing how to conduct code development and service collaboration in this mode. Discusses the pros and cons of mono-repo management and how to optimize microservice collaboration by dividing repository responsibilities, managing code visibility, unifying image repositories, and more. Also, provides relevant framework commands to help developers efficiently manage and deploy microservice projects.