Skip to content

Commit c86aee0

Browse files
committed
backend added
1 parent 5364c4b commit c86aee0

513 files changed

Lines changed: 104156 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

backend/.development.env

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# connection parameters to your main database
2+
TYPEORM_USERNAME=postgres
3+
TYPEORM_PASSWORD=abc123
4+
TYPEORM_DATABASE=template1
5+
TYPEORM_HOST=postgres
6+
TYPEORM_PORT=5432
7+
8+
# optional parameter. you need it if you want to use sentry service.
9+
SENTRY_DSN=
10+
11+
EMAIL_SERVICE_HOST=
12+
EMAIL_SERVICE_PORT=25
13+
EMAIL_SERVICE_USERNAME=
14+
EMAIL_SERVICE_PASSWORD=
15+
16+
BASIC_AUTH_LOGIN=
17+
BASIC_AUTH_PWD=
18+
19+
SLACK_BOT_ACCESS_TOKEN=
20+
21+
# optional parameter. you need it if you want to use amplitude service.
22+
AMPLITUDE_API_KEY=
23+
24+
PRIVATE_KEY=MySuperSecretEncryptionPrivateKey
25+
26+
# do not forget change the key from test to prodaction version, if you need stripe
27+
STRIPE_SECRET_KEY=sk_test_51JM8FBFtHdda1TsB9lt1dIvbA9hcrqkTVqgvUqGw6tgBpBRvNrBdSrR8qh8GfNc5rkQr5TfSHHAsxxZwDWyByovO00BikGnMAZ
28+
29+
# adress external web socket server for management agent connection
30+
WS_SERVER_URL=http://ws-server
31+
WS_SERVER_PORT=8080
32+
33+
# price id for stripe integration. you do not need it if you run project locally
34+
TEAM_PLAN_PRICE_ID=
35+
ANNUAL_TEAM_PLAN_PRICE_ID=
36+
ENTERPRISE_PLAN_PRICE_ID=
37+
ANNUAL_ENTERPRISE_PLAN_PRICE_ID=
38+
39+
JWT_SECRET=MySuperSecretJwtSecret
40+
41+
# for authorization with google
42+
GOOGLE_CLIENT_ID=
43+
44+
# parameter that determines the application launch state. software as a service or not
45+
IS_SAAS=true
46+
47+
# optional parameters (it's only for testing)
48+
POSTGRES_CONNECTION_USERNAME=TEST_POSTGRES_CONNECTION_USERNAME
49+
POSTGRES_CONNECTION_PASSWORD=TEST_POSTGRES_CONNECTION_PASSWORD
50+
POSTGRES_CONNECTION_HOST=TEST_POSTGRES_CONNECTION_HOST
51+
POSTGRES_CONNECTION_PORT=5432
52+
POSTGRES_CONNECTION_DATABASE=TEST_POSTGRES_CONNECTION_DATABASE
53+
54+
MSSQL_CONNECTION_HOST=TEST_MSSQL_CONNECTION_HOST
55+
MSSQL_CONNECTION_PORT=5432
56+
MSSQL_CONNECTION_PASSWORD=TEST_MSSQL_CONNECTION_PASSWORD
57+
MSSQL_CONNECTION_USERNAME=TEST_MSSQL_CONNECTION_USERNAME
58+
MSSQL_CONNECTION_DATABASE=MSSQL_CONNECTION_DATABASE
59+
60+
ORACLE_CONNECTION_HOST=TEST_ORACLE_CONNECTION_HOST
61+
ORACLE_CONNECTION_PORT=5432
62+
ORACLE_CONNECTION_USERNAME=TEST_ORACLE_CONNECTION_USERNAME
63+
ORACLE_CONNECTION_PASSWORD=TEST_ORACLE_CONNECTION_PASSWORD
64+
ORACLE_CONNECTION_DATABASE=TEST_ORACLE_CONNECTION_DATABASE
65+
ORACLE_CONNECTION_SID=TEST_ORACLE_CONNECTION_SID
66+
67+
MYSQL_CONNECTION_HOST=TEST_MYSQL_CONNECTION_HOST
68+
MYSQL_CONNECTION_PORT=5432
69+
MYSQL_CONNECTION_USERNAME=TEST_MYSQL_CONNECTION_USERNAME
70+
MYSQL_CONNECTION_PASSWORD=TEST_MYSQL_CONNECTION_PASSWORD
71+
MYSQL_CONNECTION_DATABASE=TEST_MYSQL_CONNECTION_DATABASE
72+
MYSQL_CONNECTION_SSH_HOST=TEST_MYSQL_CONNECTION_SSH_HOST
73+
MYSQL_CONNECTION_SSH_PORT=22
74+
MYSQL_CONNECTION_SSH_USERNAME=TEST_MYSQL_CONNECTION_SSH_USERNAME
75+
MYSQL_CONNECTION_SSH_KEY=TEST_MYSQL_CONNECTION_SSH_KEY

backend/.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

backend/.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist/*
2+
test/*

backend/.eslintrc.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
module.exports = {
2+
parser: '@typescript-eslint/parser',
3+
parserOptions: {
4+
sourceType: 'module',
5+
},
6+
plugins: ['@typescript-eslint/eslint-plugin', 'security'],
7+
extends: [
8+
'plugin:@typescript-eslint/eslint-recommended',
9+
'plugin:@typescript-eslint/recommended',
10+
'prettier',
11+
'plugin:security/recommended',
12+
],
13+
root: true,
14+
env: {
15+
node: true,
16+
jest: true,
17+
},
18+
rules: {
19+
'@typescript-eslint/interface-name-prefix': 'off',
20+
'@typescript-eslint/explicit-function-return-type': 'off',
21+
'@typescript-eslint/no-explicit-any': 'off',
22+
'@typescript-eslint/camelcase': 'off',
23+
24+
'security/detect-buffer-noassert': 'error',
25+
'security/detect-child-process': 'error',
26+
'security/detect-disable-mustache-escape': 'error',
27+
'security/detect-eval-with-expression': 'error',
28+
'security/detect-new-buffer': 'error',
29+
'security/detect-no-csrf-before-method-override': 'error',
30+
'security/detect-non-literal-fs-filename': 'error',
31+
'security/detect-non-literal-regexp': 'error',
32+
'security/detect-non-literal-require': 'error',
33+
'security/detect-object-injection': 'error',
34+
'security/detect-possible-timing-attacks': 'error',
35+
'security/detect-pseudoRandomBytes': 'error',
36+
'security/detect-unsafe-regex': 'error',
37+
},
38+
};

backend/.gitignore

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
2+
# Created by https://www.gitignore.io/api/node
3+
# Edit at https://www.gitignore.io/?templates=node
4+
5+
### Node ###
6+
# Logs
7+
logs
8+
*.log
9+
npm-debug.log*
10+
yarn-debug.log*
11+
yarn-error.log*
12+
lerna-debug.log*
13+
14+
# Diagnostic reports (https://nodejs.org/api/report.html)
15+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
16+
17+
# Runtime data
18+
pids
19+
*.pid
20+
*.seed
21+
*.pid.lock
22+
23+
# Directory for instrumented libs generated by jscoverage/JSCover
24+
lib-cov
25+
26+
# Coverage directory used by tools like istanbul
27+
coverage
28+
*.lcov
29+
30+
# nyc test coverage
31+
.nyc_output
32+
33+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
34+
.grunt
35+
36+
# Bower dependency directory (https://bower.io/)
37+
bower_components
38+
39+
# node-waf configuration
40+
.lock-wscript
41+
42+
# Compiled binary addons (https://nodejs.org/api/addons.html)
43+
build/Release
44+
45+
# Dependency directories
46+
node_modules/
47+
jspm_packages/
48+
49+
# TypeScript v1 declaration files
50+
typings/
51+
52+
# TypeScript cache
53+
*.tsbuildinfo
54+
55+
# Optional npm cache directory
56+
.npm
57+
58+
# Optional eslint cache
59+
.eslintcache
60+
61+
# Optional REPL history
62+
.node_repl_history
63+
64+
# Output of 'npm pack'
65+
*.tgz
66+
67+
# Yarn Integrity file
68+
.yarn-integrity
69+
70+
# dotenv environment variables file
71+
.env
72+
.test.env
73+
.encryption.env
74+
75+
# parcel-bundler cache (https://parceljs.org/)
76+
.cache
77+
78+
# next.js build output
79+
.next
80+
81+
# nuxt.js build output
82+
.nuxt
83+
84+
# rollup.js default build output
85+
dist/
86+
87+
# Uncomment the public line if your project uses Gatsby
88+
# https://nextjs.org/blog/next-9-1#public-directory-support
89+
# https://create-react-app.dev/docs/using-the-public-folder/#docsNav
90+
# public
91+
92+
# Storybook build outputs
93+
.out
94+
.storybook-out
95+
96+
# vuepress build output
97+
.vuepress/dist
98+
99+
# Serverless directories
100+
.serverless/
101+
102+
# FuseBox cache
103+
.fusebox/
104+
105+
# DynamoDB Local files
106+
.dynamodb/
107+
108+
# Temporary folders
109+
tmp/
110+
temp/
111+
112+
#IDE integration files
113+
.idea
114+
115+
#private data
116+
.env.dev
117+
.amazon.env
118+
.development.env
119+
120+
# End of https://www.gitignore.io/api/node

backend/.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"printWidth": 120
5+
}

backend/Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM node:16
2+
WORKDIR /app
3+
COPY package.json yarn.lock nest-cli.json /app/
4+
RUN yarn install --network-timeout 1000000
5+
COPY . /app
6+
RUN yarn run nest build
7+
CMD [ "./node_modules/.bin/nest", "start"]
8+
9+
RUN apt update
10+
RUN apt install libaio1 libc6 curl -y && \
11+
cd /tmp && \
12+
curl -o instantclient-basiclite.zip https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip -SL && \
13+
unzip instantclient-basiclite.zip && \
14+
mv instantclient*/ /usr/lib/instantclient && \
15+
rm instantclient-basiclite.zip && \
16+
ln -s /usr/lib/instantclient/libclntsh.so.19.1 /usr/lib/libclntsh.so && \
17+
ln -s /usr/lib/instantclient/libocci.so.19.1 /usr/lib/libocci.so && \
18+
ln -s /usr/lib/instantclient/libociicus.so /usr/lib/libociicus.so && \
19+
ln -s /usr/lib/instantclient/libnnz19.so /usr/lib/libnnz19.so && \
20+
ln -s /usr/lib/libnsl.so.2 /usr/lib/libnsl.so.1 && \
21+
ln -s /lib/libc.so.6 /usr/lib/libresolv.so.2 && \
22+
ln -s /lib64/ld-linux-x86-64.so.2 /usr/lib/ld-linux-x86-64.so.2
23+
24+
ENV ORACLE_BASE /usr/lib/instantclient
25+
ENV LD_LIBRARY_PATH /usr/lib/instantclient
26+
ENV TNS_ADMIN /usr/lib/instantclient
27+
ENV ORACLE_HOME /usr/lib/instantclient

backend/README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<p align="center">
2+
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo_text.svg" width="320" alt="Nest Logo" /></a>
3+
</p>
4+
5+
[travis-image]: https://api.travis-ci.org/nestjs/nest.svg?branch=master
6+
[travis-url]: https://travis-ci.org/nestjs/nest
7+
[linux-image]: https://img.shields.io/travis/nestjs/nest/master.svg?label=linux
8+
[linux-url]: https://travis-ci.org/nestjs/nest
9+
10+
<p align="center">A progressive <a href="http://nodejs.org" target="blank">Node.js</a> framework for building efficient and scalable server-side applications, heavily inspired by <a href="https://angular.io" target="blank">Angular</a>.</p>
11+
<p align="center">
12+
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
13+
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
14+
<a href="https://www.npmjs.com/~nestjscore"><img src="https://img.shields.io/npm/dm/@nestjs/core.svg" alt="NPM Downloads" /></a>
15+
<a href="https://travis-ci.org/nestjs/nest"><img src="https://api.travis-ci.org/nestjs/nest.svg?branch=master" alt="Travis" /></a>
16+
<a href="https://travis-ci.org/nestjs/nest"><img src="https://img.shields.io/travis/nestjs/nest/master.svg?label=linux" alt="Linux" /></a>
17+
<a href="https://coveralls.io/github/nestjs/nest?branch=master"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#5" alt="Coverage" /></a>
18+
<a href="https://gitter.im/nestjs/nestjs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=body_badge"><img src="https://badges.gitter.im/nestjs/nestjs.svg" alt="Gitter" /></a>
19+
<a href="https://opencollective.com/nest#backer"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
20+
<a href="https://opencollective.com/nest#sponsor"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
21+
<a href="https://paypal.me/kamilmysliwiec"><img src="https://img.shields.io/badge/Donate-PayPal-dc3d53.svg"/></a>
22+
<a href="https://twitter.com/nestframework"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow"></a>
23+
</p>
24+
<!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
25+
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->
26+
27+
## Description
28+
29+
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
30+
31+
## Installation
32+
33+
```bash
34+
$ npm install
35+
```
36+
37+
## Running the app
38+
39+
```bash
40+
# development
41+
$ npm run start
42+
43+
# watch mode
44+
$ npm run start:dev
45+
46+
# production mode
47+
$ npm run start:prod
48+
```
49+
50+
## Test
51+
52+
```bash
53+
# unit tests
54+
$ npm run test
55+
56+
# e2e tests
57+
$ npm run test:e2e
58+
59+
# test coverage
60+
$ npm run test:cov
61+
```
62+
63+
## Support
64+
65+
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
66+
67+
## Stay in touch
68+
69+
- Author - [Kamil Myśliwiec](https://kamilmysliwiec.com)
70+
- Website - [https://nestjs.com](https://nestjs.com/)
71+
- Twitter - [@nestframework](https://twitter.com/nestframework)
72+
73+
## License
74+
75+
Nest is [MIT licensed](LICENSE).

0 commit comments

Comments
 (0)