DocIt: Document Management System Back end with Docker, Redis, Node.js, PostgreSQL, and Sequelize
Published: 2023-04-27 07:15:01


![DocIt](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8q2quwect0vetke4h6hy.png)

## Introduction

An internal management system is a software application that helps organisations efficiently manage their internal processes, operations, and data. With the increasing complexity of business operations, managing the various aspects of a company can become a daunting task, especially when it comes to managing data and ensuring that it is accurate, up-to-date, and accessible to the right people at the right time.

For the same reason, we developed DocIt: An Internal Document Management System which focus on fast, efficient and collaborative environment to develop and manage documentation with support of markdown.

## Backend Technology Used

1. Node.js
2. PostgreSql
3. Redis as a Message Queue
4. ORM: Sequelize

For the deployment of this project, we used [Heroku](https://www.heroku.com/) with [elephant SQL](https://www.elephantsql.com/) and [Redis lab](https://redis.com/)

## Project Setup

1. Clone or download code. `git clone https://github.com/flexi-docit/backend/ DocItBackend -b dev`
2. `cd DocItBackend`
3. Add credentials for database, redis and jwt secret in `.env` file.
4. Once .env is added with all required values, run `bash ./init.sh` on Linux and MacOs. For windows, run `docker-compose up`
5. Once our docker is up and running, we need to create a database with provided name in .env file(I will be using docit name for database).
6. Open another instance of terminal and run `sudo docker exec -it database bash`.
7. Once inside the bash terminal of docker, run `psql -U <user name used for this database>`.
8. We will be inside database after which we need to create a new database with value of `database` variable in .env(in my case: docit). To create a new database, run `CREATE DATABASE doit;`
9. Now we can exit and our application is up and running.

Following are the values that needs to be put inside .env file

| Key               | Value                   |
| ----------------- | ----------------------- |
| PORT              | 8000                    |
| NODE_ENV          | development/production  |
| POSTGRES_USER     | `database username`     |
| POSTGRES_PASSWORD | `database password`     |
| POSTGRES_DB_NAME  | `database name`         |
| POSTGRES_HOST     | `database host`         |
| POSTGRES_PORT     | `database port`         |
| GMAIL_EMAIL       | `Google email address`  |
| GMAIL_PASSWORD    | `Google email password` |
| FRONTEND_DOMAIN   | `Frontend Domain`       |
| JWT_SECRET        | `JWT secret key`        |
| REDIS_HOST        | `Redis Server Host`     |
| REDIS_PORT        | `Redis Server Port`     |
| REDIS_USERNAME    | `Redis Server Username` |
| REDIS_PASSWORD    | `Redis Server Password` |

Here is the implementation of express server used in this project for rest api architecture

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/83fk0dhtq6heaqlt2432.png)



For the documentation of all endpoints, refer [here](https://documenter.getpostman.com/view/24022619/2s93eR4bNL)

## Contribution
As a backend developer, my contribution was

1. System design
2. Implementation of backend in node.js enviroment
3. DevOp/Deployment
4. Writing test cases to enable automated testing for the application.
5. Managing and resolving bugs in production enviroment for the application.

Moreover, we worked by following agile methodologies where every sprint plan can be found [here](https://github.com/flexi-docit/documentation)