[{"content":"Real-time features — live notifications, collaborative editing, multiplayer interactions — require a persistent, low-latency connection between client and server. Socket.io makes this straightforward to implement.\nWhy Not Plain WebSockets? WebSockets provide the raw connection, but Socket.io adds:\nAutomatic reconnection with exponential backoff Room and namespace support for organizing connections Fallback to HTTP long-polling when WebSockets are unavailable Event-based API that is cleaner than raw message passing Basic Setup Server (Node.js):\nimport { createServer } from \u0026#34;http\u0026#34;; import { Server } from \u0026#34;socket.io\u0026#34;; const httpServer = createServer(); const io = new Server(httpServer, { cors: { origin: \u0026#34;*\u0026#34; } }); io.on(\u0026#34;connection\u0026#34;, (socket) =\u0026gt; { console.log(\u0026#34;client connected:\u0026#34;, socket.id); socket.on(\u0026#34;message\u0026#34;, (data) =\u0026gt; { // Broadcast to all other clients socket.broadcast.emit(\u0026#34;message\u0026#34;, data); }); socket.on(\u0026#34;disconnect\u0026#34;, () =\u0026gt; { console.log(\u0026#34;client disconnected:\u0026#34;, socket.id); }); }); httpServer.listen(3000); Client (browser):\nimport { io } from \u0026#34;socket.io-client\u0026#34;; const socket = io(\u0026#34;http://localhost:3000\u0026#34;); socket.on(\u0026#34;connect\u0026#34;, () =\u0026gt; { console.log(\u0026#34;connected as\u0026#34;, socket.id); }); socket.emit(\u0026#34;message\u0026#34;, { text: \u0026#34;Hello, world!\u0026#34; }); socket.on(\u0026#34;message\u0026#34;, (data) =\u0026gt; { console.log(\u0026#34;received:\u0026#34;, data); }); Rooms — Scoping Messages Rooms let you send events to a subset of connected clients:\n// Server: join a room socket.join(\u0026#34;room-alpha\u0026#34;); // Server: emit only to that room io.to(\u0026#34;room-alpha\u0026#34;).emit(\u0026#34;update\u0026#34;, payload); This is the foundation for features like per-channel chat or per-document collaboration.\nKey Takeaway Socket.io abstracts away the complexity of real-time networking. Start with a simple chat app to understand the event loop, then layer in rooms and authentication as your use case grows.\n","permalink":"https://portfolio-v2-01g.pages.dev/posts/realtime-communication-with-socketio/","summary":"How to use Socket.io to build real-time, bidirectional communication between clients and servers — with practical examples.","title":"Real-time Communication with Socket.io"},{"content":"Generative AI refers to models that can produce new content — text, images, code, audio — rather than simply classifying or predicting from existing data. The last few years have seen these models move from research labs to everyday tools.\nHow Large Language Models Work LLMs like GPT-4 and Gemini are trained on massive text corpora using a technique called self-supervised learning. The model learns to predict the next token in a sequence. After pretraining, models are fine-tuned using Reinforcement Learning from Human Feedback (RLHF) to make their outputs more helpful and aligned.\nPrompt Engineering The quality of your prompt significantly impacts output quality. A few principles:\nBe specific — vague prompts produce vague outputs Provide context — include relevant background information Give examples — few-shot prompting dramatically improves consistency Iterate — treat prompting as a feedback loop, not a one-shot command Building with APIs Most LLMs expose HTTP APIs. A minimal example using the OpenAI-compatible interface:\nfrom openai import OpenAI client = OpenAI(api_key=\u0026#34;your-key\u0026#34;) response = client.chat.completions.create( model=\u0026#34;gpt-4o\u0026#34;, messages=[ {\u0026#34;role\u0026#34;: \u0026#34;system\u0026#34;, \u0026#34;content\u0026#34;: \u0026#34;You are a helpful assistant.\u0026#34;}, {\u0026#34;role\u0026#34;: \u0026#34;user\u0026#34;, \u0026#34;content\u0026#34;: \u0026#34;Explain backpropagation in one paragraph.\u0026#34;} ] ) print(response.choices[0].message.content) What to Build First Start small and useful:\nA CLI tool that summarizes long documents A script that generates commit messages from diffs A simple chatbot with memory using conversation history The best way to understand generative AI is to build something real with it.\n","permalink":"https://portfolio-v2-01g.pages.dev/posts/getting-started-with-generative-ai/","summary":"An introduction to generative AI — what it is, how large language models work, and practical ways to start building with them today.","title":"Getting Started with Generative AI"},{"content":"Artificial intelligence has moved from academic curiosity to practical tool faster than almost any technology before it. Understanding the fundamentals helps you cut through the noise and use these tools more effectively.\nWhat Is a Neural Network? At its core, a neural network is a function approximator. You feed it inputs, it performs a series of matrix multiplications and non-linear transformations, and it produces an output. During training, the network adjusts its internal weights to minimize the difference between its predictions and the ground truth.\nLoss Functions and Optimization The loss function measures how wrong the model is. Common choices:\nMean Squared Error (MSE) — used for regression tasks Cross-Entropy Loss — used for classification tasks Optimization algorithms like Stochastic Gradient Descent (SGD) and Adam iteratively update weights by computing gradients of the loss with respect to each parameter.\nOverfitting and Generalization A model that memorizes training data but fails on unseen data is said to be overfitting. Techniques to combat this:\nDropout — randomly zeroing out neurons during training Regularization (L1/L2) — penalizing large weight values Early stopping — halting training when validation loss stops improving Key Takeaway Understanding AI fundamentals is less about memorizing formulas and more about developing intuition for why models succeed or fail. Start with a small dataset, train a simple model, and observe its behavior closely.\n","permalink":"https://portfolio-v2-01g.pages.dev/posts/understanding-ai-fundamentals/","summary":"A practical look at the core concepts that power modern artificial intelligence — from neural networks to model training and evaluation.","title":"Understanding AI Fundamentals"},{"content":"Hi, I\u0026rsquo;m Raj.\nI build software, write about what I learn, and enjoy turning ideas into products.\nMy interests lie in backend engineering, developer tools, system design, and building applications that solve real-world problems. I enjoy exploring how systems work under the hood, from API design and databases to authentication, performance, and security.\nThis website is both my digital notebook and my personal corner on the internet. You\u0026rsquo;ll find technical articles, engineering notes, project breakdowns, and lessons learned while building software.\n","permalink":"https://portfolio-v2-01g.pages.dev/about/","summary":"\u003cp\u003e\u003cstrong\u003eHi, I\u0026rsquo;m Raj.\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eI build software, write about what I learn, and enjoy turning ideas into products.\u003c/p\u003e\n\u003cp\u003eMy interests lie in backend engineering, developer tools, system design, and building applications that solve real-world problems. I enjoy exploring how systems work under the hood, from API design and databases to authentication, performance, and security.\u003c/p\u003e\n\u003cp\u003eThis website is both my digital notebook and my personal corner on the internet. You\u0026rsquo;ll find technical articles, engineering notes, project breakdowns, and lessons learned while building software.\u003c/p\u003e","title":"About Me"},{"content":"This page showcases a list of projects(FOSS and closed source) developed by me over the period of time.\nHealthSaathi - A telemedicine platform built with React 19 and FastAPI, featuring an AI-powered chatbot, doctor consultations, digital prescriptions, and medicine ordering.\nOPTfy A lightweight authentication system implementing OTP-based user verification with registration, login, and rate limiting.\nStealthShare A full-stack, end-to-end encrypted file sharing platform where all cryptographic operations happen in the browser using AES-256-GCM and PBKDF2 key derivation.\nrandnamepy A lightweight, zero-dependency Python library for generating realistic random names, usernames, and placeholder data for testing\nPyPI ","permalink":"https://portfolio-v2-01g.pages.dev/projects/","summary":"Personal projects by Raj Gupta","title":"Personal Projects"}]