Skip to content

NodeJS API with Typescript, TDD, Clean Architecture, Design Patterns and SOLID principles.

License

Notifications You must be signed in to change notification settings

giovanivrech/clean-node-api

Repository files navigation

Build Status Coverage Status GPLv3 License Open Source

Clean Node API


This API is part of professor Rodrigo Manguinho's (Mango) training at Udemy.

The objective of the training is to show how to create an API with a well-defined and decoupled architecture, using TDD (test-driven programming) as a working methodology, Clean Architecture to distribute responsibilities in layers, always following the SOLID principles and, whenever possible, applying Design Patterns to solve some common problems.

APIs built in training

  1. Signup
  2. Login
  3. Create survey
  4. List all surveys
  5. Answer survey
  6. Survey results

Principles

  • Single Responsibility Principle (SRP)
  • Open Closed Principle (OCP)
  • Liskov Substitution Principle (LSP)
  • Interface Segregation Principle (ISP)
  • Dependency Inversion Principle (DIP)
  • Separation of Concerns (SOC)
  • Don't Repeat Yourself (DRY)
  • You Aren't Gonna Need It (YAGNI)
  • Keep It Simple, Silly (KISS)
  • Composition Over Inheritance
  • Small Commits

Design Patterns

  • Factory
  • Adapter
  • Composite
  • Decorator
  • Proxy
  • Dependency Injection
  • Abstract Server
  • Composition Root
  • Builder
  • Singleton

Methodologies and Designs

  • TDD
  • Clean Architecture
  • DDD
  • Conventional Commits
  • GitFlow
  • Modular Design
  • Dependency Diagrams
  • Use Cases
  • Continuous Integration
  • Continuous Delivery
  • Continuous Deployment

Libs and Tools

  • NPM
  • Typescript
  • Git
  • Docker
  • Jest
  • MongoDb
  • Travis CI
  • Swagger
  • Bcrypt
  • JsonWebToken
  • Faker
  • Coveralls
  • Validator
  • Express
  • Apollo Server Express
  • Graphql
  • Graphql ISO Date
  • Supertest
  • Husky
  • Lint Staged
  • Eslint
  • Standard Javascript Style
  • Sucrase
  • Nodemon
  • Rimraf
  • In-Memory MongoDb Server
  • MockDate
  • Module-Alias
  • Copyfiles
  • Npm Check
  • Bson ObjectId
  • Apollo Server Integration Testing

Node Features

  • API documentation with Swagger
  • API Rest with Express
  • GraphQL with Apollo Server
  • Error Log
  • Security (Hashing, Encryption e Encoding)
  • CORS
  • Middlewares
  • Routes with permissions (Admin, User e Anonymous)
  • Deploy in Heroku
  • Serve statics files

GraphQL Features

  • Types
  • Queries
  • Mutations
  • Resolvers
  • Directives
  • Scalars
  • Plugins

Git Features

  • Alias
  • Branch
  • Reset
  • Amend
  • Tag
  • Stash
  • Rebase
  • Merge

Typescript Features

  • OOP advanced
  • Interface
  • TypeAlias
  • Namespace
  • Utility Types
  • Paths Modularization
  • Configurations
  • Build
  • Deploy
  • Breakpoints use

Tests Features

  • Unit tests
  • Integration tests (API Rest & GraphQL)
  • Coverage tests
  • Test Doubles
  • Mocks
  • Stubs
  • Spies
  • Fakes

MongoDb Features

  • Connect and Reconnect
  • Collections
  • InsertOne and InserMany
  • Find, FindOne and FindOneAndUpdate
  • DeleteMany
  • UpdateOne
  • Aggregation (Match, Group, Unwind, Lookup, Project, Sort)
  • ObjectId
  • Upsert and ReturnOriginal
  • Push, Divide, Multiply, ArrayElemAt, Cond, Sum
  • Filter, Map, Reduce, MergeObjects, ConcatArrays