Coder Social home page Coder Social logo

id-validations's Introduction

Raw Template

RESTful/gRPC api with Domain Driven Design

Development Environment Setup

  1. Make sure you have nvm, node v14.18.3 or LTS version of node installed
  2. Install yarn - npm install -g yarn.

Documentation

  1. Visit [http://localhost:30041/rest-api] for REST docs
  2. gRPC documentation should be added at the bottom of this readme. It can be access by visiting http://localhost:30041/readme
  3. This template documentation can be access by running yarn serve:docs then visit http://localhost:3000

Docker support

Prerequisites

  1. Docker Community Edition v17 or higher
$ docker build -t raw-template  .
$ docker run -p 30041:30041 -p 30042:30042 --env-file=.env  raw-template

Access http://localhost:<PORT> and you're ready to go!

http://localhost:30041/

Quick Start

  1. Clone the repository with git clone --recursive https://github.com/YouverifyHQ/raw-template.git
  2. Install the dependencies with Yarn
  3. Run local Jaeger for distributed tracing yarn start:jaeger:dev
  4. Run the application in development mode with yarn start:dev:rs
  5. Access http://localhost:<PORT> and you're ready to go!

    http://localhost:30007

Overview

  • uses Node.js > v9
  • written using ES6
  • uses Yarn for package dependency management
  • uses Airbnb JavaScript Style
  • uses Mongoose as ODM
  • Filename convention - camelCase

CLI Tools

  • yarn build - build codebase for production
  • yarn start:dev - start the application in development mode
  • yarn start:dev:rs - start the application in development mode with nodemon for automatic server restart on code change
  • yarn test - run Unit tests
  • yarn lint - lint codebase using Airbnb style
  • yarn lint:fix - fix code according to Airbnb style
  • yarn build:docs - generate Rest API, Readme & JSDC documenation
  • yarn update:stub - update submodules
  • yarn start:jaeger:dev - start a local Jaeger server and serve
  • yarn stop:jaeger:dev - stop a local Jaeger container

Databases & Messaging

  • Mongodb - Main datastore
  • Redis - In-memory datastore for caching
  • Elasticsearch - Elasticsearch is a distributed, RESTful search and analytics engine
  • RabbitMq - Message Broker

Some Tech

  • Express - Node Framweork

  • Awilix - dependency resolution support powered by Proxy

  • Nodemon - Use for development file reload.

  • CORS - a node.js package for providing a Connect/Express middleware that can be used to enable CORS with various options.

  • Compression - Node.js compression middleware.

  • Http-status - Utility to interact with HTTP status code.

  • Winston - A multi-transport async logging library for node.js.

  • Morgan - HTTP request logger middleware for node.js

  • Lodash - A modern JavaScript utility library delivering modularity, performance & extras

  • Mongoose - Mongoose provides a straight-forward, schema-based solution to model your application data. It includes built-in type casting, validation, query building, business logic hooks and more, out of the box.

  • Chance - generate massive amounts of fake data in the browser and node.js

  • Moment - Parse, validate, manipulate, and display dates and times in JavaScript.

  • Moment-timezone - Parse and display dates in any timezone.

  • APIdocjs- Inline Documentation for RESTful web APIs

Logging & Tracing

  • Fluentd - Data collector for unified logging layer..
  • Jaeger - end-to-end distributed tracing. Monitor and troubleshoot transactions in complex distributed systems

Tests

  • mocha - JavaScript test framework running on Node.js and in the browser, making asynchronous testing simple and fun
  • chai - a BDD / TDD assertion library for node and the browser that can be delightfully paired with any javascript testing framework.
  • supertest - HTTP assertions made easy via superagent.
  • cross-env - makes it so you can have a single command without worrying about setting or using the environment variable properly for the platform
    • We mainly use this so mocha can use the absolute path of files

Pre-commit

Adding pre-commit to your project can be helpful to encourage consistency and quality of your code repository.

  • pre-commit - pre-commit is a pre-commit hook installer for git. It will ensure that your yarn lint (or other specified scripts) passes before you can commit your changes. This all conveniently configured in your package.json.
  • lint-staged - Linting makes more sense when running before committing your code. By doing that you can ensure no errors are going into repository and enforce code style. But running a lint process on a whole project is slow and linting results can be irrelevant. Ultimately you only want to lint files that will be committed.

gRPC Documentation

  • gRPC Documentations here
const config = {
  httpPort: {
    doc: "The rest port to bind",
    format: "port",
    default: 30007,
    env: "HTTP_PORT",
    sensitive: false,
  },
  grpcPort: {
    doc: "The grpc port to bind",
    format: "port",
    default: 30015,
    env: "GRPC_PORT",
    sensitive: false,
  },
  env: {
    doc: "The application environment",
    format: ["production", "development", "test", "qa", "staging", "local"],
    default: "local",
    env: "NODE_ENV",
    sensitive: false,
  },
};

exports.app = config;

Contributing

This boilerplate is open to suggestions and contributions, documentation contributions are also important! :)

Acknowledgments

This boilerplate is forked and modified from node-api-boilerplate - Talysson de Oliveira Cassiano ๐Ÿ‘

License

MIT License - fork, modify and use however you want.

id-validations's People

Contributors

efamous avatar timothyyv avatar yvprosper 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.