CRUD APP with Nodejs, Cloudinary, PostgreSQL and Heroku
Tags: node, postgres, cloudinary, tutorial
Published: 2020-08-23 23:03:43

# Introduction
Life in web development keep getting better with many beautiful tools available to us. These tools are also free. Allow me to introduce a few to you and teach you how to use them to build a simple application.

### Express

![Express Node](https://i2.wp.com/airbrake.io/blog/wp-content/uploads/2019/12/Screen-Shot-2019-12-26-at-3.26.12-PM.png?resize=465%2C173&ssl=1) 

[Express](https://www.npmjs.com/package/express) is a Fast, unopinionated and minimalist web framework for [Node.js](https://nodejs.org/). It is a highly sort out framework with more than 13 million weekly downloads.

### Cloudinary

![Cloudinary](https://i0.wp.com/softwaredaily.wpengine.com/wp-content/uploads/2016/02/cloudinary-logo.jpg?resize=260%2C130)

[Cloundinary](https://www.npmjs.com/package/cloudinary) has been taking the lead in managing images. You can use it to efficiently create, manage, and deliver images, videos and other media, personalized and optimized for every device and channel.

### PostgreSQL

![PostgreSQL](https://www.quest.com/community/cfs-filesystemfile/__key/communityserver-components-secureimagefileviewer/communityserver-blogs-components-weblogfiles-00-00-00-00-39/Slide2.JPG_2D00_1100x500x2.jpg?_=637219525519183603)

[PostgreSQL](https://www.postgresql.org/) is a powerful, open source object-relational database system with over 30 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance.

### Heroku

![Heroku](https://miro.medium.com/max/1200/1*kg8aAUNxI055OhNhT04srQ.png)

[Heroku](https://www.heroku.com/) is a platform as a service (PaaS) that enables developers to build, run, and operate applications entirely in the cloud. In order words, it provides you a place to host your application.

Now you see how powerful these tools are. Perhaps you also see why these tools are so popular in web development. In this article, I will take you from the scratch step by step on how to bring these tools together to create an application. 

The end product will be a CRUD (Create, Read, Update, Delete) application which allows you to upload images to cloudinary (Create), retrieve the image (Read), edit the image (Update) and destroy the record (Delete). Let's get started.

# Building a CRUD Application
## Create a server

![Server](https://www.colocationamerica.com/images/web-vs-app-server.jpg)

This is where nodejs applications begin. This is the initial setup that will be the foundation of every other thing. In the article below, I explained how to build a Simple, Secure and Robust Node JS Server

> [Setting Up a Simple, Secure and Robust Node JS Server](https://dev.to/ebereplenty/setting-up-a-simple-secure-and-robust-node-js-server-10n0)

## Introduction to Cloudinary
Here, I show step by step how you can upload images to cloudinary with just nodejs. Read Below:

> [Image Upload to Cloudinary with Nodejs and Dotenv](https://dev.to/ebereplenty/image-upload-to-cloudinary-with-nodejs-and-dotenv-4fen)

## Upload and Retrieve Images

![Upload Image](https://pp.netclipart.com/pp/s/251-2515071_upload-button-clipart-circle-upload-button.png)

Now, after uploading our images to cloudinary through nodejs, it is almost useless if we can not retrieve or use them. This is where PostgreSQL comes to play. In the next article, I teach you how to keep the record of each image you upload

> [Cloudinary and Postgresql - Persisting and Retrieving Images Using Nodejs](https://dev.to/ebereplenty/cloudinary-and-postgresql-persisting-and-retrieving-images-using-nodejs-31b2)

## Update and Delete Images

![Delete](https://premium.wpmudev.org/blog/wp-content/uploads/2012/08/delete-big.jpg)

Sometimes certain data or information might become useless and so we may need to either update them or delete them totally. In the article that follow, I will guide you on how to update the image you uploaded and/or delete it if you wish. Read below:

> [Cloudinary and Postgresql - Deleting and Updating Images Using Nodejs](https://dev.to/ebereplenty/cloudinary-and-postgresql-deleting-and-updating-images-using-nodejs-l8d)

## Restructuring Our Code

![Restructure](https://www.matrixmanagementinstitute.com/wp-content/uploads/2018/03/After-a-Restructure-How-to-Develop-Change-Agents.jpg)

You must have noticed that our code is becoming very lengthy. Now we will break down the code into smaller modules. This will make it easy to read and maintain. Check out the next article below:

> [Nodejs Code Structure Optimization With Express Routing](https://dev.to/ebereplenty/nodejs-code-structure-optimization-with-express-routing-5fna)

## Hosting

![Hosting](https://www.website.com/img/skin/what_is_web_hosting.jpg)

Our application is complete. We now want to make it available to as many people as possible who will like to use it. Heroku provides us with the needed tools. I have written in details how you can save your project on [github](https://github.com/) and host it on Heroku. Read below:

> [Pushing to GitHub and Hosting on Heroku With Postgres for Free](https://dev.to/ebereplenty/pushing-to-github-and-hosting-on-heroku-for-free-kch)

## Conclusion
If you are coming from a background where you managed images on your own, then you will have appreciated cloudinary. No doubt, we have learnt a lot and you are armed with enough tools to build real world applications that are robust and scale-able.

All Codes are found [here](https://github.com/EBEREGIT/server-tutorial)

You can also checkout my series on [Authentication With MongoDB, Nodejs, React, Heroku and Netlify](https://dev.to/ebereplenty/full-stack-authentication-and-hosting-nodejs-reactjs-heroku-netlify-3fcm).

Thank you for reading.