General Architecture Overview and Implementation for Backend Systems
The article presents a practical, layered backend architecture—including gateway, business, and foundation layers—designed to replace simple early‑stage setups, improve maintainability, and handle various protocols such as HTTP and TCP while offering reusable components and technical guidelines.
Introduction: The author, a senior architect, shares a practical, adaptable architecture for startups that evolves from simple LAMP/SSH structures to a more maintainable layered design.
1. General Architecture Overview
Initially startups use simple architectures, but as business complexity grows, monolithic code becomes hard to maintain; adopting a flexible architecture early saves future refactoring.
2. General Architecture Implementation
2.1 Gateway Layer
The gateway layer handles different network protocols (HTTP, TCP, etc.) and abstracts protocol details from downstream services.
2.1.1 HTTP Request
HTTP requests are processed via Tomcat and Spring MVC, with controllers acting as unified gateways that parse parameters, invoke services, and assemble responses while handling exceptions.
2.1.2 TCP Request
TCP requests are handled using Netty or custom protocols; the gateway shields business logic from transport details, similar to RPC frameworks like Dubbo.
2.2 Business Layer
The business layer encapsulates business processes and rules, organized into services, workflows, and components.
2.2.1 Business Services
Services expose domain‑specific interfaces (e.g., OrderService, MemberService) with clear input and output models.
2.2.2 Input Parameters
Write‑method inputs are modeled as hierarchical request objects composed of reusable domain objects (e.g., DishDO, BoardDO).
2.2.3 Output Parameters
Read‑method outputs may be complex composite objects, selectable via query selectors.
2.2.4 Business Process
Processes consist of parameter assembly, rule evaluation, and action execution nodes, which should be decomposed into reusable components.
2.2.5 Business Components & Capabilities
Components are reusable code fragments (parameter assembly, rule judgment, action execution); capabilities are higher‑level reusable combinations (e.g., SMS sending).
2.3 Foundation Layer
The foundation layer provides interface definitions and technical components such as data storage, caching, messaging, scheduling, transactions, and locks.
2.3.1 Interface Definition
Interfaces should be business‑oriented (e.g., insertUser, cacheUser) rather than generic CRUD.
2.3.2 Technical Components
Common components include relational/NoSQL databases, file storage, various cache levels, message queues, scheduled tasks, transaction management, and optimistic/pessimistic locks.
最近面试BAT,整理一份面试资料《Java面试BAT通关手册》,覆盖了Java核心技术、JVM、Java并发、SSM、微服务、数据库、数据结构等等。获取方式:点“在看”,关注公众号并回复 手册 领取,更多内容陆续奉上。Top Architect
Top Architect focuses on sharing practical architecture knowledge, covering enterprise, system, website, large‑scale distributed, and high‑availability architectures, plus architecture adjustments using internet technologies. We welcome idea‑driven, sharing‑oriented architects to exchange and learn together.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.