Giter VIP home page Giter VIP logo

kraken-case's Introduction

Nest Logo

Kraken Case Study

This project was built with Nestjs, Fastify, TypeORM, and Postgres.

Quick Start

Installation

    # verify that you installed nvm by printing its version number
    $ nvm -v
    # use necessary node version with the help of .nvmrc file
    $ nvm use
    # install necessary packages
    $ npm install

Environment

  • Create .env file
    $ touch .env
  • Add environment variables into .env file
  • PS: you can find example env file in the repository
    $ HOST=  the host the application will be running on. Default: `localhost`
    $ PORT= the port the application will be running on. Default: 3000
    $ NODE_ENV=dev the environment the application will be running in. Default: `dev`
    $ LOG_LEVEL= minimum log level to show. Default: `debug` for `dev`
    $ SERVER_KEEP_ALIVE_TIMEOUT= the keep alive timeout. Default: `120000` (2 mins)
    $ BODY_LIMIT= the maximum payload, in bytes, the server is allowed to accept. Default: `10240` (10 kilobytes)
    $ SWAGGER_ENABLED= whether swagger is enabled. Default: `true` for `dev`, `false` for else.
    $ POSTGRES_HOST= PostgreSQL Host. Default: 'localhost'
    $ DATABASE_NAME= PostgreSQL Database Name. Default: 'kraken'
    $ POSTGRES_PORT= PostgreSQL Database Port. Default: '5432'
    $ POSTGRES_USERNAME= PostgreSQL Username. Default: 'postgres'
    $ POSTGRES_PASSWORD= PostgreSQL User Password. Default: 'postgres'
    $ API_KEY= Api key for auth. Default: 'EltgJ5G8m44IzwE6UN2Y4B4NjPW77Zk6FJK3lL23'
  • Please make sure that you have installed PostgreSQL and created database before running the application.

Folder Structure

├── src
│   ├── api
│   │   ├── auth
│   │   ├── healthcheck
│   │   ├── site-outages
│   │   └── siteInfo
│   ├── common
│   │   ├── constants
│   │   ├── dtos
│   │   ├── enums
│   │   ├── exceptions
│   │   └── filters
│   ├── config
│   │   ├── swagger
│   │   └── typeorm
│   ├── database
│   └── models
├── test
│   ├── mocks
│   └── unit
└──

Swagger Documentation

  • Please checkout localhost:3000/documentation in order to see the Swagger documentation.

Bonus Requirements

Question

  • The API will occasionally return 500 status codes. Can you implement a solution that is resilient to this scenario?
  • Answer: I did not implement the bonus requirement. However, retryable interceptor can implement as globally when the api respond internal server error.

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Test

# unit tests
$ npm run test

# test coverage
$ npm run test:cov

kraken-case's People

Watchers

Sener Alkan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.