Code Monkey home page Code Monkey logo

devloot-poc's Introduction

Proof of Concep for Developing an Authentication System

Note: You can find the API document and Postman collection in the bottom of this readme.

This repository is a server-side application for providing following functionalities:

  • Login via email\username & password
  • Register using email\username & password
  • User roles i.e. Admin\Business\Customer

System also should have following non-functionalities:

  • API validation
  • Gateway Security
  • Authentication restrictions on routes
  • Authorization restrictions on routes
  • Modular design for scalibility
  • Docker compatibility

First we defined the user types that are going to use the system:

  • Super Admin
  • Admin
  • Customer
  • Business

Then we considered some routin user stories for each one:

  • Super Admin
    • Login
    • Get Admin List
    • Create New Admin
  • Admin
    • Login
    • Get Profile
    • Get Customer List
    • Get Business List
  • Customer
    • SignUp
    • Login
    • Get Profile
  • Business
    • SignUp
    • Login
    • Get Profile

The database entities are defined as follow:

User Entity

Usecase: Authentication & Authorization Purposes

Parameter Type Description
id integer Entity identifier
username string It's used for login mechanism
email string Additional property
password string It's hashed and is used for authentication
Role [SuperAdmin, Admin, Customer, Business] Role of the logged in user

Admin Entity

Usecase: Supports Admin's user stories

Parameter Type Description
id integer Entity identifier
user User OneToOne relation with a user entity
firstName string Admin's first name
lastName string Admin's last name

Business Entity

Usecase: Supports Business's user stories

Parameter Type Description
id integer Entity identifier
user User OneToOne relation with a user entity
name string Business name
activities [string] List of activities that the business supports

Customer Entity

Usecase: Supports Customer's user stories

Parameter Type Description
id integer Entity identifier
user User OneToOne relation with a user entity
firstName string Customer's first name
lastName string Customer's last name

Tech Stack

Based on the required functionalities and non-functionalities features, I decided to use the following stack:

  • Programming Language: TypeScript
  • Platform: Node.js (It's event-driven architecture removes the race-condition problem and are suitable for scalibility and well-fit for micro-service architecture)
  • Framework: Nest.js (One of the best frameworks based on Node.js; It provides a reliable, flexible, and modular architecture for developing scalable solutions)
  • Database: SQLite in memory database (It helps the evaluators to easily launch the PoC without need of installing an external Database)
  • Docker: For building a contrainer image so the system can be easily deployed in a contrainer without considering its base environment.

Install Instruction

For running the PoC, you need Node.js and npm package be installed on your system. You can find the latest version of Node.js and NPM on the following link:

Then clone this repository on your computer and in its root folder run following command in a terminal:

npm install

For running the PoC locally just run following command:

npm run start

If you would like to build a docker image of the PoC, there is a Dockerfile just build it and push it in your repository.

For testing purposes you can find the API documents in the following link:

devloot-poc's People

Contributors

dophlin avatar

Watchers

 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.