尚未检测到更新。GitHub 发布版本后会显示在这里。
个人 GitHub 账号下公开仓库的所有者可以登录并验证所有权,自行管理介绍,无需管理员批准。
登录并生成验证文件,在 30 分钟内将其提交到此仓库的默认分支。其他分支或分叉仓库中的文件无效。然后在下方检查文件,即可无需管理员批准直接管理项目。请保留文件以维持管理权限。
如需登录,将前往登录页面。登录后请回到此处,再次点击所选的验证按钮。
在项目文件夹中运行 /nomorevibe verify,即可验证所有权并自行管理介绍。
一分钟完成验证正在加载完整 README。 以下为已保存的摘录。
TEC Ecosystem - 24 App Digital Platform
TEC (The Ecosystem Core) is a comprehensive digital platform built on the Pi Network ecosystem, offering 24 integrated applications for finance, commerce, real estate, and more.
TEC Platform follows a microservices architecture with the following components:
• Docker & Docker Compose (recommended)
• Node.js 18+ (for local development)
• PostgreSQL 15+ (for local development)查看完整 README ↗
TEC (The Ecosystem Core) is a comprehensive digital platform built on the Pi Network ecosystem, offering 24 integrated applications for finance, commerce, real estate, and more.
TEC Platform follows a microservices architecture with the following components:
┌─────────────────────────────────────────────────────────────┐
│ Client Applications │
│ (Next.js 14 App Router Frontend) │
└────────────────────┬────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ API Gateway (Port 3000) │
│ Rate Limiting • Logging • Request Routing │
└────────────┬───────────────┬───────────────┬────────────────┘
│ │ │
┌────────▼────┐ ┌──────▼──────┐ ┌────▼─────────┐
│ Auth Service│ │ Wallet │ │ Payment │
│ (Port 5001)│ │ Service │ │ Service │
│ │ │ (Port 5002) │ │ (Port 5003) │
└──────┬──────┘ └──────┬──────┘ └──────┬───────┘
│ │ │
└────────────────┼────────────────┘
▼
┌───────────────────────┐
│ PostgreSQL Database │
│ (Port 5432) │
└───────────────────────┘
git clone https://github.com/Yasser1728/Tec-App.git
cd Tec-App
# Required secrets
export POSTGRES_PASSWORD="your_secure_password"
export JWT_SECRET="your_jwt_secret_key_min_32_chars"
export JWT_REFRESH_SECRET="your_refresh_secret_key_min_32_chars"
# Pi Network integration (required for payment processing)
export PI_API_KEY="your_pi_network_api_key" # from https://developers.minepi.com
export PI_APP_ID="tec-app-de161fa2243c797b" # from https://developers.minepi.com
# Environment (sandbox = Pi Sandbox, production = mainnet)
export PI_SANDBOX="true" # 'false' for Mainnet/Production
export NEXT_PUBLIC_PI_SANDBOX="true" # frontend counterpart
# Optional
export NODE_ENV="production"
export CORS_ORIGIN="http://localhost:3000"
⚠️ Important for Payment Service:
DATABASE_URL: Required for payment processing. Automatically set by docker-compose fromPOSTGRES_PASSWORD.CORS_ORIGIN: Must match your frontend URL. Usehttp://localhost:3000for local development and your production URL (e.g.,https://tec-app.vercel.app) in production.PI_API_KEYandPI_APP_ID: Required for Pi Network payment integration. Obtain both from Pi Developer Portal.PI_SANDBOX/NEXT_PUBLIC_PI_SANDBOX: Set to'true'for Sandbox and'false'for Mainnet (production).If the payment service fails to start or returns database errors, verify these environment variables are correctly set.
docker-compose up -d
tec-frontend/)| Item | Value |
|---|---|
| Pi App ID | tec-app-de161fa2243c797b |
| Pi Sandbox App URL | https://sandbox.minepi.com/app/tec-app-de161fa2243c797b |
Allowed domains (configure in Pi Developer Portal):
https://tec-app.vercel.apphttps://sandbox.minepi.com/app/tec-app-de161fa2243c797bhttps://api-gateway-production-6a68.up.railway.appFrontend environment variables (tec-frontend/.env.local):
NEXT_PUBLIC_PI_APP_ID=tec-app-de161fa2243c797b
NEXT_PUBLIC_PI_APP_URL=https://sandbox.minepi.com/app/tec-app-de161fa2243c797b
NEXT_PUBLIC_PI_SANDBOX=true
NEXT_PUBLIC_API_GATEWAY_URL=https://api-gateway-production-6a68.up.railway.app
# NEXT_PUBLIC_PI_SDK_TIMEOUT=35000 # increase for slow networks
Backend environment variables (.env):
PI_APP_ID=tec-app-de161fa2243c797b
PI_SANDBOX=true
PI_API_KEY= # obtain from https://developers.minepi.com
PI_TEST_WALLET= # your test wallet address
A dedicated test page is available at /pi-test to verify the full auth + payment flow end-to-end without touching production data.
/pi-test (e.g. https://tec-app.vercel.app/pi-test).[AUTH] events.onReadyForServerApproval → POST /api/payments/approveonReadyForServerCompletion → POST /api/payments/completeonCancel / onError → logged with details| Variable | Purpose |
|---|---|
NEXT_PUBLIC_PI_APP_ID | Passed to Pi.init({ appId }) |
NEXT_PUBLIC_PI_APP_URL | Sandbox deep-link URL (informational) |
NEXT_PUBLIC_PI_SANDBOX | true → sandbox mode, false → mainnet |
NEXT_PUBLIC_API_GATEWAY_URL | Backend gateway for approve/complete callbacks |
NEXT_PUBLIC_PI_SDK_TIMEOUT | (optional) SDK load timeout in ms (default 25 000) |
Register the following in the Pi Developer Portal under your app's Allowed Domains:
https://tec-app.vercel.apphttp://localhost:3001 (local dev)/api/auth/*)| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/register | Register new user |
| POST | /api/auth/login | Login user |
| POST | /api/auth/logout | Logout user |
| POST | /api/auth/refresh | Refresh access token |
| GET | /api/auth/me | Get current user |
/api/wallets/*)| Method | Endpoint | Description |
|---|---|---|
| GET | /api/wallets?userId={id} | Get user wallets |
| POST | /api/wallets/link | Link new wallet |
| GET | /api/wallets/{id}/balance | Get wallet balance |
| GET | /api/wallets/{id}/transactions | Get transactions (paginated) |
/api/payments/*)| Method | Endpoint | Description |
|---|---|---|
| POST | /api/payments/create | Create payment |
| POST | /api/payments/approve | Approve payment |
| POST | /api/payments/complete | Complete payment |
| POST | /api/payments/cancel | Cancel payment |
| POST | /api/payments/fail | Record payment failure |
| GET | /api/payments/{id}/status | Get payment status |
The payment service implements a five-state payment lifecycle:
Create (POST /api/payments/create): Initiates a payment with user ID, amount, and payment method.
userId (UUID), amount (> 0), payment_method (pi/card/wallet)currency (default: PI), metadata (JSON object)Approve (POST /api/payments/approve): Approves a created payment, typically after user confirmation.
payment_id (UUID)pi_payment_id (for Pi Network payments)Complete (POST /api/payments/complete): Finalizes an approved payment with transaction details.
payment_id (UUID)transaction_id (blockchain transaction ID)Cancel (POST /api/payments/cancel): Cancels a payment that is in created or approved state.
payment_id (UUID)cancelled_at timestamp in the database.Fail (POST /api/payments/fail): Records a payment failure for a created or approved payment.
payment_id (UUID)reason (failure description, stored in metadata)failed_at timestamp in the database.The payment service returns specific error codes for better debugging:
VALIDATION_ERROR: Invalid input data (check field details)NOT_FOUND: Payment not foundINVALID_STATUS: Payment cannot transition from current statusINVALID_USER: User ID does not existDATABASE_UNAVAILABLE: Database connection failed (check DATABASE_URL)DUPLICATE_PAYMENT: Payment already existsDUPLICATE_PI_PAYMENT: Pi payment ID already in usePAYMENT_MODIFIED: Payment was modified or deleted concurrentlyTec-App/
├── tec-frontend/ # Next.js 14 frontend
│ ├── app/ # App Router pages
│ ├── components/ # React components
│ ├── lib/ # Utilities (i18n, Pi SDK)
│ └── types/ # TypeScript types
├── tec-api-gateway/ # API Gateway service
│ ├── src/
│ │ ├── routes/ # Proxy routes
│ │ └── middleware/ # Rate limiting, logging
│ └── Dockerfile
├── tec-auth-service/ # Authentication service
│ ├── src/
│ │ ├── controllers/ # Request handlers
│ │ ├── routes/ # API routes
│ │ ├── middleware/ # Auth middleware
│ │ ├── utils/ # JWT, hashing
│ │ └── config/ # Database config
│ └── Dockerfile
├── tec-wallet-service/ # Wallet management service
│ ├── src/
│ │ ├── controllers/ # Wallet operations
│ │ └── routes/ # Wallet routes
│ └── Dockerfile
├── tec-payment-service/ # Payment processing service
│ ├── src/
│ │ ├── controllers/ # Payment workflow
│ │ └── routes/ # Payment routes
│ └── Dockerfile
├── prisma/ # Database schema & migrations
│ └── schema.prisma
├── shared/ # Shared TypeScript types
│ └── types/
├── docker-compose.yml # Service orchestration
└── README.md
The frontend includes a built-in health check system that monitors backend availability and surfaces issues to users immediately.
tec-frontend/src/lib/health-check.ts — Core utility that calls GET ${NEXT_PUBLIC_API_GATEWAY_URL}/health with a 5-second timeout and returns a HealthStatus object (online, status, services, error).
tec-frontend/src/hooks/useBackendHealth.ts — React hook (useBackendHealth(intervalMs?)) that components use to subscribe to backend health state. Optionally polls on a configurable interval.
tec-frontend/src/components/BackendOfflineBanner.tsx — Client component rendered in the root layout that displays a red warning banner when the backend is unreachable. Polls every 30 seconds and provides a Retry button to recheck immediately.
⚠️ Backend Offline banner appears at the top of every page.https://api-gateway-production-6a68.up.railway.app/healthGET{ "status": "ok" | "degraded", "services": { ... } }# Install dependencies for each service
cd tec-api-gateway && npm install
cd tec-auth-service && npm install
cd tec-wallet-service && npm install
cd tec-payment-service && npm install
# Generate Prisma Client
npx prisma generate
# Run database migrations
npx prisma migrate dev
# Start services in dev mode
npm run dev
The frontend uses Vitest + React Testing Library for unit/component tests.
cd tec-frontend
# Install dependencies
npm ci
# Run tests (headless, single pass)
npm test
# Run tests in watch mode (re-runs on file changes)
npm run test:watch
# Also available: lint, typecheck, format
npm run lint
npm run typecheck
npm run format
Test files live in tec-frontend/src/__tests__/:
homepage.test.tsx — smoke test for the HomePage componentusePiAuth.test.ts — unit tests for the usePiAuth hook (Pi SDK mocked)usePiPayment.test.ts — unit tests for the usePiPayment hook (Pi SDK mocked)The CI workflow (.github/workflows/frontend-ci.yml) runs lint → typecheck → test automatically on every pull request that touches tec-frontend/.
# Build all services
docker-compose build
# Start in production mode
docker-compose up -d
POSTGRES_PASSWORD - PostgreSQL passwordJWT_SECRET - JWT access token secret (min 32 chars)JWT_REFRESH_SECRET - JWT refresh token secret (min 32 chars)PI_API_KEY - Pi Network server-side API key (from developers.minepi.com)PI_APP_ID - Pi App identifier (from developers.minepi.com)PI_SANDBOX - 'true' for Sandbox, 'false' for Mainnet (production)NEXT_PUBLIC_PI_SANDBOX - Frontend counterpart; 'true' for SandboxNODE_ENV - Environment (development/production)CORS_ORIGIN - Allowed CORS originsRATE_LIMIT_WINDOW_MS - Rate limit window (default: 900000)RATE_LIMIT_MAX_REQUESTS - Max requests per window (default: 100)NEXT_PUBLIC_PI_SDK_TIMEOUT - Pi SDK load timeout in ms (default: 25000)NEXT_PUBLIC_PI_AUTH_TIMEOUT - Pi auth timeout in ms (default: 45000)NEXT_PUBLIC_PI_APPROVAL_TIMEOUT - Payment approval stage timeout in ms (default: 180000)NEXT_PUBLIC_PI_COMPLETION_TIMEOUT - Payment completion stage timeout in ms (default: 180000)MIT License - see LICENSE file for details
Encountering issues with GitHub Actions or workflows? Check our Troubleshooting Guide for common problems and solutions.
Contributions are welcome! Please feel free to submit a Pull Request.
Built with ❤️ for the Pi Network Ecosystem