The beginning: What if the internet suddenly disappeared?
Imagine this situation.
A disaster has affected a remote area. Internet connectivity is unreliable. A rescue team needs to communicate important information with another team, but the network keeps disconnecting.
Or imagine a rural clinic that has internet access only occasionally. It still needs to exchange information with another location, even when the connection is unavailable.
Most modern applications assume that a server is reachable whenever a user wants to send something. When that connection disappears, communication usually stops.
That made me think about a different question:
What if messages didn't need the internet to be available at the exact moment they were created?
What if a device could store a message locally, wait until another device became reachable, and then deliver it?
That question became the starting point for my project, RelayMesh.
GitHub: https://github.com/nandakumar2k794/relayMesh
The inspiration: An idea from the past
While exploring the problem, I came across two interesting networking systems: UUCP (Unix-to-Unix Copy) and FidoNet.
These systems existed long before today's always-connected internet became normal.
Their machines did not need to stay connected all the time. Instead, they stored messages locally and exchanged them with neighboring machines when a connection became available.
A message could travel from one machine to another, eventually reaching a distant destination through multiple exchanges.
I found this idea fascinating.
We have modern hardware, faster processors, better storage, and powerful programming tools. But the fundamental problem of unreliable connectivity still exists in many environments.
So I wanted to explore whether the old store-and-forward philosophy could be rebuilt using modern technologies.
That is how I arrived at the name RelayMesh.
The goal wasn't to recreate UUCP or FidoNet. It was to take inspiration from their approach and build a modern foundation around it.
What exactly is RelayMesh?
RelayMesh is an offline-first, store-and-forward messaging foundation designed for networks where connectivity is unreliable or intermittent.
Instead of requiring every node to communicate in real time, each node maintains its own identity, database, and message queues.
Here is the basic idea:
- An application creates a message on its local node.
- The relay agent stores that message in a persistent SQLite database.
- The message waits in an outgoing queue.
- When a configured neighboring node is reachable, the sender attempts delivery.
- The receiving node validates and stores the message.
- The receiver returns a hop receipt.
- The sender records the receipt and updates its outgoing message state.
If the connection fails, the sender doesn't simply discard the message. It retries according to its backoff policy.
In simple terms:
Store first. Forward when possible. Recover when things fail.
How I approached building it with Kiro
For this project, I used Kiro IDE and followed a specification-driven development approach.
One thing I learned during this process is that starting to code immediately isn't always the best approach, especially when the project has multiple components and failure scenarios.
I first worked on defining what RelayMesh should do and what it should deliberately avoid doing in the initial version.
I organized the development around:
-
product.md— the product idea, problem, and intended users. -
architecture.md— the components and how they communicate. -
coding-standards.md— the rules and conventions for implementation. - Requirements, design, and implementation tasks — to break the project into manageable pieces.
This helped me avoid building everything at once.
I worked through the tasks incrementally, reviewed the implementation, ran tests, and moved to the next part only after validating the previous work.
Kiro was part of the development process, but I also had to make engineering decisions, inspect failures, understand the generated changes, and verify the behavior.
The project became much more interesting once I moved beyond the basic message-sending functionality.
The architecture: Two main layers
I divided the implementation into two major parts.
1. RelayMesh Core
The core package is responsible for the fundamental building blocks.
It includes:
- Protocol schemas and validation.
- Node identity and key-file handling.
- Message and Bundle operations.
- SQLite-based persistent storage.
- Incoming and outgoing queues.
- Delivery receipts and forwarding history.
Each node has its own identity and database.
This is important because one node should not depend on another node's local database to function.
2. Relay Agent
The relay agent is the process that actually communicates with neighboring nodes.
It provides three main HTTP endpoints:
| Endpoint | Purpose |
|---|---|
POST /messages | Create and queue a local message |
POST /bundles | Receive a Bundle from a neighboring agent |
GET /status | Inspect node status and queue information |
The agent also contains the sender loop, HTTP transport, outcome ledger, recovery logic, and shutdown coordinator.
I used TypeScript, Node.js, Fastify, SQLite through better-sqlite3, Zod, and Vitest.
The current implementation uses HTTP and JSON for communication.
The interesting part: What happens when something fails?
Initially, I thought sending a message from one node to another would be the main challenge.
I was wrong.
The difficult part was making sure the system behaved correctly when failures happened at inconvenient moments.
Challenge 1: What if the receiver stores a message but the sender never gets the receipt?
Consider this sequence:
- Node A sends a Bundle to Node B.
- Node B successfully stores it.
- Node B creates a receipt.
- But the response is lost because the connection fails.
What should Node A do?
It cannot safely assume that delivery failed. Node B may already have stored the message.
If A sends the same message again, B must not create another copy.
I implemented duplicate detection and idempotent receipt handling so that a repeated Bundle can be recognized and answered using the existing receipt.
This was one of the important reliability problems I wanted to solve.
Challenge 2: What if the process crashes during delivery?
A process can crash while a message is in flight.
It can also crash after receiving a valid receipt but before completing all the local database updates.
That creates a dangerous situation.
If the agent blindly resets every unfinished message and sends it again, it might repeat work that has already succeeded at the receiving node.
To handle this, I implemented an outcome ledger and guarded recovery mechanism.
The system tracks the separate steps required to settle a delivery. During startup, it checks persistent state and existing receipts before deciding whether an interrupted message can safely be retried.
This was a particularly interesting part of the implementation because it forced me to think beyond the normal success path.
Challenge 3: What happens when shutdown occurs during an active send?
I also worked on controlled shutdown behavior.
The agent must stop scheduling new work, allow active operations to settle within a time budget, and avoid closing storage while important work is still in progress.
This required a shutdown coordinator and tests for different failure scenarios.
It taught me that reliability is not only about what happens while an application is running. It is also about what happens when it stops.
Testing with two real relay agents
I didn't want to depend only on mocked functions to demonstrate the basic communication flow.
I built integration tests that run two actual relay-agent instances.
Each agent has:
- Its own node identity.
- Its own SQLite database.
- Its own HTTP server.
- Its own configuration.
- Its own incoming and outgoing queues.
The two agents communicate over HTTP.
The integration tests cover:
- Basic message delivery.
- Receiver unavailability and retry.
- Duplicate message handling.
- HTTP failures and timeouts.
- Storage failures during receipt persistence.
- Settlement failures.
- Restart recovery.
- Protected in-flight messages.
- Crash and recovery scenarios.
The goal was to test not just whether a message could be sent, but whether the system could handle interruptions without losing its persistent state or blindly duplicating work.
What I managed to complete
At the end of the required implementation tasks, RelayMesh had:
- A reusable core package for protocol, identity, and storage.
- An HTTP-based relay agent.
- Persistent incoming and outgoing message queues.
- Priority-ordered delivery.
- Retry with exponential backoff.
- Duplicate-safe receiving.
- Hop receipts and delivery settlement.
- Startup recovery and guarded in-flight recovery.
- Controlled shutdown behavior.
- Two-agent integration and reliability tests.
- Root and operator documentation.
The final root test suite passed 818 tests across 48 test files.
I also ran the complete validation sequence three consecutive times. Each sequence included the core build, typechecking, tests, and the root build, with every command succeeding.
That was a satisfying milestone after spending so much time working through edge cases.
An honest look at the current limitations
I think it is important to explain what RelayMesh does not do yet.
The current implementation is an early foundation, not a finished communication platform.
At this stage:
- Communication is HTTP with JSON only.
- Delivery is limited to directly connected neighboring nodes.
- Multi-hop forwarding is not implemented.
- End-to-end delivery confirmation is not implemented.
- A hop receipt confirms that the next node stored the Bundle; it does not confirm that the final destination processed it.
- Incoming messages remain pending for a future application-level consumer.
- Signing, encryption, and peer authentication are not implemented in the delivery flow.
- The disaster-response application is currently a placeholder.
- The network simulator and dashboard are future work.
I deliberately kept the initial implementation within a limited scope instead of claiming to have solved every part of offline networking.
There is still plenty of work ahead.
What I learned from this project
This project taught me a few things that I probably wouldn't have learned by building another straightforward CRUD application.
1. The happy path is only the beginning.
Sending a message successfully is easy to demonstrate. Handling crashes, timeouts, duplicate requests, and partial database failures is much harder.
2. Persistent state needs careful reasoning.
A database record isn't just data. During recovery, its state helps determine what the application is allowed to do next.
3. Testing should cover failure scenarios too.
I learned to think about what happens when one operation succeeds and the next one fails, rather than testing only complete success or complete failure.
4. Breaking work into specifications and tasks helps.
Using Kiro's specification-driven workflow made a large implementation easier to approach step by step.
5. Knowing what not to build is also important.
Keeping multi-hop routing, encryption, the simulator, and the application UI outside the initial scope helped me concentrate on getting the direct-delivery foundation right.
What's next for RelayMesh?
There are several directions I would like to explore:
- Multi-hop forwarding and routing.
- Authenticated nodes and secure message exchange.
- Signed and encrypted Bundles.
- A network simulator for controlling connectivity.
- A dashboard to observe message movement and queue states.
- A disaster-response application built on top of the relay infrastructure.
These are future directions, not features of the current implementation.
Final thoughts
When I started RelayMesh, I was interested in an old networking idea: messages should be able to travel even when machines are not continuously connected.
I didn't expect the project to take me so deeply into database consistency, idempotency, retries, crash recovery, and shutdown behavior.
Building it with Kiro made the development process more structured, but the most valuable part for me was understanding why each reliability mechanism was necessary.
RelayMesh is still an early-stage project, but I am happy that I managed to turn the initial idea into a working two-agent implementation with persistent storage and failure-recovery tests.
And perhaps the most interesting thing I took away from this experience is this:
A network connection can disappear. A message shouldn't have to disappear with it.
Project links
- GitHub repository: https://github.com/nandakumar2k794/relayMesh
- Hackathon: Kiroween 2026
- Category: Resurrection
- IDE: Kiro
This project and blog post were created as part of the Kiroween 2026 Hackathon.
