
Learn clean architecture principles for a modular, scalable, and maintainable back-end with node.js and mongodb, build an enterprise-grade api, and test it with jest.
In this lecture, we will take a look at what our result will be.
What is Clean architecture? Some theoretical knowledge before coding.
In this lecture, we will create a project and a folder structure.
In this lecture, we will create a basic express server for our project.
Set up a node.js user entity by wiring index.js as entry and exporting a user class from user.js, with a constructor accepting an object for id, name, lastName, gender, meta.
Build an in-memory users repository on the inMemoryDb, exporting userRepository with add, update, delete, and getByID, using uuidv4 for IDs.
Learn how to implement unit tests for a users repository with Jest in a Node.js API. Cover add, getByID, update, and delete operations using inMemory storage.
Add and export a product entity in the Node.js API course, using a single object for name, description, images, price, and color with defaults like price zero.
The lecture demonstrates writing and structuring repository tests for a node.js api, covering create, read, update, and delete operations for products using an in-memory setup.
In this lecture, we will create an order entity class that will follow us in the next steps.
Add an in-memory orders repository for the order entity, export it, and adapt the existing repository patterns from the products and users to support orders, then run tests.
Develop and validate comprehensive tests for the orders repository in a Node.js API, including creating, updating, and deleting orders, with mock data and parallel promise handling.
Learn to implement and validate the get user by id use case with tests, using mocks, fake data, and assertions to ensure correct user retrieval in a Node.js API.
Explore updating a user use case in a Node.js API by writing tests, using mock data, and validating integration between models and use case logic.
Execute the delete user use case as the leading user flow, emphasizing modular, dedicated logic with business validation and error checks to keep each use case separate from updates.
Explore a delete user use case test in a Node.js API, demonstrating straightforward integration checks that verify the function returns the expected user data and aligns with repository logic.
Write a product use case test for a Node.js API. Create a test product, mock dependencies, run the use case, and verify the saved product matches the test data.
Test the get product by id use case in a Node.js api. Create a fake id, invoke the use case, and verify product includes id, name, description, images, and price.
Add and export a new update product use case in the Node.js API course, following the existing use case structure and reusing a template to implement update logic.
Develop and test the updated product use case by creating test data, calling the update function, and asserting that the repository returns the updated product.
Create and export the order use cases in a structured Node.js API, enabling testing of business logic with repositories, dependencies, and clear execution flows.
Learn to design and test the create order use case in a Node.js API, covering four use cases, dependencies, and mocks to validate order data.
Explore service contracts and building a consistent response structure for microservices and rest api, including a response class and an error object with status and reason.
Implement a get user by id controller, wire it to the get user by id use case, manage dependencies, and return a json response.
Implement the delete user controller by routing the request to the delete user use case, wrapping the user in an object, and returning a structured response.
Explore building a Node.js API with express routes and user controllers, using in-memory repositories and a rest API for CRUD on users, with error handling and environment-based configuration.
Begin by creating the product controller, wiring routes and dependencies, and connecting the product use case to execute and respond, with error handling using next.
Create the delete product controller and product use case, wire the flow, execute the use case, and use a breakpoint for debugging before moving the product.
Build and test a get product by id controller in a Node.js API using Express, separating logic with a use case to keep controllers decoupled and testable.
Create and initialize an order controller in controllers/orders, export an initialized controller object, wire it to the order use cases, process request body defaults, and handle responses with try/catch.
Learn how to implement an express error handler that catches crashes, structures a proper response object with status 500 and message, and tests robust error handling in a Node.js API.
Shape business validations for adding an order by ensuring the user IP exists, handling validation errors with structured messages and fields, and integrating optional validation libraries in a Node.js API.
Initialize a Mongo connection with Mongoose by loading environment variables and the connection string, and exporting a connect function. Install Mongoose and log successful or failed connections.
Create a user schema using mongoose, define the last name field, export the schema from the schemas folder, and reference related product and order schemas.
Create a Mongo users repository by defining a mongoose model and schema, exporting a reusable repository, and implementing create, update by id, and delete operations.
Learn to build a consistent products and orders repository with a CRUD architecture in a Node.js API, applying architecture principles, validators, dependencies, and Mongo integration.
In this course, we will create Node.js basic shop API using Express.js and MongoDB. We will start this journey by understanding what clean architecture means, and right after will dive deep into coding.
We will start this course using in-memory DB and after that will move our app to MongoDB and Mongoose. I made a decision to make the course this way to show you how it's easy to move from one library to another when you are using good architecture.
We will test out the application using jest with the newest test stack and methodologies.
In this course, you will see how to use dependency injections in a really easy format and what it gives you. We will also make business validations for entity creation and updates. I want to show you how to use the response contracts layer to give one look at your every response from the server.
We will create an Application error handler to handle every exception or error and respond to a formatted response.
After every step of this course, you will have hands-on exercises and an answer right after.
Join this course to make a cool Node.js server. Enjoy and be happy :)