Skip to content

A self-hosted UPI & COD payment gateway with zero per-transaction platform fees, universal JavaScript checkout integration, dynamic QR payments, WhatsApp OTP authentication, and automated payment verification.

JavaScript

ci(pipeline): add DevSecOps CI workflow, multi-arch Docker publish, and Dependabot

ArunGupta1526a27062b30eb8
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..791e73e
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,61 @@
+# ==============================================================================
+# YOUPI PG V2 - Automated Dependency & Security Updates via GitHub Dependabot
+# Keeps npm packages and GitHub Actions versions secure with grouped PRs
+# ==============================================================================
+version: 2
+updates:
+ # 1. Automated npm dependencies security updates (package.json / package-lock.json)
+ - package-ecosystem: "npm"
+ directory: "/"
+ schedule:
+ interval: "weekly"
+ day: "monday"
+ time: "09:00"
+ timezone: "Asia/Kolkata"
+ open-pull-requests-limit: 5
+ groups:
+ # Development tooling, linters, and type definitions
+ development-tooling:
+ dependency-type: "development"
+ patterns:
+ - "typescript*"
+ - "@types/*"
+
+ # Production dependencies: only safe minor and patch updates
+ production-dependencies:
+ dependency-type: "production"
+ patterns:
+ - "*"
+ update-types:
+ - "minor"
+ - "patch"
+
+ # Ignore breaking major upgrades that exceed active Node 22/24 LTS baseline
+ ignore:
+ - dependency-name: "@types/node"
+ update-types:
+ - "version-update:semver-major"
+
+ labels:
+ - "dependencies"
+ - "security"
+ commit-message:
+ prefix: "chore(deps)"
+
+ # 2. Automated GitHub Actions versions updates (.github/workflows)
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: "monthly"
+ time: "09:00"
+ timezone: "Asia/Kolkata"
+ open-pull-requests-limit: 3
+ groups:
+ github-actions:
+ patterns:
+ - "*"
+ labels:
+ - "ci"
+ - "github-actions"
+ commit-message:
+ prefix: "chore(ci)"
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..d80e6f1
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,155 @@
+name: CI & Security Scan
+
+on:
+ push:
+ branches: [main]
+ paths-ignore:
+ - '**.md'
+ - 'docs/**'
+ - '.gitignore'
+ - 'LICENSE'
+ - '.vscode/**'
+ pull_request:
+ branches: [main]
+ paths-ignore:
+ - '**.md'
+ - 'docs/**'
+ - '.gitignore'
+ - 'LICENSE'
+ - '.vscode/**'
+ workflow_dispatch:
+
+permissions:
+ contents: read
+ pull-requests: write
+ actions: read
+
+# Cancel in-progress runs for PRs to save runner minutes, but queue safely on main branch
+concurrency:
+ group: ci-${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
+
+jobs:
+ # =============================================================
+ # Stage 1 (Head of Snake): Secret Leak Detection
+ # Halts immediately if any API keys, tokens, or credentials leak
+ # =============================================================
+ gitleaks:
+ name: 🐍 1. Gitleaks Secret Scan
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v7
+ with:
+ fetch-depth: 0
+
+ - name: Run Gitleaks Security Scan
+ uses: gitleaks/gitleaks-action@v3
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ # =============================================================
+ # Stage 2: Dependency Security Audit
+ # Runs ONLY after Stage 1 (Gitleaks) passes successfully
+ # =============================================================
+ security-audit:
+ name: 🐍 2. Dependency Audit
+ needs: [gitleaks]
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v7
+
+ - name: Setup Node.js 24 LTS
+ uses: actions/setup-node@v7
+ with:
+ node-version: '24'
+ cache: 'npm'
+
+ - name: Install Dependencies
+ run: npm ci
+
+ - name: Security Audit (npm audit)
+ run: npm audit --audit-level=high
+
+ # =============================================================
+ # Stage 3: TypeScript Compilation & Production Build Check
+ # Runs ONLY after Stage 2 (Dependency Audit) passes successfully
+ # =============================================================
+ build:
+ name: 🐍 3. TypeScript Typecheck & Build
+ needs: [security-audit]
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v7
+
+ - name: Setup Node.js 24 LTS
+ uses: actions/setup-node@v7
+ with:
+ node-version: '24'
+ cache: 'npm'
+
+ - name: Install Dependencies
+ run: npm ci
+
+ - name: Run TypeScript Typecheck
+ run: npm run typecheck
+
+ - name: Run Build
+ run: npm run build
+
+ # =============================================================
+ # Stage 4 (Tail of Snake): Unit & Regression Test Verification
+ # Runs ONLY after Stage 3 (Build) passes successfully
+ # =============================================================
+ test:
+ name: 🐍 4. Regression Tests
+ needs: [build]
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v7
+
+ - name: Setup Node.js 24 LTS
+ uses: actions/setup-node@v7
+ with:
+ node-version: '24'
+ cache: 'npm'
+
+ - name: Install Dependencies
+ run: npm ci
+
+ - name: Run Full Regression Test Suite
+ run: npm test
+ env:
+ NODE_ENV: test
+ YOUPI_MODE: localhost
+
+ # =============================================================
+ # Stage 5: Update ReviewGround Sticky Comment with CI Status
+ # Runs after all stages, finds the existing review comment and edits (PATCH) it
+ # =============================================================
+ ci-summary:
+ name: 📊 5. Update ReviewGround CI Summary
+ needs: [gitleaks, security-audit, build, test]
+ if: always() && github.event_name == 'pull_request'
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v7
+
+ - name: Update Sticky PR Comment with CI Results
+ uses: arungupta1526/reviewground@v1
+ with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ mode: 'summary'
+ gitleaks-result: ${{ needs.gitleaks.result }}
+ audit-result: ${{ needs.security-audit.result }}
+ build-result: ${{ needs.build.result }}
+ test-result: ${{ needs.test.result }}
diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml
new file mode 100644
index 0000000..96b7749
--- /dev/null
+++ b/.github/workflows/docker-build-push.yml
@@ -0,0 +1,166 @@
+name: 🐳 Docker DevSecOps Build, Scan & Push
+
+on:
+ # Chained Execution: Triggers automatically when the CI pipeline finishes on main
+ workflow_run:
+ workflows: ["CI & Security Scan"]
+ types:
+ - completed
+ branches:
+ - main
+ # Manual trigger support from GitHub Actions UI tab
+ workflow_dispatch:
+
+permissions:
+ contents: read
+ packages: write
+ security-events: write
+
+# Prevent duplicate parallel container builds; queue sequentially on main to avoid race conditions
+concurrency:
+ group: docker-build-${{ github.ref }}
+ cancel-in-progress: false
+
+jobs:
+ docker-delivery:
+ name: 🐳 Docker DevSecOps & Registry Push
+ # Only run if CI passed completely, or if manually triggered by developer
+ if: "${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}"
+ runs-on: ubuntu-latest
+ env:
+ DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
+ DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
+
+ steps:
+ - name: Checkout Code
+ uses: actions/checkout@v7
+ with:
+ fetch-depth: 2
+
+ # -------------------------------------------------------------
+ # 0. Check for Production Container / Application Changes
+ # Skips expensive Docker build/scan/push if only tests, docs,
+ # workflows, or repository meta files were changed.
+ # -------------------------------------------------------------
+ - name: Check for Production Container Changes
+ id: filter
+ run: |
+ if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
+ echo "Manual trigger via workflow_dispatch - proceeding with build."
+ echo "should_build=true" >> "$GITHUB_OUTPUT"
+ exit 0
+ fi
+
+ if ! git rev-parse HEAD^1 >/dev/null 2>&1; then
+ echo "Single commit / initial ref detected - defaulting to build."
+ echo "should_build=true" >> "$GITHUB_OUTPUT"
+ exit 0
+ fi
+
+ CHANGED_FILES=$(git diff --name-only HEAD^1 HEAD -- . \
+ ':!.github/**' \
+ ':!docs/**' \
+ ':!*.md' \
+ ':!.vscode/**' \
+ ':!.gitignore' \
+ ':!LICENSE' \
+ ':!.agents/**' \
+ ':!.gemini/**' \
+ ':!scratch/**' || true)
+
+ if [ -n "$CHANGED_FILES" ]; then
+ echo "✅ Production application changes detected:"
+ echo "$CHANGED_FILES"
+ echo "should_build=true" >> "$GITHUB_OUTPUT"
+ else
+ echo "⏭️ No production application changes detected (only tests/docs/workflows/meta files modified)."
+ echo "Skipping Docker build and registry push."
+ echo "should_build=false" >> "$GITHUB_OUTPUT"
+ fi
+
+ - name: Set up QEMU (Multi-platform emulation)
+ if: steps.filter.outputs.should_build == 'true'
+ uses: docker/setup-qemu-action@v4
+
+ - name: Set up Docker Buildx
+ if: steps.filter.outputs.should_build == 'true'
+ uses: docker/setup-buildx-action@v4
+
+ # -------------------------------------------------------------
+ # 1. Build Local Image for Security Scan
+ # -------------------------------------------------------------
+ - name: Build Local Image for Security Scan
+ if: steps.filter.outputs.should_build == 'true'
+ uses: docker/build-push-action@v7
+ with:
+ context: .
+ file: ./Dockerfile
+ load: true
+ tags: youpi-pg:scan-target
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
+
+ # -------------------------------------------------------------
+ # 2. Automated Aqua Security Trivy Container Scan
+ # -------------------------------------------------------------
+ - name: Run Aqua Security Trivy Scanner
+ if: steps.filter.outputs.should_build == 'true'
+ uses: aquasecurity/[email protected]
+ with:
+ image-ref: 'youpi-pg:scan-target'
+ format: 'table'
+ exit-code: '1'
+ ignore-unfixed: true
+ severity: 'HIGH,CRITICAL'
+
+ # -------------------------------------------------------------
+ # 3. Log in to Docker Hub (if secrets configured via env)
+ # -------------------------------------------------------------
+ - name: Log in to Docker Hub
+ if: steps.filter.outputs.should_build == 'true' && env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != ''
+ uses: docker/login-action@v4
+ with:
+ username: ${{ env.DOCKERHUB_USERNAME }}
+ password: ${{ env.DOCKERHUB_TOKEN }}
+
+ # -------------------------------------------------------------
+ # 4. Log in to GitHub Container Registry (GHCR)
+ # -------------------------------------------------------------
+ - name: Log in to GitHub Container Registry (GHCR)
+ if: steps.filter.outputs.should_build == 'true'
+ uses: docker/login-action@v4
+ with:
+ registry: ghcr.io
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+ # -------------------------------------------------------------
+ # 5. Generate Registry Tags
+ # -------------------------------------------------------------
+ - name: Extract Docker Metadata
+ if: steps.filter.outputs.should_build == 'true'
+ id: meta
+ uses: docker/metadata-action@v6
+ with:
+ images: |
+ ${{ env.DOCKERHUB_USERNAME != '' && format('{0}/youpi-pg', env.DOCKERHUB_USERNAME) || '' }}
+ ghcr.io/${{ github.repository }}
+ tags: |
+ type=raw,value=latest
+ type=sha,format=short,prefix=sha-
+ type=semver,pattern={{version}}
+
+ # -------------------------------------------------------------
+ # 6. Push Verified Multi-Platform Image to Registries
+ # -------------------------------------------------------------
+ - name: Push Image to Registries
+ if: steps.filter.outputs.should_build == 'true'
+ uses: docker/build-push-action@v7
+ with:
+ context: .
+ file: ./Dockerfile
+ platforms: linux/amd64,linux/arm64
+ push: true
+ tags: ${{ steps.meta.outputs.tags }}
+ labels: ${{ steps.meta.outputs.labels }}
+ cache-from: type=gha
diff --git a/.github/workflows/reviewground.yml b/.github/workflows/reviewground.yml
new file mode 100644
index 0000000..5018b47
--- /dev/null
+++ b/.github/workflows/reviewground.yml
@@ -0,0 +1,56 @@
+name: 🛡️ ReviewGround AI Code Review & CI Verification
+
+on:
+ pull_request:
+ types: [opened, synchronize, reopened]
+ paths-ignore:
+ - '**.md'
+ - 'docs/**'
+ - '.gitignore'
+ - 'LICENSE'
+ - '.vscode/**'
+ issue_comment:
+ types: [created]
+ workflow_dispatch:
+
+permissions:
+ contents: read
+ pull-requests: write
+ actions: read
+ checks: write
+
+concurrency:
+ group: reviewground-${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ review:
+ name: 🛡️ ReviewGround Code Review & Verification
+ runs-on: ubuntu-latest
+ if: |
+ github.event_name == 'pull_request' ||
+ github.event_name == 'workflow_dispatch' ||
+ (github.event_name == 'issue_comment' && github.event.issue.pull_request &&
+ (contains(github.event.comment.body, '@reviewground') || contains(github.event.comment.body, '/review') || contains(github.event.comment.body, '@review')))
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v7
+ with:
+ fetch-depth: 0
+
+ - name: Run ReviewGround AI Review
+ uses: arungupta1526/reviewground@v1
+ with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ enable-pr-description-update: 'true'
+ enable-check-run: 'true'
+ env:
+ GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
+ GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }}
+ OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
+ OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
+ DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
+ PROVIDER: ${{ vars.PROVIDER || '' }}
+ MODEL: ${{ vars.MODEL || '' }}
diff --git a/package-lock.json b/package-lock.json
index 2e969f4..629d8b1 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -13,11 +13,11 @@
"apps/*"
],
"devDependencies": {
- "@types/node": "^22.13.0",
+ "@types/node": "^24.0.0",
"typescript": "^5.7.3"
},
"engines": {
- "node": ">=20.0.0"
+ "node": ">=24.0.0"
}
},
"apps/android-observer-app": {
@@ -29,7 +29,8 @@
"apps/checkout-portal": {
"version": "1.0.0",
"dependencies": {
- "@youpi/common": "*"
+ "@youpi/common": "*",
+ "@youpi/core": "*"
}
},
"apps/coin-wallet-store": {
@@ -408,12 +409,12 @@
"license": "MIT"
},
"node_modules/@types/node": {
- "version": "22.20.5",
- "resolved": "https://registry.npmjs.org/@types/node/-/node-22.20.5.tgz",
- "integrity": "sha512-U2+DNr+wSjpsTS/wZGYHq7GcwfuSmKiKvoPvK22zwTlRhU91yOniN4qRR5KhIjvif7ysw/dz/hKmfDH0Ris4aA==",
+ "version": "24.19.2",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-24.19.2.tgz",
+ "integrity": "sha512-93d49wCWJkCyN87MxLpNN6KXPCwFw7bVUg79mGUV1OS40JGWwVCr8n61DXCSqz7CV6/VfPkb7xec7uP2M+QHWQ==",
"license": "MIT",
"dependencies": {
- "undici-types": "~6.21.0"
+ "undici-types": ">=7.24.0 <7.24.7"
}
},
"node_modules/@wppconnect/wa-proto": {
@@ -1639,9 +1640,9 @@
}
},
"node_modules/undici-types": {
- "version": "6.21.0",
- "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
- "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
+ "version": "7.24.6",
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz",
+ "integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==",
"license": "MIT"
},
"node_modules/util-deprecate": {
diff --git a/package.json b/package.json
index 7c6b693..c1d5342 100644
--- a/package.json
+++ b/package.json
@@ -23,11 +23,11 @@
"typecheck": "tsc -b --noEmit"
},
"devDependencies": {
- "@types/node": "^22.13.0",
+ "@types/node": "^24.0.0",
"typescript": "^5.7.3"
},
"engines": {
- "node": ">=20.0.0"
+ "node": ">=24.0.0"
},
"author": "Antigravity Systems",
"license": "Commercial"