Angular 8 + MongoDB example with Node.js Express: Build CRUD App

In this tutorial, I will show you how to make Angular 8 connect to MongoDB with Node.js Express. We’re gonna build a full-stack (MEAN stack) CRUD Application in which, the back-end server uses Node.js + Express for REST APIs, front-end side is an Angular App with HTTPClient.

Angular + MongoDB example with Node.js Express

We will build a full-stack Tutorial Application in that:

  • Tutorial has id, title, description, published status.
  • User can create, retrieve, update, delete Tutorials.
  • There is a search box for finding Tutorials by title.

Here are screenshots of the example.

– Add an object:


– Retrieve all objects:


– Click on Edit button to update an object:


On this Page, you can:

  • change status to Published using Publish button
  • delete the Tutorial using Delete button
  • update the Tutorial details with Update button


– Search Tutorials by title:


Full-stack CRUD App Architecture

We’re gonna build the application with following architecture:


– Node.js Express exports REST APIs & interacts with MongoDB Database using Mongoose ODM.
– Angular Client sends HTTP Requests and retrieves HTTP Responses using HTTPClient, consume data on the components. Angular Router is used for navigating to pages.


This is brief instruction on the Angular Node.js Express MongoDB application.

Node.js Express MongoDB Back-end


These are APIs that Node.js Express App will export:

GETapi/tutorialsget all Tutorials
GETapi/tutorials/:idget Tutorial by id
POSTapi/tutorialsadd new Tutorial
PUTapi/tutorials/:idupdate Tutorial by id
DELETEapi/tutorials/:idremove Tutorial by id
DELETEapi/tutorialsremove all Tutorials
GETapi/tutorials?title=[kw]find all Tutorials which title contains 'kw'

Project Structure


db.config.js exports configuring parameters for MongoDB connection & Mongoose.
Express web server in server.js where we configure CORS, initialize & run Express REST APIs.
– Next, we add configuration for MongoDB database in models/index.js, create Mongoose data model in models/tutorial.model.js.
– Tutorial controller in controllers.
– Routes for handling all CRUD operations (including custom finder) in tutorial.routes.js.


You can find step by step to implement this Node.js Express App in the post:
Node.js, Express & MongoDb: Build a CRUD Rest Api example

Angular 8 Front-end



– The App component is a container with router-outlet. It has navbar that links to routes paths via routerLink.

TutorialsList component gets and displays Tutorials.
Tutorial component has form for editing Tutorial’s details based on :id.
AddTutorial component has form for submission new Tutorial.

– These Components call TutorialService methods which use Angular HTTPClient to make HTTP requests and receive responses.

Project Structure


– There are 3 components: tutorials-list, tutorial-details, add-tutorial.
tutorial.service has methods for sending HTTP requests to the Apis.
app-routing.module.ts defines routes for each component.
app component contains router view and navigation bar.
app.module.ts declares Angular components and import necessary modules.


You can find step by step to implement this Angular App in the post:
Angular 8 CRUD Application example with Web API

Newer version: Angular 10 CRUD Application example with Web API


Now we have an overview of how to make Angular 8 connect to MongoDB with Node.js Express when building a full-stack CRUD App (MEAN stack).

We also take a look at client-server architecture for REST API using Express & Mongoose ODM, as well as Angular 8 project structure for building a front-end app to make HTTP requests and consume responses.

Next tutorials show you more details about how to implement the system:
– Front-end:

Happy learning, see you again!

6 thoughts to “Angular 8 + MongoDB example with Node.js Express: Build CRUD App”

  1. Hey there, hoe you’re keeping well.

    First of all, congratulations on the tutorials. They’re very well detailed and complete. Really cool, so thanks a million for taking the time and effort. I truly appreciate it.

    Now, if it isn’t too much from me to ask, I ran into some issues by the end of it. I’m quite a newbie on Angular and I followed your tutorial on BackEnd first then tried to implement Angular 8 with your FE tutorial. Turns out that the BE worked almost flawlessly but the front end didn’t.

    The HTML does not seem compatible with your screenshots, although the Bootstrap index.html is identical to yours. The buttons on the web app also don’t work, although there is no difference between my code and your GitHub one. Is it possible that I’m missing a step, you think? Or is there something implicit on the postthat I misunderstood.

    Thanks a million 🙂

  2. Hi I am trying to implement same now i am adding another module like student i creates in every file, i created student.route.js also but here also app is exported but this app is used now i getting 404 error can u please help how i will create new module

Leave a Reply

Your email address will not be published. Required fields are marked *