Building the MyZubster Metaverse: From Prototype to Secure Realtime Infrastructure
The MyZubster Metaverse is evolving from a simple interactive experience into a distributed platform designed around secure identity, realtime communication, reliability, privacy, and verifiable collaboration.
During the latest development phase, we focused on the infrastructure required to operate the metaverse safely under real production conditions.
This article explains what we implemented, how the architecture works, what we verified, and what remains before the system can be considered production-ready.
The Current Architecture
The metaverse now follows a layered architecture:
Authenticated user
↓
MyZubster session
↓
Short-lived realtime token
↓
Authorized realtime channel
↓
Distributed gateway
↓
Redis coordination layer
↓
Presence, rate limits and observability
The objective is to prevent clients from connecting directly to unrestricted realtime resources.
Every connection must originate from an authenticated MyZubster session and receive only the permissions required for its specific room or operation.
Authenticated Realtime Sessions
We introduced a dedicated token exchange for realtime connections.
The server:
- verifies the current MyZubster session;
- checks whether the user may access the requested resource;
- generates a short-lived realtime token;
- restricts that token to authorized channels;
- rejects anonymous or malformed requests.
This limits the damage caused by leaked tokens and prevents clients from subscribing to arbitrary rooms.
A client cannot simply invent a room identifier and connect to it. Authorization is evaluated server-side before realtime access is granted.
Channel Authorization
Realtime channels are treated as protected resources.
The authorization layer validates:
- user identity;
- session validity;
- resource ownership;
- room membership;
- token expiration;
- permitted operations.
This establishes a clear trust boundary between the browser and the realtime gateway.
The client requests access, but the server remains responsible for deciding whether that access is legitimate.
Distributed Presence with Redis
In-memory presence works only while a single application instance is running. It becomes unreliable when multiple instances or serverless functions are involved.
We therefore introduced Redis-backed presence coordination.
Redis is used to track:
- active participants;
- room membership;
- temporary presence state;
- expiration of abandoned sessions;
- coordination between separate gateway instances.
Presence entries have a limited lifetime. If a client disappears without completing a normal disconnection, the corresponding state can expire automatically instead of remaining indefinitely.
Graceful Redis Failure Handling
Redis is now considered an explicit infrastructure dependency.
The system distinguishes between:
- the application process being alive;
- the realtime gateway being operational;
- Redis being reachable;
- the complete service being ready to accept traffic.
Failures are handled deliberately rather than silently ignored. This is important because returning a successful health response while the coordination layer is unavailable would provide misleading information to deployment systems and operators.
Distributed Rate Limiting
Local counters cannot reliably enforce limits across multiple runtime instances.
We implemented a distributed rate-limiting foundation backed by Redis so that requests are evaluated against shared state.
The rate-limiting system is designed to protect:
- realtime token generation;
- connection attempts;
- room joins;
- message publication;
- presence updates;
- abuse-sensitive API routes.
This provides a foundation for defending the metaverse against spam, accidental request loops and automated abuse.
Future work will refine quotas by route, identity, IP risk and operation type.
Privacy-Safe Observability
Reliability requires visibility, but observability must not expose private user information.
The realtime infrastructure now supports structured operational signals for:
- authorization failures;
- connection lifecycle events;
- Redis availability;
- rate-limit decisions;
- degraded states;
- health and readiness checks.
The goal is to make infrastructure problems diagnosable without logging raw credentials, session tokens or unnecessary personal information.
Health and Readiness Endpoints
A process being alive does not mean it is ready to serve realtime traffic.
We extended the health model to include Redis readiness. The service can now report a degraded state when Redis is unavailable instead of returning an unconditional success response.
Conceptually:
Process alive + Redis unavailable ↓
Service is not fully ready
↓
Health response reports degradation
This distinction is essential for:
- deployment validation;
- load balancers;
- automated monitoring;
- incident diagnosis;
- rolling releases;
- recovery procedures.
Shared Redis Client
A reusable Redis client layer was introduced to avoid creating duplicated connections across services and requests.
The shared client centralizes:
- configuration;
- connection reuse;
- error handling;
- readiness checks;
- shutdown behavior;
- instrumentation.
Centralizing this behavior reduces connection pressure and gives every Redis-dependent feature a consistent operational model.
Preview Infrastructure
The new realtime changes were deployed to an isolated Vercel Preview environment.
This allows us to validate infrastructure modifications before they affect the public production deployment.
The preview environment provides a safe place to test:
- application builds;
- serverless deployment behavior;
- environment configuration;
- readiness responses;
- Redis connectivity;
- authentication flows;
- realtime regressions.
Production remains unchanged while the current pull request is still under review.
Testing and Continuous Integration
The implementation is covered by automated backend tests, including readiness behavior and Redis degradation scenarios.
The principal validation pipeline successfully completed:
- backend tests;
- frontend tests;
- linting;
- application builds;
- Seller Free policy verification;
- continuous evidence generation;
- preview deployment.
This provides strong evidence that the new infrastructure integrates correctly with the existing application.
However, passing tests alone do not make the service production-ready. Runtime drills, dependency remediation and real multi-instance load testing are still required.
Current Development Status
The realtime readiness work is currently available in a draft pull request:
MyZubster realtime readiness PR #40
The implementation includes four focused commits:
feat(realtime): expose Redis readiness
test(realtime): cover Redis readiness
feat(realtime): gate health on Redis
test(realtime): cover Redis health degradation
Keeping the commits focused makes review and rollback easier.
Current Security Blocker
The security audit currently reports vulnerabilities in the transitive ip-address dependency for versions up to 10.7.3.
The available patched version is 10.7.4.
Before merging the realtime work, we need to:
- identify which direct dependency introduces ip-address;
- update the dependency chain safely;
- regenerate the lockfile;
- run the complete test suite;
- repeat the security audit;
- confirm that no high or critical vulnerability remains.
The pull request should remain in draft until this has been addressed and the runtime verification has been completed.
What Still Needs to Be Done
- Dependency remediation
Upgrade the affected dependency chain and obtain a clean security audit.
- Direct runtime verification
Verify the deployed preview response from:
/api/realtime/health
The response should explicitly show whether Redis is ready and whether the service is operating normally or in a degraded state.
- Redis failure drill
Temporarily simulate Redis unavailability in an isolated environment and verify that:
- readiness fails correctly;
- the service does not claim to be healthy;
- errors remain controlled;
- recovery occurs after Redis reconnects.
- Multi-instance load testing
Run concurrent tests against multiple gateway instances and verify:
- shared rate limits;
- consistent presence;
- room synchronization;
- connection cleanup;
- acceptable latency;
- stable Redis connection usage.
- Restart and recovery testing
Restart application and Redis instances while clients are connected.
We need evidence that the platform can recover without leaving permanent ghost sessions or inconsistent presence records.
- End-to-end acceptance testing
The complete flow must be tested:
Login
→ request realtime token
→ authorize channel
→ connect
→ join room
→ publish event
→ update presence
→ disconnect
→ clean up state
Unauthorized variations must also be tested.
- Production rollout strategy
The production release should be gradual:
- deploy to Preview;
- complete runtime verification;
- run load and failure drills;
- review monitoring signals;
- merge after approval;
- deploy production;
- observe error rates and Redis health;
- retain a documented rollback procedure.
Longer-Term Metaverse Roadmap
Once reliability and security are validated, development can move toward the experience layer.
Planned areas include:
- WebXR support;
- immersive rooms;
- interactive avatars;
- spatial collaboration;
- verified professional profiles;
- Zorgax integration;
- verified knowledge inside virtual environments;
- community-managed spaces;
- portable identity;
- privacy-safe analytics;
- independent interoperable nodes.
The long-term objective is not merely to build another virtual world.
MyZubster aims to combine identity, knowledge, collaboration and transparent open-source development inside an interoperable environment.
Lessons Learned
The most important lesson from this phase is that realtime development is not simply about sending messages quickly.
A reliable realtime platform must answer several harder questions:
- Who is allowed to connect?
- Which channels may they access?
- How is state shared across instances?
- What happens when Redis fails?
- How is abuse limited globally?
- Can operators distinguish “alive” from “ready”?
- Can the system recover cleanly after a restart?
- Can failures be investigated without exposing private data?
These concerns are now becoming first-class parts of the MyZubster architecture.
Conclusion
The MyZubster Metaverse has progressed beyond an isolated prototype.
We now have the foundation for:
- authenticated realtime access;
- server-controlled channel authorization;
- Redis-backed presence;
- distributed rate limiting;
- privacy-aware observability;
- dependency-aware health checks;
- isolated preview deployments;
- automated tests and evidence generation.
The next milestone is to prove that this architecture remains reliable under dependency failures, restarts, concurrency and realistic traffic.
Only after those checks—and after resolving the current security advisory—should the realtime infrastructure be promoted to production.
MyZubster remains an open-source project, and technical review, testing and constructive contributions are welcome.
Project Links
- MyZubster repository
- MyZubster Metaverse
- Realtime readiness pull request
Repository GitHub: https://github.com/danieldirimini-myzubster/myzubster
Metaverso MyZubster: https://www.myzubster.com/metaverse
Pull request Realtime Readiness #40: https://github.com/danieldirimini-myzubster/myzubster/pull/40
Roadmap Linear MYZ-83: https://linear.app/myzubster/issue/MYZ-83/b6-realtime-observability-reliability-and-load-tests
Organizzazione GitHub MyZubster Ecosystem: https://github.com/MyZubster-Ecosystem
Profilo GitHub MyZubster: https://github.com/myzubster
Sito principale: https://www.myzubster.com
Knowledge Explorer: https://www.myzubster.com/knowledge
Profilo Zorgax: https://www.myzubster.com/zorgax-profile-onboarding