Giter VIP home page Giter VIP logo

tractian-challenge's Introduction

Back End Software Engineer Challenge

This is a solution to the Back End Software Engineer Challenge from Tractian. It is the code for an API which performs a CRUD where the user can register companies, units, assets and users.

Deploy

The API was deployed to GCP using docker and is listening for requests on this url. Continuous deployment was also setup using GCP. The Mongo database being used in production is the one provided by Mongo Atlas.

Local Development

In order to run the API you will need to set some environment variables.

Create a ".env" file in the root directory and set the variables:

  • MONGODB_URI=mongodb://root:pass@mongo:27017
  • PORT=3000

To run the API and the DB instance locally you can use docker and docker-compose in the root of the project:

docker-compose up

This will serve the API on http://localhost:3000/

Observations and Caveats

  • Authentication: Ideally I would have implemented some kind of authentication for users and permissions for normal users and managers (I would use Firebase to do this easily). However I chose to keep it simple and supply the authentication as a request header passing the user ID (Auth: userId).
  • Get All endpoints: Endpoints which get all entities of a type are not protected and only used for quickly testing.
  • User registration: A user can be created if you also register a company at the same time (being assigned as the manager of that company) or if you invite the user as a member of a company supplying the authentication for the manager.
  • Images: In order to keep it simple I used multer to store the images, however in a real application I would use a Blob Storage such as GCP's buckets.

There are more caveats, however I would prefer to discuss it verbally in a call.

Endpoints Specification

Users

  • Get All Users: GET '/users/'
  • Register User With Company: POST '/users/'
  • Invite User: POST '/users/invite'

Companies

  • Get All Companies: GET '/companies/'
  • Get Company Overview: GET '/companies/:companyId'
  • Update Company: PUT '/companies/'
  • Update Company Member: PUT '/companies/members/:userId'

Units

  • Get All Units: GET '/units/'
  • Get Unit With Assets: GET '/units/:unitId'
  • Register Unit: POST '/units/'

Assets

  • Get All Assets: GET '/assets/'
  • Get Asset Images: GET '/assets/:assetId/image'
  • Create Asset: POST '/assets/:'

tractian-challenge's People

Contributors

atedesch1 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.