- Modified `.env.example` to reflect new API URL structure and added CDN configuration for external storage. - Updated `.gitignore` to include deployment secrets and certificate files, ensuring sensitive information is not committed. - Revised `BACKEND_INTEGRATION.md` to clarify authentication methods, replacing Cognito references with Nostr NIP-98. - Deleted outdated documentation files (`CONTENT-INTEGRATION-COMPLETE.md`, `CURSOR-MCP-SETUP.md`, `FINAL-STATUS.md`, `FIXES-APPLIED.md`, `INDEEHHUB-INTEGRATION.md`, `PROJECT-COMPLETE.md`, `PROJECT-SUMMARY.md`) to streamline project documentation. These changes enhance the clarity of the environment setup and improve the overall documentation structure for better developer onboarding.
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
Zaps (Lightning) – production checklist
For historic zaps to show on film cards and in the movie modal:
-
Migrations – The
zap_statstable is created by migration1762000000000-add-zap-stats. The Dockerfile runs migrations on startup; if you deploy without Docker, runnpm run typeorm:run-migrationsonce. -
BTCPay webhook – In BTCPay Server: Store → Webhooks → Add webhook. Set the URL to
https://your-domain/api/webhooks/btcpay(or/api/webhooks/btcpay-webhook). Subscribe to Invoice settled. Without this, zap payments are not recorded. -
Backend logs – After a zap is paid you should see:
Zap payout completed: <invoiceId> — stats recorded for project <projectId>andZap stats saved: project <id> total N zaps, M sats. If you seeFailed to record zap stats, check that thezap_statstable exists. -
API –
GET /zaps/stats?projectIds=id1,id2must be reachable (e.g.https://your-domain/api/zaps/stats?projectIds=...). It is not cached and does not require auth.
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.
