Giter VIP home page Giter VIP logo

node-express-mysql-template's Introduction

Implementation Details:

General Approach

Architecture Diagram

API

  • GET /api/v1/* -> This is just a placeholder to show how a request and response JSON looks like.

    Sample Request Body

    {
      "data": {
          "type": "replies",
          "attributes": {
          }
      }
    }
    

    Sample Response Body

    {
      "meta": {},
      "data": {
          "type": "reply",
          "attributes": {
          }
      }
    }
    

How to run

Create a mysql db and update the configs accordingly. Build the project

yarn build

Runs the migrations

yarn db migration:run

Start the server in watch mode

yarn start

Run tests

yarn test

yarn test:coverage #for test coverage report

Linting

yarn lint

yarn lint --fix #for fixing all the lint errors

Folder Structure

A top level brief of structure

src
├── controllers            # All the controllers
├── db                     # Migrations and orm config
├── entity                 # Typeorm entities
├── errors                 # Custom errors
├── lib                    # Any third party and first party integrations
├── middlewares            # Just middlewarawes
├── routes                 # Register all the controller with express
├── schema                 # Joi schema definitions
├── serializers            # JSONAPI serilizer files
├── services               # Core business logic
├── types                  # Type definitions
└── config files

Architecture Notes

  • API Design:

    • Follows REST standarads.
    • Future scope for versioning of APIs.
    • I wanted to write something more standardised so I chose to follow https://jsonapi.org standards. The API expects and also reponds back accoding to the jsonapi standards.
  • Database

  • Exception Handling

  • Specs

  • Request/Response Validations:

    • Joiful schema is used to validate the requests and any repsonses from third part APIs.
  • Github Actions

    • Currenlty there's one workflow, which is triggered on push to master, to build and run the tests in github actions

ToDo

  • Logging
  • Authorization
  • Dockerize the application
  • API documentation (Swagger)

Things I am contemplating

  • Deployment strategy
  • Rate limiting
  • Load testing

node-express-mysql-template's People

Contributors

akshaydk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.