Implement backend API and database services in Docker setup

- Added a new `api` service for the NestJS backend, including health checks and dependencies on PostgreSQL, Redis, and MinIO.
- Introduced PostgreSQL and Redis services with health checks and configurations for data persistence.
- Added MinIO for S3-compatible object storage and a one-shot service to initialize required buckets.
- Updated the Nginx configuration to proxy requests to the new backend API and MinIO storage.
- Enhanced the Dockerfile to support the new API environment variables and configurations.
- Updated the `package.json` and `package-lock.json` to include new dependencies for QR code generation and other utilities.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Dorian
2026-02-12 20:14:39 +00:00
parent f19fd6feef
commit cdd24a5def
478 changed files with 55355 additions and 529 deletions

273
backend/README.md Normal file
View File

@@ -0,0 +1,273 @@
![](/.swm/images/IH-banner.png)
# What is indeehub-api?
`indeehub-api` is the IndeeHub API Backend repository.\
What stories will you tell?&nbsp;
# Table of Contents
- [Quickstart Guides](#quickstart-guides)
- [MacOS Quickstart](#macos-quickstart)
- [Linux (Unix) Quickstart](#linux-unix-quickstart)
- [Windows Quickstart](#windows-quickstart)
- [Overview](#overview)
- [Requirements](#requirements)
- [Devtool dependencies](#devtool-dependencies)
- [Installed packages](#installed-packages)
- [Running the API](#running-the-api)
- [Recommended VSCode Extensions](#recommended-vscode-extensions)
- [Running DB Migrations](#running-db-migrations)
- [Running Stripe Webhooks locally](#running-stripe-webhooks-locally)
- [SonarQube](#sonarqube)
# Quickstart Guides
## MacOS Quickstart
### Install NVM
```zsh
brew update
brew install nvm
mkdir ~/.nvm
echo "export NVM_DIR=~/.nvm\nsource \$(brew --prefix nvm)/nvm.sh" >> .zshrc
source ~/.zshrc
```
### Install dependencies
```zsh
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
```bash
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
```bash
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](https://github.com/IndeeHub/indeehub-frontend/tree/main#macos-quickstart)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
## 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
&nbsp;
# **Running the API**
```bash
npm run start:dev
# Or if you want to use the debug tool
npm run start:debug
```
# Running DB Migrations
```bash
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
```
&nbsp;
# Running Stripe Webhooks locally
## Installing Stripe CLI
### MacOS
```zsh
brew install stripe/stripe-cli/stripe
```
### Windows
```bash
scoop bucket add stripe https://github.com/stripe/scoop-stripe-cli.git
scoop install stripe
```
### Linux
```bash
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
```bash
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.
# SonarQube
[![Quality gate](https://sonarqube.indeehub.studio/api/project_badges/quality_gate?project=IndeeHub_indeehub-api_53ec3bbb-4a99-40e6-9de4-ae1acf6b125d&token=sqb_b1e2bd689935a9954f40e4b584689c226f741f3e)](https://sonarqube.indeehub.studio/dashboard?id=IndeeHub_indeehub-api_53ec3bbb-4a99-40e6-9de4-ae1acf6b125d)