NexoWorld is a location-based mobile game that blends the real and digital worlds. Players walk real streets with their phone to discover collectibles, complete quests, and earn an in-app currency they can spend and trade — all powered by a distributed microservices backend built for real-time play.
The idea#
Games like Pokémon Go proved that people will happily walk around a city if the map on their phone gives them a reason to. NexoWorld takes that loop further with two additions: a real in-app economy, where what you find has value you can trade with other players, and social challenges that turn exploration into something you do with others rather than alone.
That combination changes the engineering problem. A location game is read-heavy and latency-sensitive; an economy is write-heavy and correctness-sensitive. The architecture has to serve both without letting one compromise the other.
What it does#
- Location-based gameplay — players explore real-world locations to unlock content, trigger events and complete quests
- In-app economy — earn, spend and trade digital currency through challenges and marketplace transactions
- Real-time updates — player positions and nearby events stay in sync through WebSocket connections
- Push notifications — personalized offers and quest alerts based on player activity and location
- Cross-platform — one Flutter codebase for Android and iOS
Architecture#
Each functional domain runs as an independent service with its own data store, behind a single gateway:
| Service | Responsibility | Stack |
|---|---|---|
| API Gateway | Authentication, routing, rate limiting | Spring Boot |
| Game Service | Location events, quests, collectibles | Spring Boot + PostGIS |
| Currency Service | Wallets, transactions, trading | Spring Boot + MongoDB |
| Notification Service | Push alerts and offers | Node.js + Firebase |
Flutter app (Android / iOS)
│ REST + WebSocket
▼
API Gateway (Spring Boot)
├── Game Service → PostGIS (spatial) + MongoDB
├── Currency Service → MongoDB + Redis
└── Notification Svc → Firebase Cloud Messaging
│
Kafka (async events between services)Services talk to each other asynchronously through Kafka topics rather than calling each other directly. Redis caches hot player data and leaderboards, and PostGIS answers every spatial question. Everything is containerized with Docker and deployed on Kubernetes.
Key challenges#
Spatial queries at game speed#
The question a location game asks most often is "what is near this player right now?" — and it asks it continuously, for every active player. Done naively in application code, that means loading far too many points and measuring distances in a loop.
PostGIS moves that work into the database, where spatial indexes answer radius and geofence queries directly: nearby collectibles, events whose zone a player just entered, players close enough to interact. The game service asks a spatial question and gets back only what matters for that position.
Keeping the economy consistent#
Currency is where bugs cost players something real. A duplicated reward or a trade that debits one wallet without crediting the other breaks trust in the whole game.
The currency service owns wallets and transactions exclusively — no other service writes balances. When the game service decides a player earned something, it publishes an event to Kafka, and the currency service applies it. That keeps the rules for money in one place, and lets gameplay keep moving even if the currency service is momentarily slower.
Decoupling with events#
Direct service-to-service calls would have chained the game's availability to every service it touches. With Kafka in the middle, a quest completion is a single event that the currency service, the notification service and any future consumer can each react to independently. Adding a new reaction — an achievement system, analytics — means adding a consumer, not editing the game service.
Scaling for spikes#
Player traffic is spiky by nature: evenings, weekends, and any live event. Running on Kubernetes lets each service scale horizontally on its own load, so a rush of players exploring at once scales the game service without paying to scale the currency service alongside it.
One codebase, two platforms#
Flutter keeps the Android and iOS apps on a single codebase, which matters for a game: map behaviour, quest rules and UI have to feel identical on both platforms, and fixing a bug once beats fixing it twice.
Stack#
| Layer | Technologies |
|---|---|
| Mobile | Flutter (Dart), maps SDK |
| Backend | Spring Boot, Node.js, Apache Kafka |
| Data | PostGIS (PostgreSQL), MongoDB, Redis |
| Infrastructure | Docker, Kubernetes |
Results#
- Real-time location sync with sub-200ms latency
- Horizontal scaling through Kubernetes absorbs traffic spikes without manual intervention
- A single Flutter codebase ships to both Android and iOS
- Service boundaries let gameplay, economy and notifications evolve independently
Team#
Built with Abdelmajid ZADDI, Loukmane ADHAIM and Abdelaziz AFRIAD. The code lives in the NexoWorld GitHub organization.
