first commit: منصة Tripz — خطط كاملة + سكافولد باك إند NestJS/Docker
- docs/00-15: دراسة، بنية، محرك تعرفة، تسعير، نموذج استئجار، تكاملات، بيانات، realtime، خطة، devops، لاندنج، مخاطر، اصطلاحات سيرفر، تدفق نشر - backend/: NestJS 11 على Docker (health + tenants + عزل tenant_id + بادئة tripz_ + Redis DB 3) - apps/rider, apps/driver, dashboards/admin-web, dashboards/superadmin-web (هياكل) - sync-to-server.sh + .gitignore Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
# Tripz Backend — NestJS (Docker فقط)
|
||||
|
||||
> **لا تثبيت محلي على الماك.** الكود يُكتب محلياً، والبناء والتشغيل والهجرات **كلها داخل Docker على السيرفر**.
|
||||
|
||||
## التشغيل على السيرفر
|
||||
```bash
|
||||
cd backend
|
||||
cp .env.example .env # ثم عدّل كلمات المرور والأسرار
|
||||
docker compose up -d --build # يبني ويشغّل: postgres/postgis, redis, martin, api, worker
|
||||
```
|
||||
|
||||
## الهجرات (داخل حاوية الـ api)
|
||||
```bash
|
||||
docker compose exec api npm run migration:run
|
||||
```
|
||||
|
||||
## فحص سريع
|
||||
```bash
|
||||
curl http://<server>:4010/api/health # {"status":"ok",...}
|
||||
# توثيق Swagger: http://<server>:4010/api/docs
|
||||
```
|
||||
|
||||
## العزل على السيرفر المشترك (راجع docs/14)
|
||||
- Postgres: قاعدة `tripz`، بادئة جداول `tripz_` (مثال: `tripz_tenants`).
|
||||
- Redis: **DB رقم 3** غير الافتراضي + بادئة مفاتيح `tripz:`.
|
||||
- منافذ مضيف غير قياسية (API 4010، Postgres 55432) لتفادي التصادم.
|
||||
- أسماء حاويات/شبكة/فوليوم ببادئة `tripz-`.
|
||||
|
||||
## البنية الحالية (P0)
|
||||
```
|
||||
src/
|
||||
├── main.ts # bootstrap API (+ Swagger)
|
||||
├── worker.ts # نقطة دخول BullMQ (هيكل)
|
||||
├── app.module.ts # ConfigModule + TypeORM(entityPrefix) + Throttler + TenantMiddleware
|
||||
├── config/ # configuration.ts + data-source.ts (هجرات)
|
||||
├── common/
|
||||
│ ├── tenant/ # context (AsyncLocalStorage) + middleware + @Tenant()
|
||||
│ └── usage/ # UsageInterceptor (أساس الفوترة)
|
||||
├── database/
|
||||
│ ├── entities/ # tenant.entity.ts
|
||||
│ └── migrations/ # InitTenants
|
||||
└── modules/
|
||||
├── health/ # GET /api/health
|
||||
└── tenants/ # GET /api/tenant/config/:slug ، admin/tenants
|
||||
```
|
||||
|
||||
## التالي (P1)
|
||||
users · auth(OTP) · drivers · trips(★ آلة حالة) · matching(Redis GEO) · tariff · realtime(Socket.IO) · maps(وكيل انطلق).
|
||||
Reference in New Issue
Block a user