Coder Social home page Coder Social logo

e-co's Introduction

e-co - ECamara Organizada

Specification: here

Getting Started

Install yarn:

npm install -g yarn
# you may need sudo for this

Install dependencies:

yarn

Set environment (vars):

get .env file on #see .env.example

Start server:

# Start server
yarn start

Architecture Overview

Sera?

This system is divided in 3 layers: model, controller and view (MVC).

The Model layer has a Document Based model for the system entities.
The Controller layer contains all business logic and interactions between diferent system entities.
The View layer is a collection of routes that defines our system's API.

Model example: server/user/user.model.js
View example: server/user/user.route.js
Controller example: server/user/user.controller.js

Security

For authentication and authorization we use JWS (JSON Web Token) to ensure that the User is actualy himself and apply the specific rules for that user. But essentially is just to make sure that everyone mind its own business.

The authentication proccess happens in the View layer using two middlewares: expressJwt and auth.checkUser. The first one check the token signature, making sure that no one changed it. The second one make sure that the user is making operations that he is allowed.

In e-co we only have one route that needs authorization, this is the Create Comission route POST /api/comission. For this, we have a middleware who checks if the logged user have a role of congressperson, the only role that can create comissions.

Performance

Due to a greate demand on quering user profiles, the e-co team implemented a cache system to this route. It's pretty simple: we a query is made we check the cache looking for a profile by DNI and when the user is patched we override the value for that user in the cache.

With cache we get a high increase in performance and we can prove in the following images:

This images are taken from a report generated with a greate load testing tool called Artillery.

without cache

Sera?

with cache

Sera?

For a more detailed report check out the html files into the loadTest folder

e-co's People

Contributors

viniagostini avatar

Watchers

James Cloos avatar  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.