MCPcopy Index your code
hub / github.com/alexmarqs/nestjs-clean-architecture-example

github.com/alexmarqs/nestjs-clean-architecture-example @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
129 symbols 239 edges 42 files 0 documented · 0% updated 3y ago★ 62

Browse by type

Functions 64 Types & classes 65
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

NestJS Clean Architecture Example

Notifications microservice built with NestJS + Prisma (MySQL DB for test purposes), following a Clean Architecture approach. If you are coming from Java you can always check some of my other repositories using clean architecture, example: https://github.com/alexmarqs/musicweather-api-clean-architecture!

ci workflow

Installation

$ yarn

Diagram

diagram

Open API (Swagger)

$ yarn start:dev

Then, open your browser and go to http://localhost:3000/api

Kafka

We could use Docker (docker-compose) to run Kafka. However this time we will use Upstash, a Redis-like service (free tier) that also provides a Kafka instance. You can check it out here: https://upstash.com/

Running the app

# development
$ yarn start

# watch mode
$ yarn start:dev

# production mode
$ yarn start:prod

# run prisma migrations in dev mode
$ yarn prisma:migrate:dev

# open prisma studio
$ yarn prisma:studio

Test

# unit tests
$ yarn test

# e2e tests
$ yarn test:e2e

# test coverage
$ yarn test:cov

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Method 62
Class 53
Interface 12
Function 2

Languages

TypeScript100%

Modules by API surface

src/application/entities/notification.ts14 symbols
src/infra/http/controllers/notifications.controller.ts10 symbols
src/infra/database/prisma/repositories/prisma-notifications-repository.ts8 symbols
src/infra/database/in-memory/repositories/in-memory-notifications-repository.ts8 symbols
src/application/use-cases/send-notification-use-case.ts6 symbols
src/application/use-cases/get-recipient-notifications-use-case.ts6 symbols
src/application/use-cases/count-recipient-notifications-use-case.ts6 symbols
src/infra/database/prisma/prisma.service.ts5 symbols
src/infra/database/prisma/mappers/prisma-notifications-mapper.ts5 symbols
src/application/use-cases/unread-notification-use-case.ts5 symbols
src/application/use-cases/read-notification-use-case.ts5 symbols
src/application/use-cases/cancel-notification-use-case.ts5 symbols

For agents

$ claude mcp add nestjs-clean-architecture-example \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page