Table of Contents
The project is build using NodeJS in Typescript. The web framework used is Express. Data ORM used is Sequelize.
- Typescript is used because it is easier to understand as types are attached to each variable, also helps catch most bugs at compiletime
- Sequelize ORM is used because it has good support for features like eager loading, nested loading, establishing relations between data and relational models.
This is an example of how to list things you need to use the software and how to install them.
- NodeJs
- PostgreSQL
-
Clone the repo
git clone https://github.com/Sudheer121/CostExplorer
-
Install NPM packages
npm install
-
Setup data base from PostgreSQL dump
psql -U user_name -d db_name -1 -f dump.sql
-
Fill .env parameters
cp .env.example .env
-
Run
npx tsc npm run start:dev
Below is the documentation
Since the project is build with typescript source code is in ./src
and complied
javascript is in ./dist
The project layers consist of Models, Controller, Services and DAO layer
Custom created modules can be viewed at ./src/helpers
. These modules are unrelated to project data
but are useful in converting data from one form to other.
These modules abstract away some of the logic.
Example : The Graph library takes data and creates an object that has graph representation of input data
Before the server starts, it caches the CostTypes
table from database, it converts the data into graph form using Graph
helper module. The cached data is stored in a static class CacheSingleton
and is accessible throughout the project.
Custom Data Types and Interfaces can be viewed at ./src/typings/index.d.ts
.
This alse has the interfaces CostExplorerOutput
and ExplorerItem
as specified.
Other than the provided interfaces the project uses commonly these interfaces.
- IGraphNode
Represents a graph node, should have
id
andparent id
- IData
Represents any data and should have
id
attribute
- INest
Represents IData in nested form,
ExplorerItem
is a specific form ofINest
Postman documentation will be added in sometime