├── src ├── config │ ├── services.ts │ ├── index.ts │ └── envs.ts ├── health-check │ ├── health-check.module.ts │ └── health-check.controller.ts ├── app.module.ts ├── payments │ ├── payments.module.ts │ ├── dto │ │ └── payment-session.dto.ts │ ├── payments.controller.ts │ └── payments.service.ts ├── transports │ └── nats.module.ts └── main.ts ├── .prettierrc ├── .dockerignore ├── tsconfig.build.json ├── dockerfile ├── nest-cli.json ├── test ├── jest-e2e.json └── app.e2e-spec.ts ├── .env.template ├── cloudbuild.yml ├── tsconfig.json ├── .eslintrc.js ├── .gitignore ├── dockerfile.prod ├── package.json └── README.md /src/config/services.ts: -------------------------------------------------------------------------------- 1 | export const NATS_SERVICE = 'NATS_SERVICE'; 2 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } -------------------------------------------------------------------------------- /src/config/index.ts: -------------------------------------------------------------------------------- 1 | export * from './envs'; 2 | export * from './services'; 3 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | dist/ 5 | 6 | node_modules/ 7 | 8 | .env 9 | 10 | .vscode/ -------------------------------------------------------------------------------- /tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:21-alpine3.19 2 | 3 | WORKDIR /usr/src/app 4 | 5 | COPY package.json ./ 6 | COPY package-lock.json ./ 7 | 8 | 9 | RUN npm install 10 | 11 | COPY . . 12 | 13 | EXPOSE 3003 -------------------------------------------------------------------------------- /nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/nest-cli", 3 | "collection": "@nestjs/schematics", 4 | "sourceRoot": "src", 5 | "compilerOptions": { 6 | "deleteOutDir": true 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/health-check/health-check.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { HealthCheckController } from './health-check.controller'; 3 | 4 | @Module({ 5 | controllers: [HealthCheckController] 6 | }) 7 | export class HealthCheckModule {} 8 | -------------------------------------------------------------------------------- /src/health-check/health-check.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get } from '@nestjs/common'; 2 | 3 | @Controller('/') 4 | export class HealthCheckController { 5 | 6 | @Get() 7 | healthCheck() { 8 | return 'Payments Webhook is up and running!!'; 9 | } 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/app.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { PaymentsModule } from './payments/payments.module'; 3 | import { HealthCheckModule } from './health-check/health-check.module'; 4 | 5 | 6 | @Module({ 7 | imports: [PaymentsModule, HealthCheckModule], 8 | 9 | }) 10 | export class AppModule {} 11 | -------------------------------------------------------------------------------- /src/payments/payments.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { PaymentsService } from './payments.service'; 3 | import { PaymentsController } from './payments.controller'; 4 | import { NatsModule } from 'src/transports/nats.module'; 5 | 6 | @Module({ 7 | controllers: [PaymentsController], 8 | providers: [PaymentsService], 9 | imports: [NatsModule], 10 | }) 11 | export class PaymentsModule {} 12 | -------------------------------------------------------------------------------- /.env.template: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PORT=3003 5 | 6 | # https://dashboard.stripe.com/test/apikeys 7 | STRIPE_SECRET= 8 | 9 | STRIPE_SUCCESS_URL=http://localhost:3003/payments/success 10 | STRIPE_CANCEL_URL=http://localhost:3003/payments/cancel 11 | 12 | # https://dashboard.stripe.com/test/webhooks/we_1OrjjpLpSSVtW50ltIQEAP8z 13 | # Este es el signing secret del webhook 14 | STRIPE_ENDPOINT_SECRET= 15 | 16 | # NATS_SERVERS="nats://localhost:4222,nats://localhost:4223" 17 | NATS_SERVERS="nats://localhost:4222" -------------------------------------------------------------------------------- /cloudbuild.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - name: "gcr.io/cloud-builders/docker" 3 | args: 4 | [ 5 | "build", 6 | "-t", 7 | "northamerica-northeast1-docker.pkg.dev/tienda-microservices/image-registry/payments-ms", 8 | "-f", 9 | "dockerfile.prod", 10 | "--platform=linux/amd64", 11 | ".", 12 | ] 13 | - name: "gcr.io/cloud-builders/docker" 14 | args: 15 | [ 16 | "push", 17 | "northamerica-northeast1-docker.pkg.dev/tienda-microservices/image-registry/payments-ms", 18 | ] -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "target": "ES2021", 10 | "sourceMap": true, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "incremental": true, 14 | "skipLibCheck": true, 15 | "strictNullChecks": false, 16 | "noImplicitAny": false, 17 | "strictBindCallApply": false, 18 | "forceConsistentCasingInFileNames": false, 19 | "noFallthroughCasesInSwitch": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { Test, TestingModule } from '@nestjs/testing'; 2 | import { INestApplication } from '@nestjs/common'; 3 | import * as request from 'supertest'; 4 | import { AppModule } from './../src/app.module'; 5 | 6 | describe('AppController (e2e)', () => { 7 | let app: INestApplication; 8 | 9 | beforeEach(async () => { 10 | const moduleFixture: TestingModule = await Test.createTestingModule({ 11 | imports: [AppModule], 12 | }).compile(); 13 | 14 | app = moduleFixture.createNestApplication(); 15 | await app.init(); 16 | }); 17 | 18 | it('/ (GET)', () => { 19 | return request(app.getHttpServer()) 20 | .get('/') 21 | .expect(200) 22 | .expect('Hello World!'); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /src/transports/nats.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from '@nestjs/common'; 2 | import { ClientsModule, Transport } from '@nestjs/microservices'; 3 | import { NATS_SERVICE, envs } from 'src/config'; 4 | 5 | @Module({ 6 | imports: [ 7 | ClientsModule.register([ 8 | { 9 | name: NATS_SERVICE, 10 | transport: Transport.NATS, 11 | options: { 12 | servers: envs.natsServers, 13 | }, 14 | }, 15 | ]), 16 | ], 17 | exports: [ 18 | ClientsModule.register([ 19 | { 20 | name: NATS_SERVICE, 21 | transport: Transport.NATS, 22 | options: { 23 | servers: envs.natsServers, 24 | }, 25 | }, 26 | ]), 27 | ], 28 | }) 29 | export class NatsModule {} 30 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | parser: '@typescript-eslint/parser', 3 | parserOptions: { 4 | project: 'tsconfig.json', 5 | tsconfigRootDir: __dirname, 6 | sourceType: 'module', 7 | }, 8 | plugins: ['@typescript-eslint/eslint-plugin'], 9 | extends: [ 10 | 'plugin:@typescript-eslint/recommended', 11 | 'plugin:prettier/recommended', 12 | ], 13 | root: true, 14 | env: { 15 | node: true, 16 | jest: true, 17 | }, 18 | ignorePatterns: ['.eslintrc.js'], 19 | rules: { 20 | '@typescript-eslint/interface-name-prefix': 'off', 21 | '@typescript-eslint/explicit-function-return-type': 'off', 22 | '@typescript-eslint/explicit-module-boundary-types': 'off', 23 | '@typescript-eslint/no-explicit-any': 'off', 24 | }, 25 | }; 26 | -------------------------------------------------------------------------------- /src/payments/dto/payment-session.dto.ts: -------------------------------------------------------------------------------- 1 | import { Type } from 'class-transformer'; 2 | import { ArrayMinSize, IsArray, IsNumber, IsPositive, IsString, ValidateNested } from 'class-validator'; 3 | 4 | 5 | export class PaymentSessionDto { 6 | 7 | 8 | @IsString() 9 | orderId: string; 10 | 11 | 12 | @IsString() 13 | currency: string; 14 | 15 | 16 | @IsArray() 17 | @ArrayMinSize(1) 18 | @ValidateNested({ each: true }) 19 | @Type( () => PaymentSessionItemDto ) 20 | items: PaymentSessionItemDto[]; 21 | 22 | } 23 | 24 | 25 | export class PaymentSessionItemDto { 26 | 27 | @IsString() 28 | name: string; 29 | 30 | @IsNumber() 31 | @IsPositive() 32 | price: number; 33 | 34 | @IsNumber() 35 | @IsPositive() 36 | quantity: number; 37 | 38 | 39 | 40 | } 41 | 42 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # compiled output 2 | /dist 3 | /node_modules 4 | /build 5 | 6 | # Logs 7 | logs 8 | *.log 9 | npm-debug.log* 10 | pnpm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | lerna-debug.log* 14 | 15 | # OS 16 | .DS_Store 17 | 18 | # Tests 19 | /coverage 20 | /.nyc_output 21 | 22 | # IDEs and editors 23 | /.idea 24 | .project 25 | .classpath 26 | .c9/ 27 | *.launch 28 | .settings/ 29 | *.sublime-workspace 30 | 31 | # IDE - VSCode 32 | .vscode/* 33 | !.vscode/settings.json 34 | !.vscode/tasks.json 35 | !.vscode/launch.json 36 | !.vscode/extensions.json 37 | 38 | # dotenv environment variable files 39 | .env 40 | .env.development.local 41 | .env.test.local 42 | .env.production.local 43 | .env.local 44 | 45 | # temp directory 46 | .temp 47 | .tmp 48 | 49 | # Runtime data 50 | pids 51 | *.pid 52 | *.seed 53 | *.pid.lock 54 | 55 | # Diagnostic reports (https://nodejs.org/api/report.html) 56 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 57 | -------------------------------------------------------------------------------- /dockerfile.prod: -------------------------------------------------------------------------------- 1 | # Dependencias 2 | FROM node:21-alpine3.19 as deps 3 | 4 | WORKDIR /usr/src/app 5 | 6 | COPY package.json ./ 7 | COPY package-lock.json ./ 8 | 9 | RUN npm install 10 | 11 | 12 | 13 | 14 | # Builder - Construye la aplicación 15 | FROM node:21-alpine3.19 as build 16 | 17 | WORKDIR /usr/src/app 18 | 19 | # Copiar de deps, los módulos de node 20 | COPY --from=deps /usr/src/app/node_modules ./node_modules 21 | 22 | # Copiar todo el codigo fuente de la aplicación 23 | COPY . . 24 | 25 | # RUN npm run test 26 | RUN npm run build 27 | 28 | RUN npm ci -f --only=production && npm cache clean --force 29 | 30 | RUN npx prisma generate 31 | 32 | 33 | 34 | # Crear la imagen final de Docker 35 | FROM node:21-alpine3.19 as prod 36 | 37 | WORKDIR /usr/src/app 38 | 39 | 40 | COPY --from=build /usr/src/app/node_modules ./node_modules 41 | 42 | # Copiar la carpeta de DIST 43 | COPY --from=build /usr/src/app/dist ./dist 44 | 45 | 46 | ENV NODE_ENV=production 47 | 48 | USER node 49 | 50 | 51 | EXPOSE 3000 52 | 53 | CMD [ "node", "dist/main.js" ] -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { NestFactory } from '@nestjs/core'; 2 | import { Logger, ValidationPipe } from '@nestjs/common'; 3 | import { AppModule } from './app.module'; 4 | import { envs } from './config'; 5 | import { MicroserviceOptions, Transport } from '@nestjs/microservices'; 6 | 7 | async function bootstrap() { 8 | const logger = new Logger('Payments-ms'); 9 | 10 | const app = await NestFactory.create(AppModule, { 11 | rawBody: true 12 | }); 13 | 14 | app.useGlobalPipes( 15 | new ValidationPipe({ 16 | whitelist: true, 17 | forbidNonWhitelisted: true, 18 | }), 19 | ); 20 | 21 | app.connectMicroservice({ 22 | transport: Transport.NATS, 23 | options: { 24 | servers: envs.natsServers, 25 | }, 26 | }, { 27 | inheritAppConfig: true 28 | }) 29 | 30 | 31 | await app.startAllMicroservices(); 32 | 33 | await app.listen(envs.port); 34 | 35 | console.log('Health Check configured'); 36 | 37 | logger.log(`Payments Microservice running on port ${envs.port}`); 38 | } 39 | bootstrap(); 40 | -------------------------------------------------------------------------------- /src/payments/payments.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get, Post, Req, Res } from '@nestjs/common'; 2 | import { MessagePattern, Payload } from '@nestjs/microservices'; 3 | import { PaymentsService } from './payments.service'; 4 | import { PaymentSessionDto } from './dto/payment-session.dto'; 5 | import { Request, Response } from 'express'; 6 | 7 | @Controller('payments') 8 | export class PaymentsController { 9 | constructor(private readonly paymentsService: PaymentsService) {} 10 | 11 | 12 | // @Post('create-payment-session') 13 | @MessagePattern('create.payment.session') 14 | createPaymentSession(@Payload() paymentSessionDto: PaymentSessionDto ) { 15 | return this.paymentsService.createPaymentSession(paymentSessionDto); 16 | } 17 | 18 | @Get('success') 19 | success() { 20 | return { 21 | ok: true, 22 | message: 'Payment successful' 23 | } 24 | } 25 | 26 | @Get('cancel') 27 | cancel() { 28 | return { 29 | ok: false, 30 | message: 'Payment cancelled' 31 | } 32 | } 33 | 34 | 35 | @Post('webhook') 36 | async stripeWebhook(@Req() req: Request, @Res() res: Response) { 37 | return this.paymentsService.stripeWebhook(req, res); 38 | } 39 | 40 | 41 | 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/config/envs.ts: -------------------------------------------------------------------------------- 1 | import 'dotenv/config'; 2 | 3 | import * as joi from 'joi'; 4 | 5 | interface EnvVars { 6 | PORT: number; 7 | 8 | STRIPE_SECRET: string; 9 | STRIPE_SUCCESS_URL: string; 10 | STRIPE_CANCEL_URL: string; 11 | STRIPE_ENDPOINT_SECRET: string; 12 | 13 | NATS_SERVERS: string[]; 14 | } 15 | 16 | const envsSchema = joi.object({ 17 | PORT: joi.number().required(), 18 | 19 | STRIPE_SECRET: joi.string().required(), 20 | STRIPE_SUCCESS_URL: joi.string().required(), 21 | STRIPE_CANCEL_URL: joi.string().required(), 22 | STRIPE_ENDPOINT_SECRET: joi.string().required(), 23 | 24 | NATS_SERVERS: joi.array().items( joi.string() ).required(), 25 | }) 26 | .unknown(true); 27 | 28 | const { error, value } = envsSchema.validate({ 29 | ...process.env, 30 | NATS_SERVERS: process.env.NATS_SERVERS?.split(',') 31 | }); 32 | 33 | 34 | if ( error ) { 35 | throw new Error(`Config validation error: ${ error.message }`); 36 | } 37 | 38 | const envVars:EnvVars = value; 39 | 40 | 41 | export const envs = { 42 | port: envVars.PORT, 43 | 44 | stripeSecret: envVars.STRIPE_SECRET, 45 | stripeSuccessUrl: envVars.STRIPE_SUCCESS_URL, 46 | stripeCancelUrl: envVars.STRIPE_CANCEL_URL, 47 | stripeEndpointSecret: envVars.STRIPE_ENDPOINT_SECRET, 48 | 49 | natsServers: envVars.NATS_SERVERS, 50 | } 51 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "payments-ms", 3 | "version": "0.0.1", 4 | "description": "", 5 | "author": "", 6 | "private": true, 7 | "license": "UNLICENSED", 8 | "scripts": { 9 | "build": "nest build", 10 | "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"", 11 | "start": "nest start", 12 | "start:dev": "nest start --watch", 13 | "start:debug": "nest start --debug --watch", 14 | "start:prod": "node dist/main", 15 | "lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix", 16 | "test": "jest", 17 | "test:watch": "jest --watch", 18 | "test:cov": "jest --coverage", 19 | "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", 20 | "test:e2e": "jest --config ./test/jest-e2e.json" 21 | }, 22 | "dependencies": { 23 | "@nestjs/common": "^10.0.0", 24 | "@nestjs/core": "^10.0.0", 25 | "@nestjs/mapped-types": "*", 26 | "@nestjs/microservices": "^10.3.3", 27 | "@nestjs/platform-express": "^10.0.0", 28 | "class-transformer": "^0.5.1", 29 | "class-validator": "^0.14.1", 30 | "dotenv": "^16.4.5", 31 | "joi": "^17.12.2", 32 | "nats": "^2.19.0", 33 | "reflect-metadata": "^0.2.0", 34 | "rxjs": "^7.8.1", 35 | "stripe": "^14.19.0" 36 | }, 37 | "devDependencies": { 38 | "@nestjs/cli": "^10.0.0", 39 | "@nestjs/schematics": "^10.0.0", 40 | "@nestjs/testing": "^10.0.0", 41 | "@types/express": "^4.17.17", 42 | "@types/jest": "^29.5.2", 43 | "@types/node": "^20.3.1", 44 | "@types/supertest": "^6.0.0", 45 | "@typescript-eslint/eslint-plugin": "^6.0.0", 46 | "@typescript-eslint/parser": "^6.0.0", 47 | "eslint": "^8.42.0", 48 | "eslint-config-prettier": "^9.0.0", 49 | "eslint-plugin-prettier": "^5.0.0", 50 | "jest": "^29.5.0", 51 | "prettier": "^3.0.0", 52 | "source-map-support": "^0.5.21", 53 | "supertest": "^6.3.3", 54 | "ts-jest": "^29.1.0", 55 | "ts-loader": "^9.4.3", 56 | "ts-node": "^10.9.1", 57 | "tsconfig-paths": "^4.2.0", 58 | "typescript": "^5.1.3" 59 | }, 60 | "jest": { 61 | "moduleFileExtensions": [ 62 | "js", 63 | "json", 64 | "ts" 65 | ], 66 | "rootDir": "src", 67 | "testRegex": ".*\\.spec\\.ts$", 68 | "transform": { 69 | "^.+\\.(t|j)s$": "ts-jest" 70 | }, 71 | "collectCoverageFrom": [ 72 | "**/*.(t|j)s" 73 | ], 74 | "coverageDirectory": "../coverage", 75 | "testEnvironment": "node" 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/payments/payments.service.ts: -------------------------------------------------------------------------------- 1 | import { Inject, Injectable, Logger } from '@nestjs/common'; 2 | import { NATS_SERVICE, envs } from 'src/config'; 3 | import Stripe from 'stripe'; 4 | import { PaymentSessionDto } from './dto/payment-session.dto'; 5 | import { Request, Response } from 'express'; 6 | import { ClientProxy } from '@nestjs/microservices'; 7 | 8 | @Injectable() 9 | export class PaymentsService { 10 | 11 | private readonly stripe = new Stripe(envs.stripeSecret); 12 | private readonly logger = new Logger('PaymentsService'); 13 | 14 | constructor( 15 | @Inject(NATS_SERVICE) private readonly client: ClientProxy 16 | ) {} 17 | 18 | 19 | 20 | async createPaymentSession(paymentSessionDto: PaymentSessionDto) { 21 | const { currency, items, orderId } = paymentSessionDto; 22 | 23 | const lineItems = items.map((item) => { 24 | return { 25 | price_data: { 26 | currency: currency, 27 | product_data: { 28 | name: item.name, 29 | }, 30 | unit_amount: Math.round(item.price * 100), // 20 dólares 2000 / 100 = 20.00 // 15.0000 31 | }, 32 | quantity: item.quantity, 33 | }; 34 | }); 35 | 36 | const session = await this.stripe.checkout.sessions.create({ 37 | // Colocar aquí el ID de mi orden 38 | payment_intent_data: { 39 | metadata: { 40 | orderId: orderId 41 | }, 42 | }, 43 | line_items: lineItems, 44 | mode: 'payment', 45 | success_url: envs.stripeSuccessUrl, 46 | cancel_url: envs.stripeCancelUrl, 47 | }); 48 | 49 | // return session; 50 | return { 51 | cancelUrl: session.cancel_url, 52 | successUrl: session.success_url, 53 | url: session.url, 54 | } 55 | } 56 | 57 | async stripeWebhook(req: Request, res: Response) { 58 | const sig = req.headers['stripe-signature']; 59 | 60 | let event: Stripe.Event; 61 | 62 | // Real 63 | const endpointSecret = envs.stripeEndpointSecret; 64 | 65 | try { 66 | event = this.stripe.webhooks.constructEvent( 67 | req['rawBody'], 68 | sig, 69 | endpointSecret, 70 | ); 71 | } catch (err) { 72 | res.status(400).send(`Webhook Error: ${err.message}`); 73 | return; 74 | } 75 | 76 | switch( event.type ) { 77 | case 'charge.succeeded': 78 | const chargeSucceeded = event.data.object; 79 | const payload = { 80 | stripePaymentId: chargeSucceeded.id, 81 | orderId: chargeSucceeded.metadata.orderId, 82 | receiptUrl: chargeSucceeded.receipt_url, 83 | } 84 | 85 | // this.logger.log({ payload }); 86 | this.client.emit('payment.succeeded', payload ); 87 | break; 88 | 89 | default: 90 | console.log(`Event ${ event.type } not handled`); 91 | } 92 | 93 | return res.status(200).json({ sig }); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | Nest Logo 3 |

4 | 5 | [circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456 6 | [circleci-url]: https://circleci.com/gh/nestjs/nest 7 | 8 |

A progressive Node.js framework for building efficient and scalable server-side applications.

9 |

10 | NPM Version 11 | Package License 12 | NPM Downloads 13 | CircleCI 14 | Coverage 15 | Discord 16 | Backers on Open Collective 17 | Sponsors on Open Collective 18 | 19 | Support us 20 | 21 |

22 | 24 | 25 | ## Description 26 | 27 | [Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. 28 | 29 | ## Installation 30 | 31 | ```bash 32 | $ npm install 33 | ``` 34 | 35 | ## Running the app 36 | 37 | ```bash 38 | # development 39 | $ npm run start 40 | 41 | # watch mode 42 | $ npm run start:dev 43 | 44 | # production mode 45 | $ npm run start:prod 46 | ``` 47 | 48 | ## Test 49 | 50 | ```bash 51 | # unit tests 52 | $ npm run test 53 | 54 | # e2e tests 55 | $ npm run test:e2e 56 | 57 | # test coverage 58 | $ npm run test:cov 59 | ``` 60 | 61 | ## Support 62 | 63 | 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). 64 | 65 | ## Stay in touch 66 | 67 | - Author - [Kamil Myśliwiec](https://kamilmysliwiec.com) 68 | - Website - [https://nestjs.com](https://nestjs.com/) 69 | - Twitter - [@nestframework](https://twitter.com/nestframework) 70 | 71 | ## License 72 | 73 | Nest is [MIT licensed](LICENSE). 74 | --------------------------------------------------------------------------------