Skip to content

Nest.js

[Startup MVP recipes #8] Pagination – Nest.js, GraphQL, and TypeORM

For this topic, there are already good examples over the internet and I will just paste some references and give an code pointer directly. References https://docs.nestjs.com/graphql/resolvers#generics https://graphql.org/learn/pagination/#pagination-and-edges https://gist.github.com/tumainimosha/6652deb0aea172f7f2c4b2077c72d16c The Code Usage We have a field called sellerId which is just the user id. A sample… Read More »[Startup MVP recipes #8] Pagination – Nest.js, GraphQL, and TypeORM

[Startup MVP recipes #6] GraphQL Resolver inheritance and a CRUD base resolver with generics

Background For your background information, we have our own defined auth guard named MagentoAuth (that interacts with Magento and issue our own tokens) and we have a sellerId which is just the user id. We self defined @CurrentSellerId() to get the sellerId for GQL from… Read More »[Startup MVP recipes #6] GraphQL Resolver inheritance and a CRUD base resolver with generics

[Startup MVP recipes #5.1] A simple resource generated by nest-cli then configured (part 1)

Preparation Install nest cli (globally) Install class-validator for custom validations. Generate the code Generate a resource, with generated CRUD endpoints (code first GraphQL) Set the name to users Select “GraphQL (code first)” Generate CRUD entry points? → Yes The generated code serves a good bare… Read More »[Startup MVP recipes #5.1] A simple resource generated by nest-cli then configured (part 1)

[Startup MVP Recipes #3] Nest.js Linting (ESLint, Prettier) supports

Credits to https://v.pincman.com/courses/64.html?chapter=1 Install NPM packages for dev This will raise many lint errors on existing files and please make sure to cleanup unused generated files like AppController AppService etc. And also resolve lint errors on existing files (e.g. lint error of default export). New… Read More »[Startup MVP Recipes #3] Nest.js Linting (ESLint, Prettier) supports

[Startup MVP recipes #2]  Nest.js + TypeORM config module and environment variables

Intro We usually have different environments: local, dev, prod etc. (or test, staging..) Each of the environment has its own separate database, and connect to different services with different credentials. Environment variables are used to hide confidential information and to provide a layer of customization… Read More »[Startup MVP recipes #2]  Nest.js + TypeORM config module and environment variables

[Startup MVP recipes #1] Nest.js local dev environment setup

Nest.js https://docs.nestjs.com/first-steps Install Nest.js CLI Init and run project Postgres Install Postgres on Mac (you can search for other ways of installing Postgres on different environments) (Optional) Download pgAdmin We can use pgAdmin to connect to local postgres and create new roles or databases locally.… Read More »[Startup MVP recipes #1] Nest.js local dev environment setup