| Dimension | Shared | Only in A | Only in B | Overlap |
|---|---|---|---|---|
| Sections | 0 | 1 | 2 | 0% |
| Commands | 0 | 0 | 3 | 0% |
| Section tags | 1 | 0 | 1 | 50% |
What each file covers
Sections
0 shared · 1 only in A · 2 only in B- − Novu Conventions
- + API Service
- + API Service Conventions
Commands
0 shared · 0 only in A · 3 only in B- + pnpm start:api:dev
- + npm run lint:openapi
- + npm run migration -- ./migrations/<path>.ts
Section tags
1 shared · 0 only in A · 1 only in B- + api
- code-style
Line diff
novuhq/novu · .cursor/rules/novu.mdc
@@ −1 @@
1---
2description:
3globs:
4alwaysApply: true
5---
6### Novu Conventions
7
8- File/directory names: lowercase with dashes (`components/auth-wizard`)
9- Named exports for all components
10- TypeScript: `interface` on the backend, `type` on the frontend — this is the project convention and overrides any general "prefer interfaces" guidance
11- Blank line before every `return` statement
12- Animations: import from `"motion/react"` — not `"framer-motion"` or `"motion-react"`
13- No nested ternaries
14
novuhq/novu · .cursor/rules/api.mdc
@@ +1 @@
1---
2description: Rules for working in the API service (NestJS backend)
3globs: apps/api/**/*
4alwaysApply: false
5---
6
7## API Service
8
9**Stack:** NestJS + Express · MongoDB (via `libs/dal`) · Redis + Bull · ClickHouse (analytics/traces) · Clerk or Better Auth · `@nestjs/swagger`
10
11**Run:** `pnpm start:api:dev` — port 3000, OpenAPI at `http://localhost:3000/openapi`
12
13**Tests/lint:** see testing.mdc
14
15**Key directories:**
16```
17apps/api/src/app/ # Route controllers and modules
18apps/api/src/ee/ # Enterprise-only features
19apps/api/migrations/ # MongoDB migrations
20apps/api/migrations/clickhouse-migrations/ # ClickHouse schema migrations
21```
22
23---
24
25### API Service Conventions
26
27**Controllers**
28- Every protected route must use `@RequireAuthentication()`.
29- Routes accessible via user API keys or the official SDK must also use `@ExternalApiAccessible`.
30- Routes accessible via Clerk OAuth (DCR) access tokens must also use `@OAuthAccessible`.
31- Controller method names follow: `getEntityName`, `listEntityName`, `createEntityName`, `updateEntityName`, `deleteEntityName`.
32- List endpoints must support pagination and use `@SdkUsePagination`.
33- Group SDK endpoints with `@SdkGroupName` using `.` as the subresource separator (e.g., `Subscribers.Notifications`).
34
35**Use-cases (CQRS)**
36- Business logic lives in use-case classes, not controllers.
37- Use-cases receive a typed command/query and return a typed result via `execute(command)`.
38- Never put database queries directly in controllers.
39
40**Database**
41- Always use `libs/dal` repositories for all queries; see dal-repository.mdc for enforcement rules.
42
43**OpenAPI**
44- Every endpoint must have `@ApiOperation`, `@ApiResponse`, and `@ApiTags` decorators.
45- Validate with `npm run lint:openapi` (run with API started) before submitting a PR.
46
47**Migrations**
48- Place migration scripts in `apps/api/migrations/<change-description>/<change-action>.ts`.
49- Run via `npm run migration -- ./migrations/<path>.ts`.
50- Never rename existing migration scripts — they are referenced in user-facing docs.
51
52**Canonical example:** @apps/api/src/app/tenant/tenant.controller.ts
53
@@ −1 +1 @@
11 ---
2−description:
3−globs:
4−alwaysApply: true
2+description: Rules for working in the API service (NestJS backend)
3+globs: apps/api/**/*
4+alwaysApply: false
55 ---
6−### Novu Conventions
76
8−- File/directory names: lowercase with dashes (`components/auth-wizard`)
9−- Named exports for all components
10−- TypeScript: `interface` on the backend, `type` on the frontend — this is the project convention and overrides any general "prefer interfaces" guidance
11−- Blank line before every `return` statement
12−- Animations: import from `"motion/react"` — not `"framer-motion"` or `"motion-react"`
13−- No nested ternaries
7+## API Service
8+
9+**Stack:** NestJS + Express · MongoDB (via `libs/dal`) · Redis + Bull · ClickHouse (analytics/traces) · Clerk or Better Auth · `@nestjs/swagger`
10+
11+**Run:** `pnpm start:api:dev` — port 3000, OpenAPI at `http://localhost:3000/openapi`
12+
13+**Tests/lint:** see testing.mdc
14+
15+**Key directories:**
16+```
17+apps/api/src/app/ # Route controllers and modules
18+apps/api/src/ee/ # Enterprise-only features
19+apps/api/migrations/ # MongoDB migrations
20+apps/api/migrations/clickhouse-migrations/ # ClickHouse schema migrations
21+```
22+
23+---
24+
25+### API Service Conventions
26+
27+**Controllers**
28+- Every protected route must use `@RequireAuthentication()`.
29+- Routes accessible via user API keys or the official SDK must also use `@ExternalApiAccessible`.
30+- Routes accessible via Clerk OAuth (DCR) access tokens must also use `@OAuthAccessible`.
31+- Controller method names follow: `getEntityName`, `listEntityName`, `createEntityName`, `updateEntityName`, `deleteEntityName`.
32+- List endpoints must support pagination and use `@SdkUsePagination`.
33+- Group SDK endpoints with `@SdkGroupName` using `.` as the subresource separator (e.g., `Subscribers.Notifications`).
34+
35+**Use-cases (CQRS)**
36+- Business logic lives in use-case classes, not controllers.
37+- Use-cases receive a typed command/query and return a typed result via `execute(command)`.
38+- Never put database queries directly in controllers.
39+
40+**Database**
41+- Always use `libs/dal` repositories for all queries; see dal-repository.mdc for enforcement rules.
42+
43+**OpenAPI**
44+- Every endpoint must have `@ApiOperation`, `@ApiResponse`, and `@ApiTags` decorators.
45+- Validate with `npm run lint:openapi` (run with API started) before submitting a PR.
46+
47+**Migrations**
48+- Place migration scripts in `apps/api/migrations/<change-description>/<change-action>.ts`.
49+- Run via `npm run migration -- ./migrations/<path>.ts`.
50+- Never rename existing migration scripts — they are referenced in user-facing docs.
51+
52+**Canonical example:** @apps/api/src/app/tenant/tenant.controller.ts
1453
