Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Weere
- > Weere - social network based on live sockets and the third party service Agora
- ## Description
- Application provide server-side API for Weere, which is built on NestJS with typescript, SocketIO 3V, MongoDB with mongoose and Agora. Agora provides the Real-time Communication and the Real-time Messaging. The agora-access-token package is used to generate tokens witch is used to enable real-time audio and video communications.
- ## Requirements
- - node >= 14
- - npm >= 6
- - mongodb >= 4.0
- - typescript >= 3.0
- ## Project Introduction
- ##### Framework:
- - NestJS
- ##### Authentication:
- - jwt authentication
- ##### Session Storage:
- - MongoDB
- - Redis
- ##### Real-time library:
- - Agora
- - SocketIO V3
- ##### Notifications:
- - firebase
- ##### Mails:
- - nodemailer
- ##### Code quality tools:
- - Prettier
- - Using Eslint followed [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript)
- - Commitizen
- - Husky
- ##### Dependencies:
- - lodash
- - aws-sdk
- - class-validator
- - cls-hooked
- - dayjs
- ##### Logger:
- - winston
- ##### Integration testing:
- - supertest
- ##### Deploy:
- - Docker
- - Docker compose
- - Kubernetes
- App Skeleton
- ```
- ├── src
- │├── common
- ││└── ...
- │├── decorators
- ││└── ...
- │├── filters
- ││└── ...
- │├── guards
- ││└── ...
- │├── interfaces
- ││└── ...
- │├── logger
- ││└── ...
- │├── pipes
- ││└── ...
- │├── routes
- ││├── app
- │││ └── ...
- ││├── v1
- │││ └── ...
- │││├── users
- ││││ └── ...
- ││││├── controllers
- │││││ └── ...
- ││││├── dto
- │││││ └── ...
- ││││├── enums
- │││││ └── ...
- ││││├── interfaces
- │││││ └── ...
- ││││├── repositories
- │││││ └── ...
- ││││├── schemas
- │││││ └── ...
- ││││├── services
- │││││ └── ...
- ││││├── validation
- │││││ └── ...
- ││││├── users.module.ts
- ││││└── users-constants.ts
- │├── main.ts
- ├── docker-compose.yml
- ├── index.js
- ├── nest-cli.json
- ├── package.json
- ├── package-lock.json
- ├── README.md
- ├── tsconfig.build.json
- └── tsconfig.json
- ```
- ## Installation
- The server must have a mongodb and redis installed and running:
- * [Install redis](https://redis.io/topics/quickstart)
- * [Install mongodb](https://docs.mongodb.com/guides/server/install/)
- Clone the repository:
- ```bash
- git clone https://github.com/*******/****.git
- ```
- ## Set up environment
- Go to project folder
- ```
- cd ./*****
- ```
- In root folder you can find `.env`. You can use this config or change it for your purposes.
- Example .env file:
- ```bash
- // base
- NODE_ENV=development
- SERVER_PORT=3001
- SERVER_HOST=localhost
- FRONT_HOME_URI=https://www.***
- // database
- MONGODB_URL=mongodb://****:27017
- MONGODB_NAME=******
- // redis
- REDIS_HOST=redis
- REDIS_PORT=6379
- // mailer creds
- MAIL_HOST=smtp.*****.net
- MAIL_PORT=25
- MAIL_USER=apikey
- MAIL_FROM=****[email protected]
- // cloud storage
- AWS_S3_ACCESS_KEY=******
- AWS_S3_SECRET_ACCESS_KEY=******
- AWS_S3_ENDPOINT=http://127*****
- AWS_S3_PORT=9000
- ## Running the API
- ### Development
- Run command in console to install required modules and build project:
- ```
- npm install
- ```
- ```
- npm run build
- ```
- To start the application in development mode:
- ```
- npm run start:dev
- ```
- To start the application in production mode:
- ```
- npm run start:prod
- ```
- ### Docker
- * [Install Docker](https://docs.docker.com/get-docker/)
- * [Install docker-compose](https://docs.docker.com/compose/install/)
- To run your app in docker containers choose "Yes" when the generator asks you about docker.
- #### Now, lift your app in docker
- ```
- docker-compose up
- ```
- ## Swagger
- Swagger documentation will be available on route:
- ```bash
- http://localhost:3000/api
- ```
- ## jsdoc
- jsdoc documentation for sockets will be available on routes:
- ```bash
- http://localhost:3000/ws-api/*******/
- ```
- ```bash
- http://localhost:3000/ws-api/*****/
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement