{"id":19408554,"url":"https://github.com/4lessandrodev/simple-ddd-app-example","last_synced_at":"2025-04-24T09:31:55.847Z","repository":{"id":49329737,"uuid":"401753282","full_name":"4lessandrodev/simple-ddd-app-example","owner":"4lessandrodev","description":"A simple example using types-ddd lib","archived":false,"fork":false,"pushed_at":"2022-07-24T16:06:11.000Z","size":171,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T03:08:03.954Z","etag":null,"topics":["clean-architechture","clean-code","ddd","domain-driven-design","types-ddd"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/types-ddd","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/4lessandrodev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-31T15:27:46.000Z","updated_at":"2023-04-13T05:52:55.000Z","dependencies_parsed_at":"2022-08-25T15:10:28.586Z","dependency_job_id":null,"html_url":"https://github.com/4lessandrodev/simple-ddd-app-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4lessandrodev%2Fsimple-ddd-app-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4lessandrodev%2Fsimple-ddd-app-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4lessandrodev%2Fsimple-ddd-app-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/4lessandrodev%2Fsimple-ddd-app-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/4lessandrodev","download_url":"https://codeload.github.com/4lessandrodev/simple-ddd-app-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250600722,"owners_count":21457018,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clean-architechture","clean-code","ddd","domain-driven-design","types-ddd"],"created_at":"2024-11-10T12:06:33.025Z","updated_at":"2025-04-24T09:31:55.145Z","avatar_url":"https://github.com/4lessandrodev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A simple DDD-Application example\n\n\n## Simple application using `types-ddd` lib from [npm package](https://www.npmjs.com/package/types-ddd).\n\n\u003e Inspired in NestJS framework, but In this project no framework was used, to keep a clean architecture, but feel free to use any framework.\n\n\u003e Built to work with good performance.\n---\n\n## Objectives\n\n\u003e Show how to use [`types-ddd`](https://www.npmjs.com/package/types-ddd) lib\n\n- IUseCase: OK\n- AggregateRoot: OK\n- IMapper: OK\n- ValueObject: OK\n- DomainEvents: OK\n- IDomainEvent: OK\n- IHandle: OK\n- Hooks: OK\n- Tests: OK\n- Entity\n\n---\n\n## How to run this app\n\n\u003e Database is running in memory.\n\n- Clone this repo\n- `$ git clone https://github.com/4lessandrodev/simple-ddd-app-example.git`\n- Install dependencies\n- `$ yarn install` or `$ npm install`\n- Run application\n- `$ yarn dev` or `$ npm run dev`\n\n\n## Available end-points\n\n---\n\n### Postman documentation\n\n[Click to Postman Doc](https://documenter.getpostman.com/view/9702967/U16evoVq)\n\n### POST `localhost:3000/users`\n\u003e Create an user\n\n`Body`\n\n```json\n\n{\n    \"email\":\"valid_email@domain.com\",\n    \"password\":\"test123\",\n    \"name\":\"John Stuart\"\n}\n\n```\n\n---\n\n### POST `localhost:3000/auth`\n\u003e Authenticate\n\n`Body`\n\n```json\n\n{\n    \"email\":\"valid_email@domain.com\",\n    \"password\":\"test123\"\n}\n\n```\n\n`Response Body`\n\n```json\n{\n  \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.WQiOiI4ODAyYjhjOS1iMDljLTQ2M2MtYTI0OC1jODY5MTU0NmI5MW\"\n}\n```\n\n---\n\n### GET `localhost:3000/auth`\n\u003e Get authenticated user\n\n`Headers`\n\n```json\n\n{\n    \"authorization\":\"Bearer \u003ctoken\u003e\"\n}\n\n```\n\n`Response Body`\n\n```json\n{\n    \"id\": \"6043b122-cc60-4f0e-8008-8fcd8089e687\",\n    \"name\": \"John Stuart\",\n    \"email\": \"valid_email@domain.com\",\n    \"password\": \"$2b$10$9rZh7nnnW.WcoGYlt5T.s.YciLzju1j2yr1BITAs9wchTBndLOow2\",\n    \"createdAt\": \"2021-08-31T14:48:24.920Z\",\n    \"updatedAt\": \"2021-08-31T14:48:24.920Z\"\n}\n```\n\n---\n\n### GET `localhost:3000/users`\n\u003e Get registered users\n\n`Headers`\n\n```json\n{ \n    \"authorization\":\"Bearer \u003ctoken\u003e\" \n}\n```\n\n`Response Body`\n\n```json\n[\n    {\n        \"id\": \"6043b122-cc60-4f0e-8008-8fcd8089e687\",\n        \"name\": \"John Stuart\",\n        \"email\": \"valid_email@domain.com\",\n        \"password\": \"$2b$10$9rZh7nnnW.WcoGYlt5T.s.YciLzju1j2yr1BITAs9wchTBndLOow2\",\n        \"createdAt\": \"2021-08-31T14:48:24.920Z\",\n        \"updatedAt\": \"2021-08-31T14:48:24.920Z\"\n    }\n]\n```\n\n---\n\n### POST `localhost:3000/tasks`\n\u003e Create a task todo\n\n`Headers`\n\n```json\n{ \n    \"authorization\":\"Bearer \u003ctoken\u003e\" \n}\n```\n\n`Body`\n\n```json\n\n{\n    \"description\":\"new task todo\",\n    \"isDone\": false\n}\n\n```\n\n--- \n\n### PUT `localhost:3000/tasks/:taskId`\n\n\u003e Mark a task as done\n\n`Headers`\n\n```json\n{ \n    \"authorization\":\"Bearer \u003ctoken\u003e\" \n}\n```\n\n\u003e Only param on url. PUT Method. This method calls a hook by domain event\n\n---\n\n### GET `localhost:3000/tasks`\n\u003e Get registered tasks\n\n`Headers`\n\n```json\n{ \n    \"authorization\":\"Bearer \u003ctoken\u003e\" \n}\n```\n\n`Response Body`\n\n```json\n[\n    {\n        \"id\": \"6043b122-cc60-4f0e-8008-8fcd8089e687\",\n        \"description\": \"new task todo\",\n        \"isDone\": false,\n        \"ownerId\": \"a53989f0-3f55-4a66-997f-7fae4a57646b\",\n        \"createdAt\": \"2021-09-01T01:06:30.435Z\",\n        \"updatedAt\": \"2021-09-01T01:06:30.435Z\"\n    }\n]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F4lessandrodev%2Fsimple-ddd-app-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F4lessandrodev%2Fsimple-ddd-app-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F4lessandrodev%2Fsimple-ddd-app-example/lists"}