Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

onepiecehung/typescript-nodejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Important: Before downloading and using this directory structure, please read the following article:

https://github.com/goldbergyoni/nodebestpractices/blob/master/sections/projectstructre/breakintcomponents.md

According to this article, the directory structure like this project is bad, consider it before using it and refer to it.

The other version follow the structure in the article: here πŸ˜„

Disclaimer of all responsibility related to this project.

Typescript with Node.js

Powered by

DS112

Introduction

Status

TravisCi CircleCI Gitlab pipeline status Issues Forks Starts License Twitter

Cross-platform, JavaScript runtime environment

NPM 7 Node 15 Webpack

Language

Typescript

Database

MongoDB 4 Cassandra

Back end web application framework

Express 4

Cache

Redis 6

Message broker

RabbitMQ ErLang

OS-level virtualization

Docker Docker-compose

Load balancing

HAProxy

1.Quick install

Install the environment

This application requires

Install with Docker

  • RabbitMQ
$ docker run -d --hostname my-rabbit --name some-rabbit rabbitmq:3
  • Redis
$ docker run --name some-redis -d redis
  • MongoDB
$ docker run --name some-mongo -d mongo:tag

Setup file .env

NODE_ENV=production #When running on production

RABBIT_URL=your_url_rabbitmq
#https://www.npmjs.com/package/amqplib

REDIS_URL=your_url_redis
#https://www.npmjs.com/package/ioredis

DB_URL=your_url_mongodb
#example: mongodb://localhost:27017/test
#https://mongoosejs.com/

#Port application
PORT=8018

Install package

npm install

Run

npm run dev

2. Advanced install (refer)

Cluster RabbitMQ - High Availability Readme

!Important goto ./docker/rabbitmq-cluster

Edit file haproxy.cfg, if you want

stats auth    user:pass

default: stats auth ds112:ds112

Implement via Shell

$ sh install-cluster.sh
$ sh setup-cluster.sh

Or Docker

Run the following commands one by one.

$ docker build -t HAProxy-server-rabbitmq .
$ docker-compose up
$ docker exec -ti rabbitmq-node-2 bash -c "rabbitmqctl stop_app"
$ docker exec -ti rabbitmq-node-2 bash -c "rabbitmqctl join_cluster rabbit@rabbitmq-node-1"
$ docker exec -ti rabbitmq-node-2 bash -c "rabbitmqctl start_app"

$ docker exec -ti rabbitmq-node-3 bash -c "rabbitmqctl stop_app"
$ docker exec -ti rabbitmq-node-3 bash -c "rabbitmqctl join_cluster rabbit@rabbitmq-node-1"
$ docker exec -ti rabbitmq-node-3 bash -c "rabbitmqctl start_app"

$ docker exec -ti rabbitmq-node-1 bash -c "rabbitmqctl cluster_status"
HAProxy: http://localhost:8025/haproxy?stats (login with user/pass) default: ds112:ds112

MongoDB and Kubernetes Readme

Kubernetes is the industry-leading container orchestration platform. You can use any distribution of Kubernetes to manage the full lifecycle of your MongoDB clusters, wherever you choose to run them, from on-premises infrastructure to the public cloud.

System

see more

The mongodb cluster system architecture uses Kubernetes

Redis cluster Readme

Update...

3. Project structure

./src/
    /bin
    /config
    /connector
    /controllers
    /documents
    /interfaces
    /middleware
    /models
    /repository
    /routes
    /services
    /utils
    /validator
    /worker

Simple Architecture

The flow of application

Continue...

4. Wait...bruh...i forgot what to do next... πŸ˜• 😟 😴

Refer Your wiki

About

This is struct folder for nodejs using typescript

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages