Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = crlf
end_of_line = lf

[*.md]
max_line_length = off
Expand Down
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text=auto eol=lf
*.{cmd,bat,ps1} text eol=crlf
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
run: npm run lint

- name: Check formatting
run: npm run format -- --check
run: npm run format:check

test:
name: Test
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
needs: lint
services:
mongodb:
image: mongo:5.0.0
image: mongo:7.0
ports:
- 27017:27017
options: >-
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
cache: 'npm'

- name: Install dependencies
run: npm ci
run: npm ci --legacy-peer-deps

- name: Run ESLint
run: npm run lint:report
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# compiled output
/dist
/node_modules
package-lock.json

# Logs
logs
Expand Down
3 changes: 2 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"singleQuote": true,
"trailingComma": "es5",
"printWidth": 120
"printWidth": 120,
"endOfLine": "lf"
}
41 changes: 41 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,46 @@
# Changelog

## [2.0.3] - 2026-07-26

### Changed (hexagonal Phase 1 — base kernel)
- Moved `BaseEntity` from domain to `infrastructure/persistence/typeorm/`
- `BaseRepository<D>` / `BaseService<D>` no longer parameterized by TypeORM entities
- Repository `findAndCount` uses domain `FindAndCountCriteria` (TypeORM translation in adapter only)
- `BaseControllerInterface` lives under presentation; `findOne` returns DTOs via mapper
- Port IDs use `string` (adapters convert to/from `ObjectId`)

### Fixed
- Easy ESLint wins: unused imports/vars, redundant `return await` / useless `async`, missing return types, typed user route params (~36 warnings cleared)
- CI `format:check`: force LF via `.editorconfig` / Prettier / `.gitattributes` (was CRLF locally vs LF on Linux runners)
- TypeScript 6 build: set `rootDir` to `./src`, drop deprecated `baseUrl` (paths made relative)

### Changed (dependencies)
- `npm update --legacy-peer-deps` within caret ranges (NestJS 11.1.28, TypeORM 0.3.31, mongodb 7.5.0, eslint 10.8.0, …)
- Left major bumps alone (AutoMapper 9, TypeScript 7, nodemailer 9, puppeteer 25, sonarqube-scanner 5)
- Add `@eslint/js` (required by flat `eslint.config.js` on ESLint 10)
- Track `package-lock.json` again so CI `npm ci` works; add `format:check` script

### Verified
- Unit tests: 127/127
- E2E tests: 85/85

## [2.0.2] - 2026-07-19

### Changed
- Repository `delete` uses criteria `{ _id }` instead of a bare id argument
- Mailer template path resolves from `process.cwd()/templates` (works in dist and Docker)
- Docker Compose / CI MongoDB image bumped to `mongo:7.0` (matches MongoDB driver 7)
- README badges and tech stack versions synced with `package.json`
- Dependency updates via `npm update --legacy-peer-deps` (NestJS 11.1.28, TypeORM 0.3.31, mongodb 7.5.0, …)
- Enable `esModuleInterop`; E2E specs use default `supertest` import (compatible with newer `@types/supertest`)

### Notes
- TypeORM `Equal()` is **not** used in Mongo persistence: FindOperators are not applied the same way as on SQL and break lookups. Use `Equal()` when forking to MySQL/Postgres (ChainVault pattern).

### Verified
- Unit tests: 127/127
- E2E tests: 85/85

## [2.0.1] - 2026-01-24

### Changed
Expand Down
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

<p>
<a href="https://github.com/BrahimAbdelli/nestier/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg" alt="Node"></a>
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/typescript-5.9-blue.svg" alt="TypeScript"></a>
<a href="https://nestjs.com/"><img src="https://img.shields.io/badge/nestjs-11.1.12-red.svg" alt="NestJS"></a>
<img src="https://img.shields.io/badge/version-2.0.1-orange.svg" alt="Version">
<a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D20.0.0-brightgreen.svg" alt="Node"></a>
<a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/typescript-6.x-blue.svg" alt="TypeScript"></a>
<a href="https://nestjs.com/"><img src="https://img.shields.io/badge/nestjs-11.1.28-red.svg" alt="NestJS"></a>
<img src="https://img.shields.io/badge/version-2.0.3-orange.svg" alt="Version">
</p>
</div>

Expand Down Expand Up @@ -63,11 +63,11 @@ The project follows a strict **hexagonal architecture** (also known as ports & a
The base module provides reusable generic components that other modules can extend:

```
BaseController<T> → CRUD endpoints + search + pagination
BaseService<T> → Business logic for all CRUD operations
BaseRepository<T> → Abstract repository interface (port)
BaseController → CRUD endpoints + search + pagination (DTO in/out)
BaseService<D> → Application orchestration against domain ports
BaseRepository<D> → Abstract repository interface (port, no TypeORM types)
TypeOrmBaseRepository → Concrete TypeORM implementation (adapter)
BaseEntity → Common entity fields (id, timestamps)
BaseEntity → TypeORM persistence model (infrastructure only)
```

## Project Structure
Expand All @@ -84,10 +84,11 @@ src/
│ │ │ ├── ports/ # Service & controller interfaces
│ │ │ └── services/ # BaseService<T> implementation
│ │ ├── domain/
│ │ │ ├── entities/ # BaseEntity
│ │ │ ├── repositories/ # BaseRepository interface (port)
│ │ │ ├── ports/ # FindAndCountCriteria (persistence-agnostic)
│ │ │ ├── repositories/ # BaseRepository<D> interface (port)
│ │ │ └── value-objects/ # Base domain model
│ │ ├── infrastructure/
│ │ │ ├── persistence/typeorm/ # BaseEntity (TypeORM)
│ │ │ └── adapters/ # TypeOrmBaseRepository (adapter)
│ │ ├── presentation/
│ │ │ ├── controllers/ # BaseController factory function
Expand Down Expand Up @@ -351,9 +352,9 @@ docker-compose up -d --build

| Category | Technology |
|----------|------------|
| **Framework** | NestJS 10.3.8 |
| **Language** | TypeScript 5.9 |
| **Database** | MongoDB 6.x |
| **Framework** | NestJS 11.1.x |
| **Language** | TypeScript 6.x |
| **Database** | MongoDB 7.x |
| **ORM** | TypeORM 0.3.x |
| **Authentication** | JWT (jsonwebtoken) |
| **Validation** | class-validator, class-transformer |
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3.9'
services:
backend:
container_name: backend
image: nestier:2.0.1
image: nestier:2.0.3
build:
context: .
target: development
Expand All @@ -23,7 +23,7 @@ services:
MONGO_URL: mongodb://mongodb:27017/shop?serverSelectionTimeoutMS=2000&authSource=admin

mongodb:
image: mongo:5.0.0
image: mongo:7.0
container_name: mongodb
#environment:
#- MONGO_INITDB_ROOT_USERNAME=root
Expand All @@ -33,7 +33,7 @@ services:
ports:
- 27017:27017
healthcheck:
test: echo 'db.runCommand("ping").ok' | mongo localhost:27017/test --quiet
test: echo 'db.runCommand("ping").ok' | mongosh localhost:27017/test --quiet
interval: 30s
timeout: 10s
retries: 3
Expand Down
Loading
Loading