PPrepLearn
Progress · 0/7 sections

Phase 2 Advanced — Go, API & Auth

3 min read

Phase 2 Advanced — Go, API & Auth (Production-Grade)

Yeh folder kyun hai? phase2-go-api-auth.md mein basics cover hue hain (GMP scheduler, goroutines, JWT, OAuth basics, gRPC intro). Staff engineer banne ke liye woh kaafi nahi. Yahan woh topics hain jo production mein actually matter karte hain — 50M users, real incidents, real tradeoffs.


System Assumptions

Scale:    50M monthly active users
Peak:     ~200K req/sec
Services: 50+ microservices (mostly Go)
Team:     30-50 engineers
Infra:    Kubernetes, multi-region AWS/GCP

Reading Order

#FileTopicPrerequisite
0101-advanced-go-patterns.mdpprof profiling, sync primitives, generics, memory optimizationphase2 basics
0202-api-design-at-scale.mdVersioning, idempotency, pagination, OpenAPI, API contractsREST basics
0303-grpc-deep-dive.mdStreaming, interceptors, deadlines, error handling, protobuf designgRPC intro
0404-websockets-realtime.mdWebSockets at scale, SSE, fan-out, pub/sub, connection managementHTTP basics
0505-api-security-hardening.mdOWASP API Top 10, secrets management, input validation, supply chainAuth basics
0606-testing-strategies.mdUnit/integration/load testing, testcontainers, contract testing, chaosGo basics
0707-go-service-architecture.mdProject structure, clean arch, DI, domain events, service templateAll above

Kya Phase 2 Basics Mein Tha vs Yahan Kya Hai

Phase 2 basics (already done):
  ✅ GMP scheduler, goroutines, channels, context
  ✅ GC tuning basics
  ✅ REST vs gRPC vs GraphQL (overview)
  ✅ Sessions vs JWT vs OAuth 2.0 vs DPoP
  ✅ API security basics

Yahan (advanced, production-grade):
  🔥 pprof profiling, flame graphs, memory leaks in production
  🔥 sync.Map, atomic, lock-free data structures
  🔥 API versioning strategies, idempotency keys, pagination at scale
  🔥 gRPC bidirectional streaming, interceptor chains, error taxonomy
  🔥 WebSockets 50M users pe — sticky sessions, fan-out, backpressure
  🔥 OWASP API Top 10 + how to fix each in Go
  🔥 Testcontainers, contract testing (Pact), k6 load testing
  🔥 Production Go service structure used at Google/Uber/Stripe

Staff Engineer Mindset for Go APIs

Junior:   "Code kaam kar raha hai, tests pass ho rahe hain"
Senior:   "Code maintainable hai, edge cases handle hain"
Staff:    "System design correct hai, team kaise scale karega,
           production mein 3am ko kya break hoga, pehle se jaanta hoon"

Questions jo staff engineer poochta hai:
  - "Is API idempotent? Double submit kya hoga?"
  - "Yeh endpoint 10x traffic pe kya karega?"
  - "Schema change backwards compatible hai?"
  - "Secret rotation kaise hoga bina downtime?"
  - "Test suite 5 min mein run hoti hai ya 30 min?"

Related