Loading .deploy/api/Dockerfile +50 −3 Original line number Diff line number Diff line Loading @@ -5,6 +5,29 @@ ARG NODE_ENV ARG API_BASE_URL ARG API_HOST ARG API_PORT ARG HTTPPORT ARG HTTPSPORT ARG GQLPORT ARG GQLPORT_SUBSCRIPTIONS ARG STRIPE_SECRET_KEY ARG URBAN_AIRSHIP_KEY ARG URBAN_AIRSHIP_SECRET ARG KEYMETRICS_MACHINE_NAME ARG KEYMETRICS_SECRET_KEY ARG KEYMETRICS_PUBLIC_KEY ARG GOOGLE_APP_ID ARG GOOGLE_APP_SECRET ARG FACEBOOK_APP_ID ARG FACEBOOK_APP_SECRET ARG JWT_SECRET ARG SETTING_INVITES_ENABLED ARG SETTINGS_REGISTRATIONS_REQUIRED_ON_START ARG ADMIN_PASSWORD_RESET ARG FAKE_DATA_GENERATOR ARG ARCGIS_CLIENT_ID ARG ARCGIS_CLIENT_SECRET ARG IP_STACK_API_KEY ARG ENGINE_API_KEY ARG SENTRY_DSN ARG DB_URI ARG DB_HOST Loading Loading @@ -104,6 +127,30 @@ ENV NODE_ENV=${NODE_ENV:-production} ENV API_HOST=${API_HOST:-api} ENV API_PORT=${API_PORT:-5500} ENV API_BASE_URL=${API_BASE_URL:-http://localhost:5500} ENV HTTPPORT=${HTTPPORT} ENV HTTPSPORT=${HTTPSPORT} ENV GQLPORT=${GQLPORT} ENV GQLPORT_SUBSCRIPTIONS=${GQLPORT_SUBSCRIPTIONS} ENV SETTING_INVITES_ENABLED=${SETTING_INVITES_ENABLED} ENV STRIPE_SECRET_KEY=${STRIPE_SECRET_KEY} ENV URBAN_AIRSHIP_KEY=${URBAN_AIRSHIP_KEY} ENV URBAN_AIRSHIP_SECRET=${URBAN_AIRSHIP_SECRET} ENV KEYMETRICS_MACHINE_NAME=${KEYMETRICS_MACHINE_NAME} ENV KEYMETRICS_SECRET_KEY=${KEYMETRICS_SECRET_KEY} ENV KEYMETRICS_PUBLIC_KEY=${KEYMETRICS_PUBLIC_KEY} ENV GOOGLE_APP_ID=${GOOGLE_APP_ID} ENV GOOGLE_APP_SECRET=${GOOGLE_APP_SECRET} ENV FACEBOOK_APP_ID=${FACEBOOK_APP_ID} ENV FACEBOOK_APP_SECRET=${FACEBOOK_APP_SECRET} ENV JWT_SECRET=${JWT_SECRET} ENV SETTING_INVITES_ENABLED=${SETTING_INVITES_ENABLED} ENV SETTINGS_REGISTRATIONS_REQUIRED_ON_START=${SETTINGS_REGISTRATIONS_REQUIRED_ON_START} ENV ADMIN_PASSWORD_RESET=${ADMIN_PASSWORD_RESET} ENV FAKE_DATA_GENERATOR=${FAKE_DATA_GENERATOR} ENV ARCGIS_CLIENT_ID=${ARCGIS_CLIENT_ID} ENV ARCGIS_CLIENT_SECRET=${ARCGIS_CLIENT_SECRET} ENV IP_STACK_API_KEY=${IP_STACK_API_KEY} ENV ENGINE_API_KEY=${ENGINE_API_KEY} ENV SENTRY_DSN=${SENTRY_DSN} ENV DB_URI=${DB_URI:-mongodb://localhost/ever_development} ENV DB_HOST=${DB_HOST:-localhost} Loading @@ -125,9 +172,9 @@ ENV AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} # 5555 for GraphQL # 5050 for GraphQL Subscriptions EXPOSE ${PORT} 5501 5050 5555 27017 28017 EXPOSE ${PORT} 5501 5050 5555 ENTRYPOINT [ "./entrypoint.prod.sh" ] # CMD [ "pm2-runtime", "main.js" ] CMD [ "node", "packages/core/build/main.js" ] CMD [ "pm2-runtime", "packages/core/build/main.js" ] # CMD [ "node", "packages/core/build/main.js" ] .deploy/k8s/k8s-manifest.demo.yaml +3 −1 Original line number Diff line number Diff line Loading @@ -179,6 +179,8 @@ spec: value: 'true' - name: NODE_ENV value: 'production' - name: API_HOST value: '0.0.0.0' - name: HTTPPORT value: '5500' # We use LB, so no need to expose HTTPS, only HTTPS required Loading Loading @@ -222,7 +224,7 @@ spec: ports: - containerPort: 5500 protocol: TCP # We use LB, so no need to expose HTTPS, only HTTPS required # We use LB, so no need to expose HTTPS, only HTTP required # - containerPort: 5501 # protocol: TCP - containerPort: 5555 Loading packages/core/package.json +113 −18 Original line number Diff line number Diff line { "name": "@ever-platform/core", "description": "Ever Platform Headless Framework", "description": "Ever Demand Platform Headless Framework Core", "license": "AGPL-3.0", "version": "0.4.3", "homepage": "https://ever.co", Loading Loading @@ -45,20 +45,49 @@ "@graphql-tools/merge": "^8.2.1", "@graphql-tools/schema": "^8.3.1", "@graphql-tools/utils": "^8.5.3", "@godaddy/terminus": "^4.5.0", "@grpc/grpc-js": "^1.4.0", "@nestjs/common": "^8.2.3", "@nestjs/core": "^8.2.3", "@nestjs/cqrs": "^8.0.0", "@nestjs/graphql": "^9.1.2", "@nestjs/jwt": "^8.0.0", "@nestjs/microservices": "^8.2.3", "@nestjs/passport": "^8.0.1", "@nestjs/platform-express": "^8.2.3", "@nestjs/platform-socket.io": "^8.2.3", "@nestjs/swagger": "^5.1.5", "@nestjs/terminus": "^8.0.1", "@nestjs/typeorm": "^8.0.2", "@nestjs/websockets": "^8.2.3", "@nestjsx/crud": "^5.0.0-alpha.3", "@nestjsx/crud-typeorm": "^5.0.0-alpha.3", "@ntegral/nestjs-sentry": "^3.0.6", "@sentry/node": "^6.8.0", "@sentry/tracing": "^6.8.0", "apollo-server-core": "^3.3.0", "apollo-server-express": "^3.5.0", "apollo-server-fastify": "^3.3.0", "app-root-path": "^3.0.0", "archiver": "^5.3.0", "aws-sdk": "^2.761.0", "axios": "^0.23.0", "bcrypt": "5.0.1", "cache-manager": "^3.4.0", "class-transformer": "^0.4.0", "class-validator": "^0.13.0", "cli-ux": "^5.5.0", "cls-hooked": "^4.2.2", "cross-fetch": "^3.0.6", "csurf": "^1.11.0", "csv-parser": "^2.3.2", "csv-writer": "^1.6.0", "currency.js": "^2.0.3", "date-fns": "^2.22.1", "email-templates": "^8.0.8", "express-session": "^1.17.1", "fast-json-stringify": "^2.4.1", "fastify-swagger": "^4.12.4", "bluebird": "^3.7.2", "body-parser": "^1.19.0", "bunyan": "^1.8.15", Loading @@ -72,7 +101,6 @@ "cors": "^2.8.5", "cryptiles": "^4.1.3", "destroy": "^1.0.4", "dotenv": "^10.0.0", "envalid": "^7.2.1", "errorhandler": "^1.5.1", "etag": "^1.8.1", Loading @@ -81,24 +109,39 @@ "express-handlebars": "^5.3.4", "faker": "^5.5.3", "fstream": "^1.0.12", "fs-extra": "^9.1.0", "graphql": "15.7.2", "graphql-tools": "^8.2.0", "graphql-playground-middleware-express": "^1.7.23", "graphql-subscriptions": "^2.0.0", "graphql-tools": "^8.2.0", "subscriptions-transport-ws": "^0.11.0", "handlebars": "^4.7.7", "helmet": "^4.1.1", "jsonwebtoken": "^8.5.1", "kafkajs": "^1.14.0", "mjml": "^4.7.0", "moment": "^2.29.1", "moment-range": "^4.0.2", "moment-timezone": "^0.5.31", "mqtt": "^4.2.1", "multer-s3": "^2.9.0", "mysql": "^2.18.1", "nats": "^2.0.2", "nest-router": "^1.0.9", "nestjs-i18n": "^8.1.2", "node-fetch": "^2.6.1", "nodemailer": "^6.4.11", "nodemailer-handlebars": "^1.0.1", "image-size": "^1.0.0", "install": "^0.13.0", "inversify": "^6.0.1", "ipstack": "^0.1.1", "jsonwebtoken": "^8.5.1", "lodash": "^4.17.21", "lodash.template": "^4.5.0", "lodash.templatesettings": "^4.2.0", "method-override": "^3.0.0", "mkdirp": "^1.0.4", "module-alias": "^2.2.2", "moment": "^2.29.1", "mongodb": "^4.2.1", "mongodb-memory-server": "^8.0.4", "mongoose": "^6.0.14", Loading @@ -106,21 +149,28 @@ "ms": "^2.1.3", "on-finished": "^2.3.0", "passport": "^0.5.0", "passport-jwt": "^4.0.0", "passport-facebook": "^3.0.0", "passport-google-oauth20": "^2.0.0", "passport-http-bearer": "^1.0.1", "passport-jwt": "^4.0.0", "passport-local": "^1.0.0", "passport-url": "^1.0.4", "pdfmake": "^0.2.0", "pg": "^8.6.0", "pg-query-stream": "^4.1.0", "redis": "^3.1.2", "pem": "^1.14.4", "pm2": "^5.1.2", "redis": "^3.1.2", "reflect-metadata": "^0.1.13", "request": "^2.88.0", "request-ip": "^2.1.3", "request-promise": "^4.2.4", "rxjs": "^7.4.0", "rxjs-compat": "^6.6.7", "sharp": "^0.29.3", "slugify": "^1.6.0", "sql.js": "^1.5.0", "sqlite3": "^5.0.2", "serve-favicon": "^2.5.0", "socket.io": "^4.3.0", "socket.io-client": "^4.3.0", Loading @@ -130,32 +180,58 @@ "symbol": "^0.3.1", "symbol-observable": "^4.0.0", "typeorm": "^0.2.41", "typeorm-aurora-data-api-driver": "^2.3.3", "typeorm-express-query-builder": "https://github.com/ever-co/typeorm-express-query-builder.git", "typescript-collections": "^1.3.3", "underscore": "^1.13.1", "underscore.string": "^3.3.5", "unleash-client": "^3.4.0", "unzipper": "^0.10.11", "upath": "^2.0.1", "uuid": "^8.3.2", "web-push": "^3.4.4", "chalk": "4.1.2", "validator": "^13.6.0", "ws": "^8.3.0" "ws": "^8.3.0", "yargs": "^16.2.0" }, "devDependencies": { "@nestjs/cli": "^8.0.2", "@nestjs/schematics": "^8.0.0", "@nestjs/testing": "^8.0.0", "@types/bcrypt": "^5.0.0", "@types/bluebird": "^3.5.36", "@types/email-templates": "^7.1.0", "@types/express": "^4.17.13", "@types/faker": "^5.5.8", "@types/fs-extra": "5.0.2", "@types/graphql": "^14.5.0", "@types/i18n": "^0.12.0", "@types/jest": "^27.0.2", "@types/multer": "^1.4.4", "@types/multer-s3": "^2.7.7", "@types/node": "16.11.0", "@types/node-fetch": "^1.6.9", "@types/nodemailer": "^6.4.0", "@types/passport": "^1.0.7", "@types/passport-jwt": "^3.0.6", "@types/socket.io": "^3.0.1", "@types/socket.io-client": "^1.4.36", "@types/supertest": "^2.0.10", "@types/uuid": "^8.3.1", "@types/web-push": "^3.3.0", "@types/yargs": "^15.0.9", "@types/body-parser": "^1.19.1", "@types/bunyan": "^1.8.7", "@types/bunyan-prettystream": "0.1.32", "@types/core-decorators": "^0.20.0", "@types/cors": "^2.8.12", "@types/errorhandler": "^1.5.0", "@types/express": "^4.17.13", "@types/faker": "^5.5.8", "@types/form-data": "^2.2.1", "@types/google-maps": "^3.2.3", "@types/googlemaps": "^3.30.16", "@types/graphql": "^14.5.0", "@types/handlebars": "^4.1.0", "@types/inversify": "^2.0.33", "@types/jest": "^27.0.2", "@types/jsonwebtoken": "^8.5.5", "@types/lodash": "^4.14.175", "@types/method-override": "^0.0.32", Loading @@ -163,25 +239,44 @@ "@types/moment": "^2.13.0", "@types/mongodb": "^4.0.7", "@types/mongoose": "^5.11.97", "@types/node": "16.11.0", "@types/passport": "^1.0.7", "@types/passport-jwt": "^3.0.6", "@types/redis": "^2.8.32", "@types/reflect-metadata": "^0.1.0", "@types/request": "^2.48.7", "@types/request-promise": "^4.1.48", "@types/sinon": "^10.0.4", "@types/socket.io": "^3.0.1", "@types/socket.io-client": "^1.4.36", "@types/source-map-support": "^0.5.4", "@types/stripe": "^8.0.416", "@types/uuid": "^8.3.1", "@types/ws": "^8.2.0", "copyfiles": "^2.4.1", "dotenv": "^10.0.0", "jest": "^26.6.3", "nodemon": "^2.0.4", "prettier": "^2.2.1", "rimraf": "^3.0.2", "supertest": "^6.0.1", "ts-jest": "^26.4.4", "ts-node": "~10.3.0", "tslint": "^6.1.1", "tslint-config-prettier": "^1.18.0", "typescript": "~4.4.4" }, "jest": { "moduleFileExtensions": [ "js", "json", "ts" ], "rootDir": "src", "testRegex": ".*\\.spec\\.ts$", "transform": { "^.+\\.(t|j)s$": "ts-jest" }, "collectCoverageFrom": [ "**/*.(t|j)s" ], "coverageDirectory": "../coverage/packages/core", "testEnvironment": "node" }, "nyc": { "include": [ "packages/**/*.ts" Loading packages/core/src/app.module.ts +11 −7 Original line number Diff line number Diff line import chalk from 'chalk'; import fs from 'fs'; import { MiddlewareConsumer, Loading Loading @@ -73,9 +74,10 @@ const mergeTypes = (types: any[], options?: { schemaDefinition?: boolean, all?: }; const port = env.GQLPORT; const host = env.API_HOST; const log: Logger = createEverLogger({ name: 'ApplicationModule from NestJS', name: 'NestJS ApplicationModule', }); // Add here all CQRS command handlers Loading Loading @@ -152,7 +154,7 @@ const connectionSettings: TypeOrmModuleOptions = { GraphQLModule.forRoot({ typePaths: ['./**/*.graphql'], installSubscriptionHandlers: true, debug: true, debug: !env.isProd, playground: true, context: ({ req, res }) => ({ req, Loading Loading @@ -196,6 +198,9 @@ export class ApplicationModule implements NestModule, OnModuleInit { } configure(consumer: MiddlewareConsumer) { console.log(chalk.green(`Configuring NestJS ApplicationModule`)); // trick for GraphQL vs MongoDB ObjectId type. // See https://github.com/apollographql/apollo-server/issues/1633 and // https://github.com/apollographql/apollo-server/issues/1649#issuecomment-420840287 Loading @@ -221,9 +226,8 @@ export class ApplicationModule implements NestModule, OnModuleInit { */ log.info( `GraphQL playground available at http://localhost:${port}/graphql` ); log.info(`GraphQL Playground available at http://${host}:${port}/graphql`); console.log(chalk.green(`GraphQL Playground available at http://${host}:${port}/graphql`)); } /* Loading @@ -233,8 +237,8 @@ export class ApplicationModule implements NestModule, OnModuleInit { const playgroundOptions: ApolloServerPluginLandingPageGraphQLPlaygroundOptions = { endpoint: `http://localhost:${port}/graphql`, subscriptionEndpoint: `ws://localhost:${port}/subscriptions`, endpoint: `http://${host}:${port}/graphql`, subscriptionEndpoint: `ws://${host}:${port}/subscriptions`, settings: { 'editor.theme': 'dark' } Loading packages/core/src/env.ts +6 −1 Original line number Diff line number Diff line Loading @@ -14,6 +14,9 @@ export type Env = Readonly<{ WEB_CONCURRENCY: number; WEB_MEMORY: number; EXPRESS_SESSION_SECRET: string; API_HOST: string; HTTPSPORT: number; HTTPPORT: number; GQLPORT: number; Loading Loading @@ -88,6 +91,7 @@ export const env: Env = cleanEnv( WEB_CONCURRENCY: num({ default: 1 }), WEB_MEMORY: num({ default: 2048 }), API_HOST: str({ default: '127.0.0.1'}), HTTPSPORT: port({ default: 5501 }), HTTPPORT: port({ default: 5500 }), GQLPORT: port({ default: 5555 }), Loading Loading @@ -119,7 +123,8 @@ export const env: Env = cleanEnv( FACEBOOK_APP_ID: str({ default: '' }), FACEBOOK_APP_SECRET: str({ default: '' }), JWT_SECRET: str({ default: 'default' }), EXPRESS_SESSION_SECRET: str({ default: 'ever-demand' }), JWT_SECRET: str({ default: 'ever-demand' }), ADMIN_PASSWORD_BCRYPT_SALT_ROUNDS: num({ desc: 'Used for passwords encryption, recommended value: 12', Loading Loading
.deploy/api/Dockerfile +50 −3 Original line number Diff line number Diff line Loading @@ -5,6 +5,29 @@ ARG NODE_ENV ARG API_BASE_URL ARG API_HOST ARG API_PORT ARG HTTPPORT ARG HTTPSPORT ARG GQLPORT ARG GQLPORT_SUBSCRIPTIONS ARG STRIPE_SECRET_KEY ARG URBAN_AIRSHIP_KEY ARG URBAN_AIRSHIP_SECRET ARG KEYMETRICS_MACHINE_NAME ARG KEYMETRICS_SECRET_KEY ARG KEYMETRICS_PUBLIC_KEY ARG GOOGLE_APP_ID ARG GOOGLE_APP_SECRET ARG FACEBOOK_APP_ID ARG FACEBOOK_APP_SECRET ARG JWT_SECRET ARG SETTING_INVITES_ENABLED ARG SETTINGS_REGISTRATIONS_REQUIRED_ON_START ARG ADMIN_PASSWORD_RESET ARG FAKE_DATA_GENERATOR ARG ARCGIS_CLIENT_ID ARG ARCGIS_CLIENT_SECRET ARG IP_STACK_API_KEY ARG ENGINE_API_KEY ARG SENTRY_DSN ARG DB_URI ARG DB_HOST Loading Loading @@ -104,6 +127,30 @@ ENV NODE_ENV=${NODE_ENV:-production} ENV API_HOST=${API_HOST:-api} ENV API_PORT=${API_PORT:-5500} ENV API_BASE_URL=${API_BASE_URL:-http://localhost:5500} ENV HTTPPORT=${HTTPPORT} ENV HTTPSPORT=${HTTPSPORT} ENV GQLPORT=${GQLPORT} ENV GQLPORT_SUBSCRIPTIONS=${GQLPORT_SUBSCRIPTIONS} ENV SETTING_INVITES_ENABLED=${SETTING_INVITES_ENABLED} ENV STRIPE_SECRET_KEY=${STRIPE_SECRET_KEY} ENV URBAN_AIRSHIP_KEY=${URBAN_AIRSHIP_KEY} ENV URBAN_AIRSHIP_SECRET=${URBAN_AIRSHIP_SECRET} ENV KEYMETRICS_MACHINE_NAME=${KEYMETRICS_MACHINE_NAME} ENV KEYMETRICS_SECRET_KEY=${KEYMETRICS_SECRET_KEY} ENV KEYMETRICS_PUBLIC_KEY=${KEYMETRICS_PUBLIC_KEY} ENV GOOGLE_APP_ID=${GOOGLE_APP_ID} ENV GOOGLE_APP_SECRET=${GOOGLE_APP_SECRET} ENV FACEBOOK_APP_ID=${FACEBOOK_APP_ID} ENV FACEBOOK_APP_SECRET=${FACEBOOK_APP_SECRET} ENV JWT_SECRET=${JWT_SECRET} ENV SETTING_INVITES_ENABLED=${SETTING_INVITES_ENABLED} ENV SETTINGS_REGISTRATIONS_REQUIRED_ON_START=${SETTINGS_REGISTRATIONS_REQUIRED_ON_START} ENV ADMIN_PASSWORD_RESET=${ADMIN_PASSWORD_RESET} ENV FAKE_DATA_GENERATOR=${FAKE_DATA_GENERATOR} ENV ARCGIS_CLIENT_ID=${ARCGIS_CLIENT_ID} ENV ARCGIS_CLIENT_SECRET=${ARCGIS_CLIENT_SECRET} ENV IP_STACK_API_KEY=${IP_STACK_API_KEY} ENV ENGINE_API_KEY=${ENGINE_API_KEY} ENV SENTRY_DSN=${SENTRY_DSN} ENV DB_URI=${DB_URI:-mongodb://localhost/ever_development} ENV DB_HOST=${DB_HOST:-localhost} Loading @@ -125,9 +172,9 @@ ENV AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} # 5555 for GraphQL # 5050 for GraphQL Subscriptions EXPOSE ${PORT} 5501 5050 5555 27017 28017 EXPOSE ${PORT} 5501 5050 5555 ENTRYPOINT [ "./entrypoint.prod.sh" ] # CMD [ "pm2-runtime", "main.js" ] CMD [ "node", "packages/core/build/main.js" ] CMD [ "pm2-runtime", "packages/core/build/main.js" ] # CMD [ "node", "packages/core/build/main.js" ]
.deploy/k8s/k8s-manifest.demo.yaml +3 −1 Original line number Diff line number Diff line Loading @@ -179,6 +179,8 @@ spec: value: 'true' - name: NODE_ENV value: 'production' - name: API_HOST value: '0.0.0.0' - name: HTTPPORT value: '5500' # We use LB, so no need to expose HTTPS, only HTTPS required Loading Loading @@ -222,7 +224,7 @@ spec: ports: - containerPort: 5500 protocol: TCP # We use LB, so no need to expose HTTPS, only HTTPS required # We use LB, so no need to expose HTTPS, only HTTP required # - containerPort: 5501 # protocol: TCP - containerPort: 5555 Loading
packages/core/package.json +113 −18 Original line number Diff line number Diff line { "name": "@ever-platform/core", "description": "Ever Platform Headless Framework", "description": "Ever Demand Platform Headless Framework Core", "license": "AGPL-3.0", "version": "0.4.3", "homepage": "https://ever.co", Loading Loading @@ -45,20 +45,49 @@ "@graphql-tools/merge": "^8.2.1", "@graphql-tools/schema": "^8.3.1", "@graphql-tools/utils": "^8.5.3", "@godaddy/terminus": "^4.5.0", "@grpc/grpc-js": "^1.4.0", "@nestjs/common": "^8.2.3", "@nestjs/core": "^8.2.3", "@nestjs/cqrs": "^8.0.0", "@nestjs/graphql": "^9.1.2", "@nestjs/jwt": "^8.0.0", "@nestjs/microservices": "^8.2.3", "@nestjs/passport": "^8.0.1", "@nestjs/platform-express": "^8.2.3", "@nestjs/platform-socket.io": "^8.2.3", "@nestjs/swagger": "^5.1.5", "@nestjs/terminus": "^8.0.1", "@nestjs/typeorm": "^8.0.2", "@nestjs/websockets": "^8.2.3", "@nestjsx/crud": "^5.0.0-alpha.3", "@nestjsx/crud-typeorm": "^5.0.0-alpha.3", "@ntegral/nestjs-sentry": "^3.0.6", "@sentry/node": "^6.8.0", "@sentry/tracing": "^6.8.0", "apollo-server-core": "^3.3.0", "apollo-server-express": "^3.5.0", "apollo-server-fastify": "^3.3.0", "app-root-path": "^3.0.0", "archiver": "^5.3.0", "aws-sdk": "^2.761.0", "axios": "^0.23.0", "bcrypt": "5.0.1", "cache-manager": "^3.4.0", "class-transformer": "^0.4.0", "class-validator": "^0.13.0", "cli-ux": "^5.5.0", "cls-hooked": "^4.2.2", "cross-fetch": "^3.0.6", "csurf": "^1.11.0", "csv-parser": "^2.3.2", "csv-writer": "^1.6.0", "currency.js": "^2.0.3", "date-fns": "^2.22.1", "email-templates": "^8.0.8", "express-session": "^1.17.1", "fast-json-stringify": "^2.4.1", "fastify-swagger": "^4.12.4", "bluebird": "^3.7.2", "body-parser": "^1.19.0", "bunyan": "^1.8.15", Loading @@ -72,7 +101,6 @@ "cors": "^2.8.5", "cryptiles": "^4.1.3", "destroy": "^1.0.4", "dotenv": "^10.0.0", "envalid": "^7.2.1", "errorhandler": "^1.5.1", "etag": "^1.8.1", Loading @@ -81,24 +109,39 @@ "express-handlebars": "^5.3.4", "faker": "^5.5.3", "fstream": "^1.0.12", "fs-extra": "^9.1.0", "graphql": "15.7.2", "graphql-tools": "^8.2.0", "graphql-playground-middleware-express": "^1.7.23", "graphql-subscriptions": "^2.0.0", "graphql-tools": "^8.2.0", "subscriptions-transport-ws": "^0.11.0", "handlebars": "^4.7.7", "helmet": "^4.1.1", "jsonwebtoken": "^8.5.1", "kafkajs": "^1.14.0", "mjml": "^4.7.0", "moment": "^2.29.1", "moment-range": "^4.0.2", "moment-timezone": "^0.5.31", "mqtt": "^4.2.1", "multer-s3": "^2.9.0", "mysql": "^2.18.1", "nats": "^2.0.2", "nest-router": "^1.0.9", "nestjs-i18n": "^8.1.2", "node-fetch": "^2.6.1", "nodemailer": "^6.4.11", "nodemailer-handlebars": "^1.0.1", "image-size": "^1.0.0", "install": "^0.13.0", "inversify": "^6.0.1", "ipstack": "^0.1.1", "jsonwebtoken": "^8.5.1", "lodash": "^4.17.21", "lodash.template": "^4.5.0", "lodash.templatesettings": "^4.2.0", "method-override": "^3.0.0", "mkdirp": "^1.0.4", "module-alias": "^2.2.2", "moment": "^2.29.1", "mongodb": "^4.2.1", "mongodb-memory-server": "^8.0.4", "mongoose": "^6.0.14", Loading @@ -106,21 +149,28 @@ "ms": "^2.1.3", "on-finished": "^2.3.0", "passport": "^0.5.0", "passport-jwt": "^4.0.0", "passport-facebook": "^3.0.0", "passport-google-oauth20": "^2.0.0", "passport-http-bearer": "^1.0.1", "passport-jwt": "^4.0.0", "passport-local": "^1.0.0", "passport-url": "^1.0.4", "pdfmake": "^0.2.0", "pg": "^8.6.0", "pg-query-stream": "^4.1.0", "redis": "^3.1.2", "pem": "^1.14.4", "pm2": "^5.1.2", "redis": "^3.1.2", "reflect-metadata": "^0.1.13", "request": "^2.88.0", "request-ip": "^2.1.3", "request-promise": "^4.2.4", "rxjs": "^7.4.0", "rxjs-compat": "^6.6.7", "sharp": "^0.29.3", "slugify": "^1.6.0", "sql.js": "^1.5.0", "sqlite3": "^5.0.2", "serve-favicon": "^2.5.0", "socket.io": "^4.3.0", "socket.io-client": "^4.3.0", Loading @@ -130,32 +180,58 @@ "symbol": "^0.3.1", "symbol-observable": "^4.0.0", "typeorm": "^0.2.41", "typeorm-aurora-data-api-driver": "^2.3.3", "typeorm-express-query-builder": "https://github.com/ever-co/typeorm-express-query-builder.git", "typescript-collections": "^1.3.3", "underscore": "^1.13.1", "underscore.string": "^3.3.5", "unleash-client": "^3.4.0", "unzipper": "^0.10.11", "upath": "^2.0.1", "uuid": "^8.3.2", "web-push": "^3.4.4", "chalk": "4.1.2", "validator": "^13.6.0", "ws": "^8.3.0" "ws": "^8.3.0", "yargs": "^16.2.0" }, "devDependencies": { "@nestjs/cli": "^8.0.2", "@nestjs/schematics": "^8.0.0", "@nestjs/testing": "^8.0.0", "@types/bcrypt": "^5.0.0", "@types/bluebird": "^3.5.36", "@types/email-templates": "^7.1.0", "@types/express": "^4.17.13", "@types/faker": "^5.5.8", "@types/fs-extra": "5.0.2", "@types/graphql": "^14.5.0", "@types/i18n": "^0.12.0", "@types/jest": "^27.0.2", "@types/multer": "^1.4.4", "@types/multer-s3": "^2.7.7", "@types/node": "16.11.0", "@types/node-fetch": "^1.6.9", "@types/nodemailer": "^6.4.0", "@types/passport": "^1.0.7", "@types/passport-jwt": "^3.0.6", "@types/socket.io": "^3.0.1", "@types/socket.io-client": "^1.4.36", "@types/supertest": "^2.0.10", "@types/uuid": "^8.3.1", "@types/web-push": "^3.3.0", "@types/yargs": "^15.0.9", "@types/body-parser": "^1.19.1", "@types/bunyan": "^1.8.7", "@types/bunyan-prettystream": "0.1.32", "@types/core-decorators": "^0.20.0", "@types/cors": "^2.8.12", "@types/errorhandler": "^1.5.0", "@types/express": "^4.17.13", "@types/faker": "^5.5.8", "@types/form-data": "^2.2.1", "@types/google-maps": "^3.2.3", "@types/googlemaps": "^3.30.16", "@types/graphql": "^14.5.0", "@types/handlebars": "^4.1.0", "@types/inversify": "^2.0.33", "@types/jest": "^27.0.2", "@types/jsonwebtoken": "^8.5.5", "@types/lodash": "^4.14.175", "@types/method-override": "^0.0.32", Loading @@ -163,25 +239,44 @@ "@types/moment": "^2.13.0", "@types/mongodb": "^4.0.7", "@types/mongoose": "^5.11.97", "@types/node": "16.11.0", "@types/passport": "^1.0.7", "@types/passport-jwt": "^3.0.6", "@types/redis": "^2.8.32", "@types/reflect-metadata": "^0.1.0", "@types/request": "^2.48.7", "@types/request-promise": "^4.1.48", "@types/sinon": "^10.0.4", "@types/socket.io": "^3.0.1", "@types/socket.io-client": "^1.4.36", "@types/source-map-support": "^0.5.4", "@types/stripe": "^8.0.416", "@types/uuid": "^8.3.1", "@types/ws": "^8.2.0", "copyfiles": "^2.4.1", "dotenv": "^10.0.0", "jest": "^26.6.3", "nodemon": "^2.0.4", "prettier": "^2.2.1", "rimraf": "^3.0.2", "supertest": "^6.0.1", "ts-jest": "^26.4.4", "ts-node": "~10.3.0", "tslint": "^6.1.1", "tslint-config-prettier": "^1.18.0", "typescript": "~4.4.4" }, "jest": { "moduleFileExtensions": [ "js", "json", "ts" ], "rootDir": "src", "testRegex": ".*\\.spec\\.ts$", "transform": { "^.+\\.(t|j)s$": "ts-jest" }, "collectCoverageFrom": [ "**/*.(t|j)s" ], "coverageDirectory": "../coverage/packages/core", "testEnvironment": "node" }, "nyc": { "include": [ "packages/**/*.ts" Loading
packages/core/src/app.module.ts +11 −7 Original line number Diff line number Diff line import chalk from 'chalk'; import fs from 'fs'; import { MiddlewareConsumer, Loading Loading @@ -73,9 +74,10 @@ const mergeTypes = (types: any[], options?: { schemaDefinition?: boolean, all?: }; const port = env.GQLPORT; const host = env.API_HOST; const log: Logger = createEverLogger({ name: 'ApplicationModule from NestJS', name: 'NestJS ApplicationModule', }); // Add here all CQRS command handlers Loading Loading @@ -152,7 +154,7 @@ const connectionSettings: TypeOrmModuleOptions = { GraphQLModule.forRoot({ typePaths: ['./**/*.graphql'], installSubscriptionHandlers: true, debug: true, debug: !env.isProd, playground: true, context: ({ req, res }) => ({ req, Loading Loading @@ -196,6 +198,9 @@ export class ApplicationModule implements NestModule, OnModuleInit { } configure(consumer: MiddlewareConsumer) { console.log(chalk.green(`Configuring NestJS ApplicationModule`)); // trick for GraphQL vs MongoDB ObjectId type. // See https://github.com/apollographql/apollo-server/issues/1633 and // https://github.com/apollographql/apollo-server/issues/1649#issuecomment-420840287 Loading @@ -221,9 +226,8 @@ export class ApplicationModule implements NestModule, OnModuleInit { */ log.info( `GraphQL playground available at http://localhost:${port}/graphql` ); log.info(`GraphQL Playground available at http://${host}:${port}/graphql`); console.log(chalk.green(`GraphQL Playground available at http://${host}:${port}/graphql`)); } /* Loading @@ -233,8 +237,8 @@ export class ApplicationModule implements NestModule, OnModuleInit { const playgroundOptions: ApolloServerPluginLandingPageGraphQLPlaygroundOptions = { endpoint: `http://localhost:${port}/graphql`, subscriptionEndpoint: `ws://localhost:${port}/subscriptions`, endpoint: `http://${host}:${port}/graphql`, subscriptionEndpoint: `ws://${host}:${port}/subscriptions`, settings: { 'editor.theme': 'dark' } Loading
packages/core/src/env.ts +6 −1 Original line number Diff line number Diff line Loading @@ -14,6 +14,9 @@ export type Env = Readonly<{ WEB_CONCURRENCY: number; WEB_MEMORY: number; EXPRESS_SESSION_SECRET: string; API_HOST: string; HTTPSPORT: number; HTTPPORT: number; GQLPORT: number; Loading Loading @@ -88,6 +91,7 @@ export const env: Env = cleanEnv( WEB_CONCURRENCY: num({ default: 1 }), WEB_MEMORY: num({ default: 2048 }), API_HOST: str({ default: '127.0.0.1'}), HTTPSPORT: port({ default: 5501 }), HTTPPORT: port({ default: 5500 }), GQLPORT: port({ default: 5555 }), Loading Loading @@ -119,7 +123,8 @@ export const env: Env = cleanEnv( FACEBOOK_APP_ID: str({ default: '' }), FACEBOOK_APP_SECRET: str({ default: '' }), JWT_SECRET: str({ default: 'default' }), EXPRESS_SESSION_SECRET: str({ default: 'ever-demand' }), JWT_SECRET: str({ default: 'ever-demand' }), ADMIN_PASSWORD_BCRYPT_SALT_ROUNDS: num({ desc: 'Used for passwords encryption, recommended value: 12', Loading