# uncore-connect-api-central-lib

### Clone the repository

```console
git clone https://github.com/uncore-digital/uncore-connect-api-central-lib.git
```
### Setup database

This guide will walk you through the process of creating databases, `uncore_central` in PostgreSQL.

#### Prerequisites
- PostgreSQL installed on your system.
- Appropriate permissions to create databases.
- Create database `uncore_central` in PostgreSQL;

### Setup redis

This uncore project uses redis as key value db for keeping revoked tokens (logout). Setup a redis instance. Follow the quick start guide [here](https://redis.io/topics/quickstart).

### Install project dependencies

```console
cd uncore-connect-api-central-lib
npm install --force
```

### Open the project in your IDE (like Visual Studio Code) to configure the code
1) Duplicate the `.env.local` file to create a new file named `.env`. 
2) Open the `.env` file for further configuration.
3) Update the PostgreSQL configuration details(for `uncore_central`) in the `.env` file as needed.

###### Run following command for Database migration
```console
npm run build
```

```console
npm run migrate
```
