Sabitlenmiş Tweet
Vikram Aditya
943 posts

Vikram Aditya
@ViXkrm
GSoC'26 @KiwixOffline. Chilling
Katılım Mayıs 2025
289 Takip Edilen339 Takipçiler

@0xrinx I mean some people "CAN" code without AI but at the current time of age it's actually nonsense to code without AI
English
Vikram Aditya retweetledi

So it's been around 4 weeks since I'm working on something crazy and still haven't even marketed it which even attracted a PR from @mvanhorn yesterday
I'm building uWestJS v2.0 a complete platform adapter that brings uWebSockets (one of the fastest HTTP/WS implementations) to NestJS. We're talking 3-4x faster than Express (the benchmarks say itself) while keeping all the NestJS patterns you love. Basically a deep dive into systems level web programming.
What I've shipped so far:
HTTP Platform:
- Hybrid streaming body parser (buffers small bodies, streams large ones)
- Streaming compression (gzip/brotli/deflate) with content negotiation
- Static file serving with ETag, range requests, and conditional GET
- CORS handler with RFC-compliant preflight validation
- Multipart/form-data with streaming file uploads
- Full middleware pipeline (Guards, Pipes, Filters, Interceptors)
WebSocket Platform:
- Room-based broadcasting with efficient message distribution
- Per-message deflate compression
- Automatic backpressure handling (pauses when clients are slow)
- Full NestJS decorator support (@SubscribeMessage, @MessageBody, etc.)
- Lifecycle hooks (onConnection, onDisconnect)
- Exception filters for WebSocket errors
Architecture deep dive:
Memory optimizations:
- Stack-allocated ArrayBuffer handling
- Header caching (parse once, cache forever per request)
- Parsed body caching (parse once, return cached result for subsequent calls)
- Cookie parsing cache (parse on first access, cache the Map)
Streaming strategies:
- Hybrid body parser: 3 modes (awaiting → buffering → streaming)
- Automatic mode switching based on consumption pattern
- Zero-copy streaming where possible (pipe directly to destination)
- Backpressure propagation (pause uWS when Node.js stream is full)
- Streaming compression (compress chunks on-the-fly, no buffering)
Performance patterns:
- Lazy initialization (only parse what you actually use)
- Referential equality for empty bodies (same object reference = zero allocations)
- Efficient room management (Set-based lookups, O(1) operations)
- Message queue for backpressure (buffer messages when client is slow)
- Abort multiplexing (multiple handlers on single uWS abort callback)
Edge case handling:
- Dual rejection mechanism
- Graceful degradation (skip unknown compression encodings)
- Defensive programming (handle non-RFC-compliant headers)
- Race condition prevention
Building this taught me more about core HTTP, WebSockets, and Node.js internals than any tutorial ever could. Every feature required reading specs, understanding edge cases, and making architectural decisions about memory vs speed tradeoffs.
The specs/docs rabbit hole I went down:
- uWebSockets.js documentation - Understanding their zero-copy architecture, backpressure handling, and why they're so fast. Learning about their streaming model and how it differs from Node.js streams.
- RFC 7230 (HTTP/1.1 Message Syntax) - Implementing proper transfer-encoding handling. Did you know chunked MUST be the final encoding? Our implementation handles non-compliant headers gracefully.
- RFC 7231 (HTTP Semantics) - Building CORS preflight validation that actually follows the spec.
- RFC 6265 (HTTP State Management) - Cookie parsing, serialization, and security. Implementing signed cookies, httpOnly flags, and SameSite attributes correctly.
- RFC 1952 (GZIP) & RFC 7932 (Brotli) - For streaming compression. We compress responses on-the-fly without buffering - crucial for large payloads.
- Express.js source code - Spent days understanding their middleware patterns, body parsing, and error handling to maintain API compatibility. Your Express code should just work.
- NestJS docs and adapter contracts - Deep dive into AbstractHttpAdapter, AbstractWsAdapter, ModuleRef, and the entire DI system. Understanding how Guards, Pipes, and Filters get resolved and executed.
- Socket.IO internals - Replicating their room management and broadcasting API. Understanding how they handle namespaces, acknowledgments, and connection lifecycle.
- Busboy documentation - Implementing RFC-compliant multipart/form-data parsing with streaming file uploads and proper backpressure handling.
Launching v2.0 on NPM and publicly soon.
GitHub: github.com/FOSSFORGE/uWes…



English

@https_ghanshyam Same here man my followers jumped from 1800 to 2300 in a day on LinkedIn
English

@https_ghanshyam These people are cool. Which organization btw, I'm from Kiwix
English

Looks like college exams weren't the only thing I could crack💪👀...
Thanks to @kirat_tw , @itsudhwani and @adityadeshlahre for the guidance.
#GSoC2026 #GoogleSummerOfCode #OpenSource #Developer #Google #Google


English

Chat we got da bluest tick 😝.
Man I can finally write longer posts hoooooffff 😮💨😮💨

Vikram Aditya@ViXkrm
Chat should we get verified now???
English




















