Someday I was thinking about reviewing some old projects with my current knowledge to see how much I’ve improved over time. I found an old project using WebSockets for a realtime chat, and after analyzing my code, I caught myself wondering: “How would I do this kind of project now?” With that in mind, I decided to start a new project using WebSockets to test my evolution, but I added a challenge: making the software work in a distributed way. Before starting the planning and development, I asked myself: “What kind of solution should I build?” Then I remembered something we developers do a lot in our day-to-day work: scrum poker meetings. So, I created an application with Node.js and Angular using Socket.io to handle this task. I set up everything to run inside a container with Docker Compose and used an Nginx server as a load balancer to test the distributed setup. Since socket connections could be established across different server instances, I needed a way for sockets in different instances to communicate. To solve this, I used the Redis adapter provided by Socket.io, which allows messages to be broadcast across all application instances. Without this feature, I would probably have used a message queue with topics (RabbitMQ, Kafka, etc.) to handle socket messages and deliver them to the correct clients in my cluster. This project was a great opportunity to revisit old concepts, explore distributed architectures, and challenge myself with real-world problems. It also served as my starting point with Angular, helping me get hands-on experience with a modern front-end framework. Overall, it strengthened my understanding of WebSockets, scaling applications, and showed how much we can grow as developers by reflecting on past work and applying new approaches. if you are curious about this project, you can check it in this repository on Github: https://lnkd.in/dDbj8c9c #nodejs #angular #socketio #docker
More Relevant Posts
-
🚀 React Day 21: Redux Internals + Middleware Deep Dive 💡 #WebDevelopment with Rohit Negi Bhaiya Continuing from Day 20, jaha humne Bitcoin API project banaya using Redux Toolkit, aaj humne ussi ki internal working of async Redux + middleware samjha 🔥 🔍 Key Learnings: 1️⃣ dispatch(fetchData(20)) => "fetchData is just a "function", not a direct an "action". ▪️Agar ye action hota, store ko type se pata chal jata kaunsa reducer run karna hai. ▪️Ab function dispatch ho raha hai, toh store directly handle nahi kar pa raha. 2️⃣ Middleware ka role: ▪️Middleware detect karta hai ki ye function hai aur ise call karwa deta hai. ▪️Without middleware, store ko samajh nahi aata ki kya karna hai. 3️⃣ createAsyncThunk automatically handles these three states: ▪️Pending (Loading) – jab API request start hoti hai ▪️Fulfilled (Resolved) – jab data successfully fetch ho jata hai ▪️Rejected (Error) – agar request fail ho jaye 4️⃣ ExtraReducers ka magic: ▪️Dispatch me slice name nahi diya, matlab multiple slices easily same data use kar sakte hain ▪️ExtraReducers me likhe cases automatically match hote hain type ke according aur state update kar dete hain 5️⃣ Why no slice name in dispatch? ▪️Agar slice name hota, sirf wo slice data receive karta ▪️agar multiple slices same data use karna ho, toh slice name na dena better hai 🧠 Simplified Concept: 🔹 Dispatching function = Store ko direct action nahi, bas function pass hota 🔹 Middleware = Detects function & calls it 🔹 createAsyncThunk = Handles async states internally 🔹 ExtraReducers = Automatically updates state based on API status 📍 Next: "React Virtual DOM" 🙏 Special thanks to Rohit Negi Bhaiya for explaining Redux internals in such a simple way ❤️ #React #Redux #ReduxToolkit #Middleware #AsyncThunk #ReactJS #WebDevelopment #Frontend #JavaScript #ReactHooks #FrontendDeveloper #RohitNegi #CoderArmy #Nexus #TechCommunity
To view or add a comment, sign in
-
-
Node.js Essential Tips & Tricks Every Developer Level up your Node.js skills with these essential tips for writing cleaner, faster, and more efficient code. 1. Use Async/Await for Cleaner Code – Simplify asynchronous logic and improve readability. 2. Destructuring Assignment for Simplicity – Access object properties easily with clean syntax. 3. Use Path Module for File Handling – Manage file paths safely across operating systems. 4. Debounce API Calls (Lodash) – Prevent unnecessary requests and improve performance. 5. Run Promises in Parallel – Execute multiple async tasks efficiently using `Promise.all()`. 6. Use Environment Variables (.env) – Store and secure configuration data effectively. 7. Handle Uncaught Errors Gracefully – Use `process.on()` to manage runtime exceptions. 8. Avoid Blocking the Event Loop – Always prefer asynchronous functions for I/O operations. 9. Use Streams for Large Files – Process large data efficiently without consuming excess memory. 10. Use OS Module for System Information – Fetch system-level data like CPU, memory, and uptime. 11. Scale Apps Using Cluster Module – Utilize multiple CPU cores to improve app scalability. 12. Cache API Responses for Performance – Use Redis or in-memory caching for faster results. 13. Create a Custom Logger – Implement structured logging for better debugging and monitoring. Mastering these tips will help you build scalable, reliable, and high-performing Node.js applications. #NodeJS #BackendDevelopment #JavaScript #CodingTips #Developers #WebDevelopment #TechInsights #CleanCode #Programming #KreatorzCo #KreatorzFamily
To view or add a comment, sign in
-
✨ A small personal win — but a big moment for me as a developer. For a long time, I wanted to build my own npm package. Nothing huge… just something useful — something I could proudly say: “I built this.” While working on multiple React projects, I kept fighting with the same issues: 1.messy fetch logic 2.repeated loading/error states 3.caching not behaving the way I wanted 4.retry logic 5.token refresh problems 6.too much boilerplate everywhere At some point I asked myself: “Why am I rewriting the same logic in every project? Let me turn this into a proper reusable hook.” So… I finally did it. 🚀 Introducing my first npm package: use-fetch-smart A lightweight React hook for smart data fetching — with caching, TTL, retries, token refresh, and instant cached responses. GitHub Repo: (in comments) npm: (in comments) 🔧 What it comes with ⚡ Smart caching + configurable TTL 🔁 Retry logic 🔐 Auto token refresh 🎯 Simple mutation API 🚀 Instant cached responses 🧽 Cleaner code, less boilerplate This is my first ever published package, and I know it’s not perfect. That’s actually why I’m sharing it. I want feedback. I want criticism. I want to know what breaks, what confuses you, what can be improved. Open-source is all about learning publicly — so here I am, starting small but starting somewhere. If you’re a React dev, I’d genuinely love if you try it out and share your thoughts. Even a single suggestion will help me grow and make this tool better. 🙏 Here’s to building, shipping, learning, and improving — one step at a time. 💛 #reactjs #npm #opensource #javascript #webdevelopment #frontend
To view or add a comment, sign in
-
-
I finally implemented Socket.IO into my MERN stack project, and the improvement in user experience is significant! Building a collaborative Kanban board required quick changes, and this framework provided actual real-time synchronisation. THE CHALLENGE: Moving beyond typical RESTful APIs to automatically synchronise task changes across numerous users. The Socket.IO process: Setup: I enabled Socket.IO on my Node/Express backend. Action: Following a successful database update, I called io.emit('taskUpdated', updatedTask) from the controller. Listen: On the frontend, I subscribed to socket.on('taskUpdated', fetchTasks). The result is a board where dragging or modifying a task updates every connected user almost quickly! ⚠️ VERCEL CAVEAT: I quickly learned Vercel serverless functions don't support persistent WebSockets, forcing me to temporarily rely on a polling fallback. That's the next technical hurdle! #SocketIO #WebSockets #RealTime #MERNStack #React #NodeJS #FullStackDevelopment #CodeJourney #SoftwareEngineering
To view or add a comment, sign in
-
Two weeks ago, we announced BrowserPod, a browser-based container technology that can run Node.js, Python and Rails full-stack environments in browser. We just dropped a brand new live interactive demo for BrowserPod, and it’s fast. Try running a full Vite/Svelte development environment right now, entirely in your browser. https://lnkd.in/exZ68NxF BrowserPod containers (Pods) run completely client-side, delivering quasi-native performance and are powered by a full network stack. Every Pod has a Portal, a unique public HTTPS endpoint that exposes the environment to the internet, perfect for cross-device testing or sharing test URLs with clients. We’re on track for the initial general release in late November. I'm beyond excited for this new technology, and its applications to in-browser development, agentic coding, and educational platforms.
We’re excited to introduce BrowserPod, a WebAssembly-based, in-browser container technology that runs full-stack development environments across multiple languages. BrowserPod is a generalised, more powerful alternative to WebContainers, with advanced networking capabilities and flexible multi-runtime support. Containers, called Pods, run completely client-side. BrowserPod is conceptually similar to WebContainers, but is designed from the ground up to be language-agnostic, to support inbound networking, and to be integrated within the Leaning Technologies ecosystem. BrowserPod will be released in late November, with an initial focus on Node.js environments and a well-defined path to support additional stacks, with Python and Ruby as immediate priorities. Find out more: https://lnkd.in/eTpSZuSZ
To view or add a comment, sign in
-
Most developers scale Node.js the wrong way. They throw more RAM at the problem. They upgrade server instances. They pray it works. But here's what I learned after debugging production crashes at 3 AM: "True Node.js scaling is not increasing RAM it's reducing synchronous code paths." Let me break this down: ❌ What DOESN'T scale: → Blocking I/O operations → Heavy synchronous loops → CPU-intensive tasks in the main thread → Unoptimized middleware chains ✅ What DOES scale: → Async/await patterns everywhere → Worker threads for CPU-heavy tasks → Stream processing over bulk loading → Non-blocking database queries The bottleneck isn't your hardware. It's your code architecture. I refactored a service using these principles: - Response time: 800ms → 120ms - Memory usage: Down 40% - Same infrastructure cost What's your biggest Node.js performance challenge? #NodeJS #JavaScript #WebDevelopment #BackendDevelopment #FullStackDevelopment #PerformanceOptimization #ScalableArchitecture #NodeJS #JavaScript #FullStack #PerformanceOptimization #BackendDev #WebDev #CodingTips
To view or add a comment, sign in
-
Cheat sheets save hours. Smart devs use them daily. 🧾 Top Sheets: Frontend (HTML/CSS) JavaScript (array, promises) Backend (Express routes) Database (MongoDB/SQL) DevOps (Git/Docker) 💡 “Don’t memorize. Strategize.” 📊 Status: Building public GitHub repo for free cheat sheets. 🔖 Hashtags: #CheatSheets #LearningResources #DeveloperTools
To view or add a comment, sign in
-
-
Node.js Professional Project Structure Setup Organized my Node.js environment into a production-ready structure to follow scalable backend architecture. This setup includes: • Modular folders for controllers, models, routes, middlewares, and utilities • Dedicated configuration files for environment variables, constants, and database connections • Cleaner code formatting managed with Prettier and .gitignore for version control • A structure that aligns with enterprise-level Node.js project patterns Learning to structure code professionally is as important as writing the logic itself. A clear, modular setup improves maintainability, readability, and teamwork efficiency. Ustad: Chai Aur Code #NodeJS #BackendDevelopment #CleanCode #ProjectStructure #WebDevelopment #CodingJourney #JavaScript
To view or add a comment, sign in
-
-
💡 Node.js Best Practices that Every Developer should Follow As you grow as a backend developer, writing working code isn’t enough — you need to write maintainable, scalable, and secure code. Here are some best practices. 1️⃣ Use Environment Variables (Never Hardcode Secrets) Sensitive data like API keys, tokens, and passwords should always be stored in .env files and accessed via process.env. 2️⃣ Structure Your Project Logically Organize your code by modules — controllers, services, routes, and utils. A well-structured project is easier to debug and scale. 3️⃣ Implement Centralized Error Handling Instead of handling errors everywhere, create a global error handler. It keeps your code clean and helps log issues consistently. 4️⃣ Add Proper Logging (Winston / Pino) Logs are your best friend in production. Structured logging makes debugging and monitoring significantly easier. 5️⃣ Use Async/Await — and Handle Promises Properly Uncaught promises can crash your app. Always wrap them in try/catch blocks or use .catch() handlers. 6️⃣ Validate Input Data Never trust user input. Use libraries like Joi or Zod to validate and sanitize incoming data before processing it. 7️⃣ Implement Security Headers & Rate Limiting Use helmet and express-rate-limit to protect your APIs from common attacks. Security should never be optional. 8️⃣ Write Modular and Reusable Code Break large functions into smaller, testable pieces. Reusability is key to reducing bugs and improving maintainability. 9️⃣ Use Caching Strategically For heavy APIs or repetitive queries, use Redis or in-memory caching to reduce response times and server load. 🔟 Monitor & Optimize Performance Use tools like PM2 or New Relic to track memory usage, event loop delays, and API performance metrics. 👨💻 I’ve applied these principles across multiple Node.js and NestJS projects — and they’ve consistently improved performance, reliability, and developer productivity. #NodeJS #BackendDevelopment #CleanCode #JavaScript #NestJS #WebDevelopment #APIDesign #ErrorHandling #ScalableSystems #AsyncAwait #Performance #SoftwareEngineering #DeveloperTips #ServerOptimization #DailyDevPost #NodeBestPractices
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development