Skip to content

MVP recipes

[Startup MVP recipes #16] Nest.js Get Started with Elasticsearch – ELK Dev instance deployment and integration in Nest.js

Quick Intro This deployment is just for a get-started single node deployment of ELK stack. Target: AWS EC2 t3.medium for dev instance Docker Compose ELK is based on https://github.com/deviantony/docker-elk/tree/tls Setup EC2 Setup EC2 using AWS console t3.medium is good for dev instance Configure Security Group… Read More »[Startup MVP recipes #16] Nest.js Get Started with Elasticsearch – ELK Dev instance deployment and integration in Nest.js

[Startup MVP recipes #15] Nest.js Get Started with Elasticsearch – local environment pointers

Docker Compose Tips: Don’t need dedicated network for elk. Just set it up so that nestjs service can connect to the hostname of elasticsearch TS Elasticsearch Client Options: (we disabled TLS, auth in local environment) Search Module Tips: Initialize es client using custom provider. I… Read More »[Startup MVP recipes #15] Nest.js Get Started with Elasticsearch – local environment pointers

[Startup MVP recipes #14] JWT Authentication with Nest.js + Passport + MikroOrm

Official doc(https://docs.nestjs.com/security/authentication#authentication) is also recommended but this tutorial is easier to read and contains much clear essentials Background Although recently our team migrated to MikroOrm, indeed MikroOrm is very similar to TypeOrm and you can easily replace the code pointers here with your own TypeOrm… Read More »[Startup MVP recipes #14] JWT Authentication with Nest.js + Passport + MikroOrm

[Startup MVP recipes #13] Quick glance: Inheritance of TypeOrm’s Entity and GraphQL’s Object

This is a quick tutorial and code pointer sharing of how to create a reusable base entity that contains common columns. There are more advanced topics on this e.g. https://jczhang.com/2022/07/29/startup-mvp-recipes-6-graphql-resolver-inheritance-and-a-crud-base-resolver-with-generics/ , etc. The Base Entity The abstract modifier is used to mark it as an… Read More »[Startup MVP recipes #13] Quick glance: Inheritance of TypeOrm’s Entity and GraphQL’s Object

[Startup MVP recipes #11] Nest.js Run Unit Tests with Github Actions

If interested, please also check previous two articles on setting up the tests: https://jczhang.com/2022/08/08/startup-mvp-recipes-9-nest-js-typeorm-postgres-unit-testing-service-onlywith-jest-pg-mem/ https://jczhang.com/2022/08/09/startup-mvp-recipes-10-nest-js-unit-testing-mocking-service-and-the-universal-mock/ References https://medium.com/swlh/jest-and-github-actions-eaf3eaf2427d https://github.com/marketplace/actions/run-jest https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs Config On PR open, we will trigger this github action workflow on the cloud and let it run the checks remotely. Demo

[Startup MVP recipes #10] Nest.js Unit Testing: Mocking service and the universal mock

Intro and TL; DR In last article: https://jczhang.com/2022/08/08/startup-mvp-recipes-9-nest-js-typeorm-postgres-unit-testing-service-onlywith-jest-pg-mem/, we had a first glance at how to setup unit test with jest, and inject an in-memory postgres for testing the services. Now we move back to write unit tests for resolvers, and the idea and philosophy… Read More »[Startup MVP recipes #10] Nest.js Unit Testing: Mocking service and the universal mock

[Startup MVP recipes #9] Nest.js TypeORM Postgres Unit Testing (service only)with Jest, pg-mem

In this tutorial we will cover basic strategy of unit testing a service in Nest.js + TypeORM setup. We don’t create an environment for test purpose, but instead, we use pg-mem adapter to run a local in-memory Postgres simulator instance. In this way the db… Read More »[Startup MVP recipes #9] Nest.js TypeORM Postgres Unit Testing (service only)with Jest, pg-mem

[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