jvinhit//lab

Search posts

Type to search across journal entries.

navigate open esc close

Series · 15 parts

Node.js Super Senior — 10 Phases + Deep Dives

A production-ready, enterprise-grade path from "gà mờ" to Super Senior Node.js backend developer: ten core phases — core fundamentals, HTTP, Express, databases, auth & security, advanced patterns, DevOps, performance, testing, and enterprise architecture — then bonus deep dives into PostgreSQL, Prisma, and NestJS. Hands-on in TypeScript, with projects.

  1. Phase 1: how Node really works (V8, libuv, bindings), the event loop phase-by-phase, the libuv thread pool, async from callbacks to async/await, ESM vs CommonJS, the core modules that matter, worker threads vs cluster, and memory.

  2. Phase 2: HTTP in depth (methods, status, headers, REST, idempotency), HTTP/1.1 vs HTTP/2, a raw Node server, request parsing, a hand-rolled router, streaming and SSE, cookies, CORS, caching/ETag, compression, and graceful shutdown.

  3. Phase 3: master Express 5 — the request lifecycle, the middleware pipeline, routing and routers, a layered architecture, a typed error strategy with async handling, Zod validation, the production security stack, and graceful shutdown.

  4. Phase 4: give your API a real database — drivers vs ORMs, indexes, pooling, transactions and isolation levels, the N+1 problem and DataLoader, repositories, keyset pagination, MongoDB modeling, and a Redis cache layer.

  5. Phase 5: lock down your API — password hashing with bcrypt/argon2, sessions vs JWT (anatomy, refresh tokens, rotation), secure cookies, OAuth2/OIDC, RBAC and ownership checks, and defenses against XSS, CSRF and injection.

  6. Phase 6: patterns that scale a codebase — dependency injection and IoC, repository + service + unit of work, caching strategies and invalidation, BullMQ job queues, structured logging, config validation, and resilience patterns.

  7. Phase 7: take it to production — 12-factor config, multi-stage Docker images and PID 1 signals, Docker Compose, PM2 vs Kubernetes, health checks and zero-downtime deploys, a CI/CD pipeline with GitHub Actions, and nginx + TLS.

  8. Phase 8: make it fast and prove it — measuring percentiles, profiling with perf_hooks and clinic.js, event-loop lag, query optimization, multi-layer caching, clustering and worker threads, response optimization, and hunting memory leaks.

  9. Phase 9: ship without fear — the testing pyramid, test doubles, unit and integration tests with supertest and Testcontainers, mocking with nock, factories, meaningful coverage, and the built-in node:test runner.

  10. The capstone: clean/layered architecture, microservices with an API gateway, event-driven design, CQRS, core design patterns (Singleton, Factory, Observer, Decorator), and SOLID — what separates a senior from a super senior.

  11. Bonus Phase 11: go deep on PostgreSQL from Node — data modeling, the right index per query, EXPLAIN ANALYZE, transactions and isolation levels, JSONB, connection pooling with pg, and the concurrency bugs that bite seniors.

  12. Bonus Phase 12: master Prisma — the schema and relations, migrations, the type-safe Client (CRUD, select/include, nested writes, aggregations), transactions, connection pooling, safe raw SQL, extensions, and error handling.

  13. Bonus Phase 13: make it fast and scalable with Redis. Core data types, cache-aside with TTLs and stampede protection, pub/sub vs Streams, atomic rate limiting, distributed locks, sessions, and BullMQ jobs — in TypeScript.

  14. Bonus Phase 14: master NestJS — modules, controllers, providers and DI, DTO validation, guards and role-based auth, interceptors, exception filters, the request lifecycle, Prisma, config, queues, and testing.

  15. The bonus-arc finale: master modern auth. JWT anatomy and signing, access/refresh rotation, cookie vs header storage and the XSS/CSRF trade-off, token revocation with Redis, OAuth2/OIDC with PKCE, and role/permission RBAC as NestJS guards.