DEV Community

Cover image for Solving Server Persistence in IoT Projects with VM, NGINX & Certbot — My Alpha Connect Hub Journey
Hassam Fathe Muhammad
Hassam Fathe Muhammad

Posted on

Solving Server Persistence in IoT Projects with VM, NGINX & Certbot — My Alpha Connect Hub Journey

🚀 Why Server Persistence Matters in IoT

One of the efficient and active improvements I made to Alpha Connect Hub—my IoT monitoring and logging project—was achieving consistent and longer sessions for data collection.

An IoT app isn’t just about writing correct code—it’s about ensuring the server stays alive.

Consider this:

If I deploy a backend that handles WebSocket connections and REST API requests, but users stop hitting the API, then servers deployed on platforms like CaaS (Container as a Service) may go idle and shut down.

➡️ Result? Data receiving and storage get suspended.

➡️ For IoT platforms, that’s unacceptable.


🖥️ The Solution: Virtual Machines

The servers that keep their state consistent and persistent are properly configured VMs running through cloud providers.

In my case, I used AWS EC2 VM instances, and this step pushed me closer to the DevOps world.

The setup included:

  • 🖥️ Server provisioning (VM)
  • ⚙️ Process management (PM2)
  • 🌐 Web server & reverse proxy (NGINX)
  • 🔐 SSL/TLS setup (Certbot)
  • 🧠 Infrastructure understanding (Cloudflare DNS, public access)

🌐 My First Encounter with Cross-Domain Issues

Back when Alpha Connect Hub started as a university assignment, I deployed the backend on a Google Cloud Console VM.

But then I hit a problem:

  • If your backend is on one domain and frontend (like Vercel, Netlify) is on another—you can’t set cookies directly.
  • To fix this, you need them under the same domain or a subdomain.

And for WebSocket connections, you also need HTTPS-to-HTTPS communication.

Since Node.js defaults to HTTP, I had to configure:

  1. A registered domain
  2. SSL/TLS via Certbot
  3. NGINX as a reverse proxy to enforce HTTPS

🔑 What I Learned

Looking back, if I hadn’t built an IoT platform, I might have never understood:

  • The importance of VMs for server persistence
  • How basic networking & post-configuration are essential beyond just writing code
  • The connection between IoT apps, chat apps, online transaction systems, dashboards, and stateful server management

This was also the point where I started appreciating the Linux Kernel-based Ubuntu VMs, and got more curious about Operating Systems at a deeper level.


🎯 Final Thoughts

IoT apps aren’t just about sensors and dashboards—they’re about infrastructure that never sleeps.

VMs, NGINX, and SSL weren’t just tools for me; they were the bridge that turned Alpha Connect Hub from a semester project into a real-world system.


💬 Let’s Connect

I’d love to hear your thoughts—have you faced server persistence issues in IoT or real-time systems? How did you solve them?

Drop your experiences or questions below! 👇


Top comments (0)