Advertisement
NikolayBezay

Readme example

Nov 1st, 2021
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.22 KB | None | 0 0
  1. # Weere
  2. > Weere - social network based on live sockets and the third party service Agora
  3. ## Description
  4. 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.
  5. ## Requirements
  6. - node >= 14
  7. - npm >= 6
  8. - mongodb >= 4.0
  9. - typescript >= 3.0
  10. ## Project Introduction
  11. ##### Framework:
  12. - NestJS
  13. ##### Authentication:
  14. - jwt authentication
  15. ##### Session Storage:
  16. - MongoDB
  17. - Redis
  18. ##### Real-time library:
  19. - Agora
  20. - SocketIO V3
  21. ##### Notifications:
  22. - firebase
  23. ##### Mails:
  24. - nodemailer
  25. ##### Code quality tools:
  26. - Prettier
  27. - Using Eslint followed [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript)
  28. - Commitizen
  29. - Husky
  30. ##### Dependencies:
  31. - lodash
  32. - aws-sdk
  33. - class-validator
  34. - cls-hooked
  35. - dayjs
  36. ##### Logger:
  37. - winston
  38. ##### Integration testing:
  39. - supertest
  40. ##### Deploy:
  41. - Docker
  42. - Docker compose
  43. - Kubernetes
  44. App Skeleton
  45. ```
  46. ├── src
  47. │├── common
  48. ││└── ...
  49. │├── decorators
  50. ││└── ...
  51. │├── filters
  52. ││└── ...
  53. │├── guards
  54. ││└── ...
  55. │├── interfaces
  56. ││└── ...
  57. │├── logger
  58. ││└── ...
  59. │├── pipes
  60. ││└── ...
  61. │├── routes
  62. ││├── app
  63. │││ └── ...
  64. ││├── v1
  65. │││ └── ...
  66. │││├── users
  67. ││││ └── ...
  68. ││││├── controllers
  69. │││││ └── ...
  70. ││││├── dto
  71. │││││ └── ...
  72. ││││├── enums
  73. │││││ └── ...
  74. ││││├── interfaces
  75. │││││ └── ...
  76. ││││├── repositories
  77. │││││ └── ...
  78. ││││├── schemas
  79. │││││ └── ...
  80. ││││├── services
  81. │││││ └── ...
  82. ││││├── validation
  83. │││││ └── ...
  84. ││││├── users.module.ts
  85. ││││└── users-constants.ts
  86. │├── main.ts
  87. ├── docker-compose.yml
  88. ├── index.js
  89. ├── nest-cli.json
  90. ├── package.json
  91. ├── package-lock.json
  92. ├── README.md
  93. ├── tsconfig.build.json
  94. └── tsconfig.json
  95. ```
  96. ## Installation
  97. The server must have a mongodb and redis installed and running:
  98. * [Install redis](https://redis.io/topics/quickstart)
  99. * [Install mongodb](https://docs.mongodb.com/guides/server/install/)
  100. Clone the repository:
  101. ```bash
  102. git clone https://github.com/*******/****.git
  103. ```
  104. ## Set up environment
  105. Go to project folder
  106. ```
  107. cd ./*****
  108. ```
  109. In root folder you can find `.env`. You can use this config or change it for your purposes.
  110. Example .env file:
  111. ```bash
  112. // base
  113. NODE_ENV=development
  114. SERVER_PORT=3001
  115. SERVER_HOST=localhost
  116. FRONT_HOME_URI=https://www.***
  117. // database
  118. MONGODB_URL=mongodb://****:27017
  119. MONGODB_NAME=******
  120. // redis
  121. REDIS_HOST=redis
  122. REDIS_PORT=6379
  123. // mailer creds
  124. MAIL_HOST=smtp.*****.net
  125. MAIL_PORT=25
  126. MAIL_USER=apikey
  127. MAIL_FROM=****[email protected]
  128. // cloud storage
  129. AWS_S3_ACCESS_KEY=******
  130. AWS_S3_SECRET_ACCESS_KEY=******
  131. AWS_S3_ENDPOINT=http://127*****
  132. AWS_S3_PORT=9000
  133. ## Running the API
  134. ### Development
  135. Run command in console to install required modules and build project:
  136. ```
  137. npm install
  138. ```
  139. ```
  140. npm run build
  141. ```
  142. To start the application in development mode:
  143. ```
  144. npm run start:dev
  145. ```
  146. To start the application in production mode:
  147. ```
  148. npm run start:prod
  149. ```
  150. ### Docker
  151. * [Install Docker](https://docs.docker.com/get-docker/)
  152. * [Install docker-compose](https://docs.docker.com/compose/install/)
  153. To run your app in docker containers choose "Yes" when the generator asks you about docker.
  154. #### Now, lift your app in docker
  155. ```
  156. docker-compose up
  157. ```
  158. ## Swagger
  159. Swagger documentation will be available on route:
  160. ```bash
  161. http://localhost:3000/api
  162. ```
  163. ## jsdoc
  164. jsdoc documentation for sockets will be available on routes:
  165. ```bash
  166. http://localhost:3000/ws-api/*******/
  167. ```
  168. ```bash
  169. http://localhost:3000/ws-api/*****/
  170. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement