| technology | Backend Architecture | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| domain | backend | ||||||||||||||||||||
| level | Senior/Architect | ||||||||||||||||||||
| version | Agnostic | ||||||||||||||||||||
| tags |
|
||||||||||||||||||||
| ai_role | Senior Backend Architect | ||||||||||||||||||||
| last_updated | 2026-03-22 |
- Primary Goal: Outline the overarching philosophy and standards for Backend and system development inside the ecosystem.
- Target Tooling: Cursor, Windsurf, Antigravity.
- Tech Stack Version: Agnostic
- Adhere to the defined Architectural Patterns when building applications, specifically Hexagonal Architecture / Clean Architecture.
- Avoid tightly coupling business domains to framework-specific libraries.
Important
Constraint: Never allow Database Object Relational Mapping (ORM) models to bleed into standard HTTP responses. Always map through a DTO.
- Security First: Validate all inputs using schema validations. Assume all external input is malicious.
- TypeScript Strictness:
anyis strictly prohibited. Enforce boundary definitions between the transport and core logic layers.
This folder acts as a container for documentation around the following backend technologies:
// Returning database ORM models directly in HTTP responses
app.get('/users/:id', async (req, res) => {
const user = await db.User.findByPk(req.params.id);
res.json(user); // Exposes sensitive database fields like passwords or salts
});Returning database ORM models directly in HTTP responses tightly couples the database schema to the API contract. This exposes sensitive internal fields (like password hashes or internal IDs) and prevents evolving the database schema without breaking API clients.
// Mapping the database entity to a specialized DTO
app.get('/users/:id', async (req, res) => {
const user = await db.User.findByPk(req.params.id);
const userDTO = { id: user.id, username: user.username, email: user.email };
res.json(userDTO);
});Note
Internal Routing: For more context, refer back to the Global Index.
Never allow Database Object Relational Mapping (ORM) models to bleed into standard HTTP responses. Always map through a DTO.