Skip to content

OnurYurteri/scalable-node

Repository files navigation

What is it?

  • It's a experimental backend boilerplate for node
  • Aims to create ground-basis/examples for
    • Loose coupled modules that could be converted to standalone app (Micro-service 101)
    • Pluggable logging module
    • Implementation of authentication (JWT)
    • Strategy for
      • Building and deploying app (Docker/docker-compose)
      • Scaling (Loadbalancing, caching etc)
      • Consistent contributions (Linters/Prettiers)

Upcoming

  • Add logging mechanism
  • Add mongo dao
  • Validator
  • Dockerize app
  • Ready to loadbalancing?
  • Queuing mechanism (Kafka/RabbitMQ)?
  • Shared cache (Hazelcast/Redis/Memcached)?
  • Analytics?

Made Out Of

Installing

git clone https://github.com/OnurYurteri/scalable-node.git
cd scalable-node/src
npm ci

Scripts

Script Description
npm run dev Starts development server at localhost:3000
npm run debug Starts debugging with Inspector
npm run lint Run Eslint to find out linting issues.
npm run test Run Jest to run tests.
npm run test:watch Run Jest to run tests on watch mode.
npm run test:debug Run Jest tests with Inspector
npm run test:coverage Run Istanbul for test coverage report

Run at local server

cd scalable-node/src
cp .env.example .env

npm run start
http://localhost:3000/

Run with Docker

cd scalable-node
docker build -t scalable-node_src:1.0 .
docker run --publish 3000:3000 scalable-node_src:1.0

http://localhost:3000/

With docker-compose (Multiple instance, nginx, mongoDB)

cd scalable-node
docker build -t scalable-node_src:1.0 .
docker-compose up

http://localhost/
http://localhost:8080/