এই ভলিউমে · ভলিউম 00
ভূমিকা
প্ল্যাটফর্ম পরিচিতি সিস্টেম আর্কিটেকচার শব্দকোষ প্রযুক্তি স্ট্যাক

অধ্যায় ০.৪ — প্রযুক্তি স্ট্যাক

১. উদ্দেশ্য

এই অধ্যায়ে travoBooks-এর প্রতিষ্ঠাকারী প্রযুক্তিগত পছন্দসমূহ সংজ্ঞায়িত করা হয়েছে — একটি আধুনিক, গ্লোবাল ট্রাভেল অ্যাকাউন্টিং ও ইউনিফাইড মেসেজিং প্ল্যাটফর্ম হিসেবে। প্রতিটি লেয়ার নির্বাচন করা হয়েছে enterprise-grade নির্ভরযোগ্যতা, লোডের অধীনে predictable performance, financial-grade ডেটা ইন্টিগ্রিটি, এবং একাধিক জুরিসডিকশনে OTAs, ট্রাভেল এজেন্সি, এবং AI ট্রাভেল এজেন্ট সেবার জন্য প্রয়োজনীয় অপারেশনাল কঠোরতার ভিত্তিতে।

২. সংক্ষিপ্ত স্ট্যাক

লেয়ার প্রযুক্তি ভূমিকা প্রাথমিক IDE / টুল
Frontend React.js Single-page application, পার্টনার পোর্টাল, অ্যাডমিন কনসোল, এজেন্ট ওয়ার্কস্টেশন VS Code + TypeScript
Backend Go (Golang) API সার্ভিস, ব্যবসায়িক লজিক, GDS/NDC ইন্টিগ্রেশন, ledger engine, messaging orchestrator GoLand
Database MySQL Cloud Enterprise Transactional store, financial ledger, audit trail, multi-tenant data MySQL Workbench / DBeaver
Cache & Queue Redis Session store, rate limiter, distributed locks, job queue, real-time fan-out RedisInsight

এটি একটি ইচ্ছাকৃতভাবে ছোট, সুপরিচিত স্ট্যাক। প্রতিটি উপাদান mature, hyperscale-এ widely deployed, এবং financial সিস্টেমে শক্তিশালী রেকর্ড বহন করে।

৩. আর্কিটেকচারাল টপোলজি

┌─────────────────────────────────────────────────────────────────────┐
│                         Client Tier                                 │
│   React.js SPA  •  Mobile Web  •  Partner Embedded Apps             │
└─────────────────────────────────┬───────────────────────────────────┘
                                  │  HTTPS (TLS 1.3) · REST · WebSocket
                                  ▼
┌─────────────────────────────────────────────────────────────────────┐
│                      Application Tier (Go)                          │
│   API Gateway · Auth · Booking · Ledger · Messaging · Reporting     │
└────────────┬──────────────────────────────────────────────┬─────────┘
             │                                              │
             ▼                                              ▼
┌──────────────────────────┐                  ┌──────────────────────────┐
│      Data Tier           │                  │   Cache & Queue Tier     │
│  MySQL Cloud Enterprise  │                  │         Redis            │
│  (Primary + Replicas)    │                  │  (Cluster + Sentinel)    │
└──────────────────────────┘                  └──────────────────────────┘

সব চারটি লেয়ার private network segment-এর উপর যোগাযোগ করে। Go সার্ভিসগুলোর মধ্যে inter-service ট্রাফিক mTLS ব্যবহার করে; ডেটাবেস এবং Redis ট্রাফিক certificate-pinned ক্লায়েন্টের সাথে TLS 1.3 ব্যবহার করে।

৪. Backend — Go (Golang)

৪.১ কেন Go

বৈশিষ্ট্য travoBooks-এর জন্য কেন গুরুত্বপূর্ণ
Lightweight concurrency (goroutines) একক Go process হাজার হাজার simultaneous GDS, NDC, এবং supplier API call থ্রেড-পুল exhaustion ছাড়া হ্যান্ডেল করতে পারে
Channels & sync primitives Multi-supplier search, parallel ticket issuance, webhook fan-out-এর নিরাপদ orchestration
Static binary একক self-contained executable; deterministic deployments; sub-second container start
Compile-time type safety একটি financial সিস্টেমের জন্য crucial — type errors production-এ নয়, compile time-এ ধরা পড়ে
Low-pause garbage collection Predictable p99 latency, booking ও ticketing SLA-এর জন্য essential
First-class standard library Production-ready HTTP, crypto, encoding, database packages — minimal third-party risk
Memory efficiency প্রতি service pod 20–100 MB; প্রতি node-এ high pod density infrastructure খরচ কমায়
Battle-tested at hyperscale Uber, Stripe, Cloudflare, Monzo, American Express — সব financial বা travel-adjacent

৪.২ IDE — GoLand (JetBrains)

GoLand backend team-এর জন্য standard development environment। প্রদান করে:

  • Whole-project refactoring সহ native Go language intelligence
  • Goroutine inspection সহ integrated debugger
  • Built-in race detector এবং memory profiler integration
  • Database tools, HTTP client, এবং Kubernetes integration
  • JetBrains Space / GitHub-এর মাধ্যমে code review এবং PR workflow
  • Save-এ gofmt / goimports দিয়ে consistent formatting

৪.৩ Framework ও লাইব্রেরি

উদ্দেশ্য Library
HTTP routing chi বা echo
Configuration viper + environment variables
Database access database/sql + sqlx (heavy ORM নয়)
Migrations golang-migrate
Validation go-playground/validator
Logging zerolog (structured JSON)
Metrics prometheus/client_golang
Tracing OpenTelemetry-Go
Testing go test + testify + dockertest
API spec OpenAPI 3 (spec-first via oapi-codegen)

৪.৪ Production বৈশিষ্ট্য

  • Median latency: < 20 ms API reads-এর জন্য
  • p95 latency: < 50 ms non-GDS routes-এর জন্য
  • Container start time: < 1 s
  • Memory per service: 20–100 MB resident
  • Goroutine cost: ~2 KB per concurrent operation
  • Throughput: প্রতি modest backend node 1,000+ RPS

৫. Frontend — React.js

৫.১ কেন React

বৈশিষ্ট্য travoBooks-এর জন্য কেন গুরুত্বপূর্ণ
Component-based architecture Partner portal, admin console, এবং embedded white-label experience-এ reuse
Virtual DOM বড় booking lists, ledger views, এবং reconciliation tables render করার সময়েও smooth UX
বিশাল ecosystem Forms, tables, charts, এবং accessibility-এর জন্য off-the-shelf সমাধান
TypeScript-first API contract থেকে UI binding পর্যন্ত end-to-end type safety
শক্তিশালী tooling Vite, ESLint, Prettier, Storybook, Vitest, Playwright
Mature i18n & RTL support বাংলা, English, Hindi, Arabic — এবং right-to-left language-এর জন্য প্রয়োজনীয়
Server-side rendering option Marketing surface এবং SEO-critical page-এর জন্য Next.js উপলব্ধ

৫.২ Frontend Tooling

উদ্দেশ্য পছন্দ
Build tool Vite
Language TypeScript (strict mode)
Routing React Router
Data fetching TanStack Query
Server state cache TanStack Query
Local state Zustand
Forms React Hook Form + Zod
Styling Tailwind CSS
Component primitives Radix UI / shadcn
Charts Recharts
Tables TanStack Table
Testing Vitest + React Testing Library + Playwright
Component docs Storybook

৫.৩ Performance Target

  • Initial JavaScript bundle: < 200 KB gzipped
  • First Contentful Paint: < 1.5 s 4G-এ
  • Time to Interactive: < 3 s entry-level device-এ
  • Lighthouse Performance: ≥ 90
  • Lighthouse Accessibility: ≥ 95 (WCAG 2.1 AA target)

৫.৪ Internationalization ও Accessibility

  • Translation-এর জন্য react-intl
  • Plurals, gender, lists-এর জন্য ICU MessageFormat
  • Locale-aware date, currency, এবং number formatting
  • Arabic-এর জন্য RTL layout switching
  • WCAG 2.1 AA compliance: keyboard nav, screen reader, color contrast
  • বর্তমানে shipped: English এবং বাংলা

৬. Database — MySQL Cloud Enterprise

৬.১ কেন MySQL Cloud Enterprise

বৈশিষ্ট্য travoBooks-এর জন্য কেন গুরুত্বপূর্ণ
ACID compliance (InnoDB) একটি financial ledger-এর জন্য non-negotiable — প্রতি journal entry atomic, consistent, isolated, durable হতে হবে
Proven at scale Facebook, Uber, Booking.com, Airbnb-তে deployed — billion-row tables, হাজার হাজার TPS
Strong consistency Primary-তে write-এর পর reads অবিলম্বে consistent
Mature replication HA-এর জন্য async, semi-sync, এবং group replication
Enterprise tier benefits Multi-AZ HA, PITR backups, encryption at rest (TDE), enterprise audit plugin, 24/7 SLA
Predictable performance Well-understood query planner, লোডের অধীনে deterministic execution
Wide tooling DBAs, monitoring stacks, migration tools, এবং analytics integrations সব first-class

৬.২ Enterprise Tier Features Leveraged

  • Multi-AZ high availability automatic failover-এর সাথে (< 60 s RTO)
  • Point-in-time recovery (PITR) 1-second granularity-এর সাথে
  • Read replicas reporting workload এবং disaster recovery-এর জন্য
  • Transparent Data Encryption (TDE) at-rest protection-এর জন্য
  • MySQL Enterprise Audit plugin tamper-evident logging-এর জন্য
  • MySQL Enterprise Backup hot backups-এর জন্য
  • Thread Pool plugin heavy load-এ connection efficiency-এর জন্য
  • 24/7 vendor support defined SLA-এর সাথে

৬.৩ Schema ও Data Design

  • Partition-based multi-tenancy: প্রতিটি business-meaningful table-এ partner_id composite primary key-এর অংশ
  • Composite foreign keys (partner_id, *_id) database layer-এ isolation enforce করে
  • Append-only financial tables (journal_entries, journal_entry_lines, audit_logs) — কোনো UPDATE নেই, কোনো DELETE নেই
  • JSON sub-fields-এর জন্য generated columns + functional indexes
  • পূর্ণ Unicode (Bangla, Hindi, Arabic, emoji) সমর্থনের জন্য utf8mb4_0900_ai_ci collation

৬.৪ Performance ও Scaling Strategy

Pattern Application
Connection pooling ~25 connections-এ tuned per-service pool; fan-in-এর জন্য ProxySQL
Read replicas সব reporting এবং analytics queries replicas-এ routed
Partitioning journal_entry_lines এবং audit_logs মাস অনুসারে partitioned
Vitess (future) Single-instance throughput অতিক্রম করা partners-এর জন্য horizontal sharding
Sharding key সর্বদা partner_id-first — tenant data co-located রাখার জন্য

৭. Cache ও Queue — Redis

৭.১ কেন Redis

বৈশিষ্ট্য travoBooks-এর জন্য কেন গুরুত্বপূর্ণ
Sub-millisecond latency Hot-path reads (session, rate limit, idempotency keys) ব্যবহারকারীকে কখনো block করে না
Rich data structures Strings, lists, hashes, sorted sets, streams — একাধিক সমস্যার জন্য একটি tool
Atomic operations & Lua scripting নিরাপদ counters, rate limiters, distributed locks
Streams Async jobs এবং event distribution-এর জন্য durable, partitioned, consumer-group queue
Pub/Sub & Keyspace Notifications WebSocket fan-out-এর জন্য real-time signaling
Persistence options যেখানে প্রয়োজন সেখানে durability-এর জন্য RDB snapshots + AOF
Cluster mode Automatic sharding সহ horizontal scaling

৭.২ travoBooks-এ Use Case

উদ্দেশ্য Redis Feature
User session storage Hash + TTL
API rate limiting (প্রতি partner, IP, token) Sorted set / token bucket via Lua
POST endpoints-এর জন্য idempotency keys String + TTL (24h)
Booking holds-এর জন্য distributed locks SET NX EX + Redlock
Background job queue Redis Streams + consumer groups
Real-time notification fan-out Pub/Sub
Hot read cache (exchange rates, airport codes, fare rules) String / Hash
GDS request deduplication String + TTL
Backoff সহ webhook delivery queue Streams + delayed-job sorted set

৭.৩ Operational Topology

  • Redis Cluster 6 nodes-এর সাথে (3 primary, 3 replica) — minimum
  • Redis Sentinel non-cluster deployment-এর জন্য automatic failover প্রদান
  • Major write penalty ছাড়া durability-এর জন্য AOF persistence appendfsync everysec সহ
  • Command এবং key-pattern restrictions সহ per-service credentials-এর জন্য ACL
  • Mutual authentication সহ TLS in transit

৮. উপাদানগুলো কীভাবে একসাথে যুক্ত

৮.১ Steady-State Request Path

1. React SPA HTTPS request issue করে
2. CDN / WAF inspect, rate-limit, forward করে
3. API Gateway (Go) Redis session lookup-এর মাধ্যমে authenticate করে
4. Gateway সংশ্লিষ্ট service (Go)-এ route করে
5. Service business rules apply করে
6. Service cache (Redis) পড়ে — miss-এ MySQL query করে
7. Service write (যদি mutation): MySQL transaction
8. Service events Redis Streams-এ publish করে
9. Asynchronous workers Streams থেকে consume (notification, webhook, ledger)
10. React SPA-এ response ফেরত; WebSocket downstream updates push করে

৮.২ Worked Example — Ticket Issuance

Step Component Action
1 React User "Issue Ticket"-এ click → POST /v1/bookings/{id}/issue Idempotency-Key সহ
2 API Gateway (Go) Redis-এর বিরুদ্ধে session validate করে; rate limit check করে
3 Booking Service (Go) Redis-এ booking:{id}-এ distributed lock acquire করে
4 Booking Service (Go) Redis-এ idempotency key check করে — duplicate হলে prior result ফেরত দেয়
5 Booking Service (Go) supplier_request_log-এ (MySQL) "pending" record করে এবং commit করে
6 Booking Service (Go) DB transaction-এর বাইরে GDS / NDC call করে
7 GDS / NDC Ticket number ফেরত দেয়
8 Booking Service (Go) MySQL transaction open করে: INSERT ticket + INSERT JE lines + UPDATE booking state
9 MySQL COMMIT (operational + ledger writes জুড়ে atomic)
10 Booking Service (Go) Redis Stream-এ booking.issued event publish করে
11 Notification Worker (Go) Event consume → e-ticket PDF render → AWS SES-এর মাধ্যমে পাঠায়
12 WebSocket Gateway (Go) React SPA-এ status update push করে
13 Booking Service (Go) Redis lock release করে

এই pattern — transaction-এর বাইরে GDS call, ভিতরে ledger — প্ল্যাটফর্মের কেন্দ্রীয় নির্ভরযোগ্যতা principle। এটি শুধুমাত্র সম্ভব কারণ Go-এর concurrency model এবং Redis-এর lock primitive cleanly combine হয়।

৯. Scalability বিবেচনা

৯.১ Horizontal Scaling Profile

Component Scaling Approach
Go services Stateless — coordination ছাড়া load balancer-এর পিছনে scale out
MySQL writes Primary vertically scale; reads replicas-এ route; extreme scale-এ partner_id দিয়ে shard
MySQL reads Read replicas; reporting load-এর সাথে linearly grow
Redis Cluster mode — nodes জুড়ে automatic sharding
Background workers Stateless — queue depth-এর সাথে scale (Redis Streams pending count)

৯.২ Capacity Target

  • প্রতি region 10,000 concurrent users
  • প্রতি সেকেন্ডে 1,000 transaction sustained
  • ledger layer-এ প্রতি সেকেন্ডে 500+ journal entries posted
  • 99.95% uptime SLA
  • Active-active multi-region (Phase 2 roadmap)

৯.৩ Auto-Scaling Trigger

  • 3 মিনিটের জন্য CPU > 70% → scale out
  • Request queue depth > 100
  • 5 মিনিটের জন্য defined SLO-এর উপরে p95 latency
  • Custom metrics: GDS error rate, queue lag

১০. Enterprise Security

১০.১ Defense in Depth

Layer Controls
Edge WAF (rule-based + ML), DDoS protection, যেখানে প্রয়োজন geo-fencing
Transport শুধু TLS 1.3, HSTS, mobile clients-এর জন্য certificate pinning
Authentication Argon2id-hashed passwords, MFA (TOTP), Personal Access Tokens, ঐচ্ছিক SSO (SAML, OIDC)
Authorization Maker-checker সহ RBAC, scope-limited tokens, attribute-based policies
Service-to-service প্রতিটি Go service-এর মধ্যে mTLS; SPIFFE / Vault-এর মাধ্যমে service identity
Data at rest MySQL TDE, disk encryption সহ Redis, SSE-KMS সহ S3
Data in motion প্রতিটি hop-এর মধ্যে TLS 1.3
Secrets HashiCorp Vault বা AWS Secrets Manager; automatic rotation; কখনো code বা logs-এ নয়
Audit hash chaining সহ append-only audit_logs; SIEM integration

১০.২ Compliance Alignment

  • SOC 2 Type II — annual audit
  • ISO 27001 — information security management
  • PCI-DSS SAQ-A — PCI-certified gateways-এর মাধ্যমে card data tokenize করে (PAN storage নেই)
  • GDPR / UK GDPR / DPDPA / PDPA — data subject rights, DPA agreements, EU SCCs
  • বাংলাদেশ ICT Act 2006 + Digital Security Act — বাংলাদেশের partners-এর জন্য local compliance
  • IATA / BSP — settlement integrity controls

১০.৩ মূল Security বৈশিষ্ট্য

  • সব Go services compile-time-এ SQL injection prevent করে (parameterized queries enforced)
  • React frontend XSS block করতে Content Security Policy (CSP) + Trusted Types ব্যবহার করে
  • Idempotency keys double-spend এবং replay attacks prevent করে
  • Hash-chained audit logs tampering detect করে
  • Configurable thresholds-এর উপরে যেকোনো operation-এর জন্য maker-checker প্রয়োজন

১১. Performance Benefits

১১.১ Latency Profile (p95 Target)

Operation Target
API authentication < 10 ms
Booking read (cached) < 30 ms
Booking read (cold) < 80 ms
Ticket issue (excluding GDS) < 200 ms
Journal posting < 50 ms
Report (cached) < 100 ms
Report (computed) < 5 s

১১.২ Throughput

  • প্রতি backend node 1,000 RPS sustained
  • Horizontal scaling সহ 10,000+ RPS
  • ledger-এ প্রতি সেকেন্ডে 500+ JE post
  • Redis Streams-এর মাধ্যমে প্রতি সেকেন্ডে 50,000 event

১১.৩ কেন এই স্ট্যাক deliver করে

  • Go-এর concurrency model bursty traffic-এর অধীনে thread-pool exhaustion eliminate করে, rest of the system block না করে অনেকগুলো simultaneous slow GDS call allow করে।
  • Serializable isolation সহ MySQL InnoDB ledger integrity guarantee করে — একটি ট্রাভেল অ্যাকাউন্টিং প্ল্যাটফর্মের সবচেয়ে গুরুত্বপূর্ণ property।
  • সামনে Redis hot reads (sessions, rate limits, exchange rates) absorb করে, যাতে MySQL শুধু writes এবং cold reads দেখে।
  • React-এর reconciliation algorithm বড় ledger view এবং reconciliation tables surface করার সময়েও UI responsive রাখে।

১২. DevEx ও Operational Tooling

১২.১ Backend Workflow

  • IDE: GoLand
  • Linting: golangci-lint
  • Testing: go test + testify + dockertest
  • Migrations: golang-migrate
  • API spec: OpenAPI 3 (spec-first)
  • CI: GitHub Actions
  • Containerization: Docker
  • Orchestration: Kubernetes (EKS / GKE)

১২.২ Frontend Workflow

  • IDE: VS Code
  • Linting: ESLint + Prettier
  • Testing: Vitest + React Testing Library + Playwright
  • Build: Vite
  • Component docs: Storybook
  • CI: GitHub Actions
  • Deployment: edge caching সহ CDN

১২.৩ Observability Stack

Concern Tool
Metrics Prometheus + Grafana
Tracing OpenTelemetry → Tempo / Jaeger
Logging Structured JSON → Loki / OpenSearch
Error tracking Sentry
Uptime Pingdom / Better Stack
APM Datadog বা New Relic (ঐচ্ছিক)

১৩. কেন এই স্ট্যাক — সংক্ষিপ্তসার

প্ল্যাটফর্ম প্রয়োজনীয়তা নির্বাচিত প্রযুক্তি কেন
High-concurrency GDS / NDC integration Go Goroutines এবং channels হাজার হাজার simultaneous supplier call handle করে
Financial ledger integrity MySQL Cloud Enterprise InnoDB ACID transactions, replication, TDE, audit
Real-time partner UI ও dashboards React.js Virtual DOM, mature ecosystem, TypeScript safety, i18n
Sub-millisecond cache ও queue Redis Multi-structure store, atomic ops, durable queue-এর জন্য Streams
Predictable backend developer experience GoLand Native Go intelligence, profiler, race detector

একসাথে এই চারটি উপাদান গ্লোবাল স্কেলে enterprise-grade ট্রাভেল অ্যাকাউন্টিং-এর জন্য প্রয়োজনীয় latency, integrity, security, এবং scalability প্রদান করে — যখন একটি focused engineering team-এর জন্য confidence-এর সাথে run করার জন্য operationally simple।