TypeORM's manager.save/delete with string table names still uses entity metadata internally (triggers SELECT with all entity columns). Converted SeedSubgenres, RemoveLastGenres, and SeedEpisodicSubgenres to use queryRunner.query() with raw SQL to avoid column mismatches. Co-authored-by: Cursor <cursoragent@cursor.com>
What is indeehub-api?
indeehub-api is the IndeeHub API Backend repository.
What stories will you tell?
Table of Contents
- Quickstart Guides
- Overview
- Running the API
- Recommended VSCode Extensions
- Running DB Migrations
- Running Stripe Webhooks locally
- SonarQube
Quickstart Guides
MacOS Quickstart
Install NVM
brew update
brew install nvm
mkdir ~/.nvm
echo "export NVM_DIR=~/.nvm\nsource \$(brew --prefix nvm)/nvm.sh" >> .zshrc
source ~/.zshrc
Install dependencies
nvm install # this will install the node version set in .nvmrc (lts/hydrogen)
npm i
cp .env.example .env # Add the environment variables
Linux (Unix) Quickstart
Install NVM
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
Install dependencies
nvm install # this will install the node version set in .nvmrc (lts/hydrogen)
npm i
cp .env.example .env # And add the environment variables
Windows Quickstart
To avoid EOL and other Windows-related issues, we recommend installing WSL 2 and running the repository on a Linux distro of your choice.
Follow this guide to install WSL: https://learn.microsoft.com/en-us/windows/wsl/install
Overview
-
TypeScript: A typed superset of JavaScript designed with large-scale applications in mind.
-
ESLint: Static code analysis to help find problems within a codebase.
-
Prettier: An opinionated code formatted.
-
Nest.js: A progressive Node.js framework for building efficient, reliable, and scalable server-side applications.
-
Swagger: A tool that helps design, build, document, and consume RESTful Web services.
-
TypeORM: An ORM that can run in NodeJS and can be used with TypeScript.
-
Cypress: End-to-end testing framework for web applications.
-
Commitizen: Conventional commit messages CLI.
Requirements
-
NodeJS 18+
-
npm (or equivalent)
Notes:
- We recommend the use of Commitizen to use conventional commit messages and linting before commits.
Devtool dependencies
- Cypress: End-to-end testing framework for web applications.
Installed Packages
-
@aws-sdk/client-s3
-
@nestjs/common
-
@nestjs/config
-
@nestjs/core
-
@nestjs/passport
-
@nestjs/platform-express
-
@nestjs/schedule
-
@nestjs/swagger
-
@nestjs/typeorm
-
@sendgrid/mail
-
@smithy/hash-node
-
@smithy/protocol-http
-
@zbd/node
-
amazon-cognito-identity-js
-
aws-jwt-verify
-
axios
-
class-transformer
-
class-validator
-
jwks-rsa
-
moment
-
passport
-
passport-jwt
-
pg
-
reflect-metadata
-
rxjs
-
stripe
-
typeorm
-
typeorm-naming-strategies
DevDependencies
-
@nestjs/cli
-
@nestjs/schematics
-
@nestjs/testing
-
@types/express
-
@types/jest
-
@types/node
-
@types/supertest
-
@typescript-eslint/eslint-plugin
-
@typescript-eslint/parser
-
eslint
-
eslint-config-prettier
-
eslint-plugin-prettier
-
jest
-
prettier
-
source-map-support
-
supertest
-
ts-jest
-
ts-loader
-
ts-node
-
tsconfig-paths
-
typescript
Running the API
npm run start:dev
# Or if you want to use the debug tool
npm run start:debug
Running DB Migrations
npm run build
npm run typeorm:generate-migration --name=add-your-migration-name # will generate it based on the differences between the entities and the DB Schema
npm run typeorm:create-migration --name=add-your-migration-name # will create a blank migration
npm run build # after you finish the migrations
npm run typeorm:run-migrations # will apply the migrations to the current DB
Running Stripe Webhooks locally
Installing Stripe CLI
MacOS
brew install stripe/stripe-cli/stripe
Windows
scoop bucket add stripe https://github.com/stripe/scoop-stripe-cli.git
scoop install stripe
Linux
curl -s https://packages.stripe.dev/api/security/keypair/stripe-cli-gpg/public | gpg --dearmor | sudo tee /usr/share/keyrings/stripe.gpg
echo "deb [signed-by=/usr/share/keyrings/stripe.gpg] https://packages.stripe.dev/stripe-cli-debian-local stable main" | sudo tee -a /etc/apt/sources.list.d/stripe.list
sudo apt update
sudo apt install stripe
Log in to CLI
stripe login
Your pairing code is: enjoy-enough-outwit-win
This pairing code verifies your authentication with Stripe.
Press Enter to open the browser or visit https://dashboard.stripe.com/stripecli/confirm_auth?t=THQdJfL3x12udFkNorJL8OF1iFlN8Az1
Start webhook listener
stripe listen --forward-to localhost:4242/webhook
It will output your endpoint secret, and add it to the .env file.
