Ensi Documentation
website·Indexed 33 days ago
https://docs.ensi.tech/Internal technical documentation for Ensi, featuring guides for analysts, backend developers (PHP/Laravel, Go/Goravel), and frontend developers. It covers architectural principles, API guidelines (REST/JSON), Kafka topic naming, local installation (WSL2, Docker), and modeling tools including BPMN, UML, and ERD.
What's inside Ensi
- BPMN (Business Process Model and Notation), specifically version 2.0, is a standardized modeling language used to bridge the gap between the formalization/visualization of a business process and its actual implementation. It is used to model processes to identify adaptation opportunities, improve efficiency, and increase competitiveness.
Overview of Ensi Go logging architecture
Ensi Go services use the Goravelfacades.Log()facade for logging. An adapter inapp/adapters/loggingensures that logs are formatted and delivered to Elasticsearch in a way that is compatible with platform indices. The system supports multiple channels, log levels, and local file storage with centralized search capabilities via Elasticsearch.Overview of BPMN 2.0 for business process modeling
BPMN (Business Process Model and Notation), specifically version 2.0, is a standardized modeling language used to bridge the gap between the formalization/visualization of a business process and its actual implementation. Its primary purpose is to model business processes to identify adaptation opportunities, improve efficiency, and increase competitiveness.Overview of UML for Software Analysis
UML (Unified Modeling Language) is a standardized graphical modeling language used in software development for object modeling, business process modeling, system design, and mapping organizational structures. For analysts, the most commonly used UML diagram types include Activity diagrams, Class diagrams, Sequence diagrams, Statechart diagrams, and UseCase diagrams.Overview of the Ensi documentation engine
The documentation is built using Docusaurus. Contributors should be familiar with Markdown and Docusaurus-specific markdown features. The project uses auto-generated menus, which are configured via_category_.jsonfiles within the documentation structure.Overview of the Ensi automated testing strategy
Ensi employs a testing strategy similar to Spotify's, categorizing automated tests into three distinct groups to ensure service stability and correctness:
- End-to-End (E2E) Tests: Validate the joint operation of multiple services, treating the system as a black box. They use the GUI or public API as entry points and are written by QA engineers in separate repositories.
- Component Tests: Test a service as an isolated unit. These are in-process tests written by backend developers within the same repository as the code.
- Unit and Integration Tests: Target specific classes or public methods to handle edge cases or complex logic that would be too verbose to cover via component tests.
Identify core systems used in Ensi platform development
The development process for the Ensi platform involves three primary systems:
- Yandex Tracker: Used for task definitions and tracking.
- GitLab (ensi): Hosts the platform's source code repositories.
- Jenkins: The automation server used for building and deploying services.
Handle incoming HTTP access logging
Incoming HTTP requests are automatically logged by the
HttpRequestLogmiddleware (configured inbootstrap/app.go). This middleware writes exclusively to theelastic_accesschannel and captures:- HTTP method and path
- Response status
- Processing time
- Body size
- IP address and User-Agent
- Kubernetes metadata (
namespace,pod,service)
Developers should avoid manually logging "request received/sent" in application channels, as this is already covered by the access log.
Understand Agile software development principles
Agile is a family of flexible software development approaches (frameworks or methodologies) that prioritize adaptability over rigid planning. The core values of the Agile Manifesto are:
- Individuals and interactions over processes and tools.
- Working software over comprehensive documentation.
- Customer collaboration over contract negotiation.
- Responding to change over following a plan.
Key operational principles include delivering valuable software early and regularly, welcoming changing requirements even late in development, maintaining a constant pace of sustainable development, and relying on self-organizing teams to produce the best architectural and technical solutions.
Database project structure in Go services
Ensi Go services use the Goravel ORM (
facades.Orm()) for PostgreSQL access. The project follows a specific directory structure to separate database logic from business modules:app/adapters/db/: Contains ORM models (e.g.,brand.go) and their corresponding test factories (e.g.,brand_factory.go).database/migrations/: Contains the PostgreSQL schema definitions.database/seeders/: Contains seeders for local development.bootstrap/migrations.go: A registry of migrations that the application should load.
Key Architecture Rules:
- One table per model file: Models are kept in
adapters/dbrather thanapp/modulesbecause a single model may be used across multiple modules. - DTO vs Model: API DTOs (from OpenAPI in
app/modules/.../dto) are distinct types from ORM models. Models must not be returned directly in API responses; use mappers or DTOFrommethods for conversion.
Understand the purpose of the Catalog Cache service
The Catalog Cache service is used to store aggregated catalog data in Elasticsearch. This architecture is necessary because catalog data is distributed across multiple master services (such as PIM, Offers, and CMS), making it impossible to perform sorting, filtering, and pagination directly from the primary databases. Elasticsearch is utilized specifically for its aggregation capabilities and built-in full-text morphological search for products. For development and debugging, Kibana is used to view the data.Understand Entity Relationship Diagram (ERD) basics in Ensi
Entity Relationship Diagrams (ERD) are used to visually represent databases and the relationships between database elements. An ERD consists of two primary object types: Entities and Relationships. Entities represent objects within the system, and their attributes define their properties (typically including the data type). Relationships define how these entities are connected to one another.