Architecture
Nevr uses a layered architecture with clear separation of concerns.
Overview
┌─────────────────────────────────────────┐
│ HTTP Framework │
│ (Express, Hono, etc.) │
├─────────────────────────────────────────┤
│ Adapters │
│ (expressAdapter, etc.) │
├─────────────────────────────────────────┤
│ NEVR CORE │
│ ┌─────────┐ ┌─────────┐ ┌──────────┐ │
│ │Entities │ │Workflows│ │ Services │ │
│ ├─────────┤ ├─────────┤ ├──────────┤ │
│ │ Actions │ │ Plugins │ │ Remote │ │
│ │ Rules │ │ Hooks │ │ Joiner │ │
│ └─────────┘ └─────────┘ └──────────┘ │
├─────────────────────────────────────────┤
│ Enhanced Driver │
│ (Validation, Transforms, Security) │
├─────────────────────────────────────────┤
│ Database Driver │
│ (Prisma, Drizzle) │
└─────────────────────────────────────────┘Layers
1. Adapters Layer
Converts HTTP framework requests to Nevr's internal format.
typescript
import { expressAdapter } from "nevr/adapters/express"
import { honoAdapter} from "nevr/adapters/hono"2. Core Layer
The heart of Nevr:
| Component | Purpose |
|---|---|
| Entities | Data model definitions |
| Actions | Custom operations |
| Workflows | Multi-step with saga |
| Services | Dependency injection |
| Plugins | Reusable extensions |
| Remote Joiner | External data stitching |
3. Enhancement Layer
Automatic data processing:
- Validation - Field and cross-field validation
- Transforms - Data transformation (trim, lowercase)
- Security - Password hashing, encryption, field omission
4. Driver Layer
Database abstraction:
typescript
import { prisma } from "nevr/drivers/prisma"
const driver = prisma(new PrismaClient())Request Flow
Request → Adapter → Router → Middleware → Hooks → Handler → Driver → Response- Adapter converts HTTP request
- Router matches entity/action
- Middleware processes (auth, logging)
- Hooks fire (beforeCreate, etc.)
- Handler executes operation
- Driver interacts with database
- Response returned through adapter
