dtheoDimitris Theodoropoulos
All work

Cordia Health

Cordia Health connects people living with heart conditions and their caregivers for peer support, shared experiences and private conversations.

My role
Founding engineer
Released on
iOS & Android

Community discovery: a shared condition and a few lines of someone’s story give people a reason to say hello. Captured from the app running locally on fictional demo data. View full image

Private messaging: people carry on one to one after meeting in the community. The members and messages shown are invented. View full image

What I built

As founding engineer, I built the React Native app and its Supabase backend, from authentication and community features to private messaging and store releases. The app serves people living with heart conditions and the caregivers supporting them.

Community, conversation, and trust

The product connects people through shared experiences, then lets them continue in private conversations. I built the community and real-time messaging flows, including saved history and live updates.

For interrupted connections, I added an on-device message queue that preserves pending messages and reuses their IDs on retries. I also implemented authenticated access checks and server-side encryption for selected sensitive fields. Authorized backend functions can decrypt them.

What shipped

Cordia is available on iOS and Android. The message-recovery work is tested and its server changes are live; inclusion of the mobile changes in a store release is not yet confirmed.

Engineering deep dive: Recovering messages after interrupted saves

Recovering messages after interrupted saves

I save pending messages on the phone before sending them, reuse the same ID on retries, and keep delayed responses tied to the right account.

A message is saved on the phone before it is sent. The API checks the sender and conversation participants, then PostgreSQL saves the message or returns the existing row for the same conversation and message ID. If the response is lost, the app retries that ID. A separate private channel sends live updates to the conversation; history requests recover missed updates.
  1. On device

    Pending messages

    Save on the phone before sending. Keep until confirmed.

    SecureStore · two storage slots

  2. Send request

    Use the same account and message ID on each retry.

    account check · stable message ID

  3. Authenticated backend

    Authenticated API

    Check identity and participants. Encrypt the message.

    server-side field encryption

  4. PostgreSQL

    Message storage

    Save the message, or return the saved row for a retry.

    unique conversation + message ID

  5. Separate live updates

    Live updates

    Send updates over private channels for participants.

    separate from saving the message

  6. On device · reading

    Conversation state

    Combine live updates with saved message history.

    ignore old-account responses

Engineering decisions

  1. Save before sending

    I write the complete replacement queue into a second storage slot, then make that copy active. If saving is interrupted, the previous queue stays readable.

  2. Keep responses with the right account

    Each request keeps its starting account. I check it again before updating conversation state, so a delayed response cannot restore the previous account’s conversations.

  3. Keep the same message ID

    I use a database uniqueness rule for the conversation and message ID together. After a lost response, a retry returns the already saved message.

When a message is saved but the response is lost

  1. Server saves the message

    The message already exists in the database.

  2. Response is lost

    The phone keeps the message pending.

  3. Retry the same ID

    The API returns the saved message.

  4. Clear the pending message

    The phone records the confirmation and removes it from the queue.

How I checked it

Tests cover interrupted saves, lost responses, and account changes. Native storage tests check recovery after a restart. The server changes are live; the mobile changes are tested but not yet confirmed in a store release.

Tradeoff

Keeping unsent text after logout helps users recover it later. It also means managing how long it stays on the device and which account can access it.

Further engineering details

Checking access before reading or saving private data

I removed direct access to private profile columns and direct story writes. Story creation goes through an authenticated API that checks whether the signed-in user owns the linked condition record. The server sets the owner, encrypts the story, and saves it.

I deployed the API update before restricting database writes, and checked the expected permissions before applying them. Existing encrypted data stays readable. Profile lookups check whether either person has blocked the other, while abuse reporting remains available.

Checking usernames without decrypting profiles

I encrypted selected profile fields with AES-GCM and a fresh random initialization vector for each write. The same username therefore does not produce the same ciphertext, so ciphertext cannot be used to check whether it is taken.

I convert usernames to a consistent comparison form and calculate a keyed HMAC-SHA-256 fingerprint, also called a blind index. A unique database index checks that fingerprint without decrypting profiles. The lookup secret is separate from the encryption key.

This supports exact-match username checks alongside randomized encryption. The fingerprint reveals when values are equal. Backend functions can still decrypt the fields, so this is server-side encryption rather than end-to-end encryption.

Next projectJobNRoll

Let’s talk.

Tell me what you’re building or what you’re trying to figure out. I’d be happy to talk it through.