Projects

Maya Wealth Group

Lead engineering for Maya Wealth Ltd: shared cloud platform, operational web and mobile companion apps across hospitality, property, and automotive businesses, in-venue hardware tools, and public marketing sites for portfolio brands.

At a glance

Role
Lead Software Engineer
Timeframe
August 2026 to present
Status
Platform live; companion apps built for rollout

Stack

  • Astro
  • Cloudflare Pages
  • Cloudflare Workers
  • Expo
  • Hono
  • Kotlin
  • React
  • React Native
  • Rust
  • Tailwind CSS
  • Tauri
  • TypeScript

Key outcomes

  • Merged pull requests103
  • Repositories in the organisation61
  • Services using the shared KV read cache21

Jump to technical deep dive

Technical deep dive

Expand a section for architecture detail, trade-offs, and evidence. Written for technical hiring managers.

Overview

Maya Wealth Group runs several hospitality and service businesses. I lead the engineering of one shared company platform behind them: a single API gateway in front of independent domain services for operations, staff, customers and content, used by staff web apps, marketing sites and mobile apps, and designed so it can later be offered to other companies as SaaS.

Problem

Each business needed its own operations tools: rotas and staff, venues, stock, tickets, customer records, quotes and billing, enquiries and marketing. Building a separate system per business would multiply cost and maintenance, while one tangled system would make every business depend on every feature. The group also wanted the option to sell the platform to other companies, which means strict separation between tenants from the start.

Solution

- Put every client behind one public API gateway that routes to private domain Workers over service bindings - Split the platform into composable domain services, each with its own repository and its own D1 database, so a project can use every service or only a subset - Built multi-tenancy into the platform: an identity service issues JWTs carrying the organisation and actor, and every service scopes its data by organisation - Added a shared KV read-through cache for authenticated reads, with D1 kept as the only source of truth - Shared JWT checks, permission maps and OpenAPI test helpers through one internal toolkit, with each service publishing its OpenAPI contract to a documentation site - Built companion apps for rollout: Expo staff apps, a guest ordering app and an offline Tauri and Rust till prototype - Deployed four brand sites built by an external company and now manage and maintain them: Picantos, The Lunar Park and Bunchies, which I also integrated with the hospitality platform, and Juice Planet

How it works: a staff app or site calls the gateway, which forwards to the right domain Worker. The Worker verifies the JWT, loads the caller's service membership, checks a permission in the form service, domain and action, serves the read from KV or D1, and returns 404 for any record that belongs to another organisation.

Architecture
WhatWhy
Entry point: One public API gateway; domain Workers have no public routes and are reached by service bindingOne place for routing and a smaller attack surface
Service boundaries: Independent domain Workers for operations, staff, customers, billing, enquiries, marketing and moreComposability: some projects need every service, others only a subset
Data ownership: One D1 database per service; the owning service is the only writer; R2 where a service stores filesClear ownership; other services go through HTTP or a documented binding
Tenancy: JWT organisation and actor from the identity service; organisation-scoped queries; cross-organisation records return 404Prepares the platform for SaaS without a database per tenant
Authorisation: Permissions checked as service, domain and action, including custom role ticks per categoryFine-grained access beyond a few fixed user types
Read cache: KV read-through cache keyed by organisation, resource, place, caller and query; writes clear the resource prefixFewer D1 reads without mixing data between tenants or callers
Contracts: Zod OpenAPI per service, published to a documentation siteClients and teammates work from generated, current contracts
Clients: React and Astro staff apps, marketing sites, Expo mobile apps, Tauri desktop till prototypeOne platform serves web, mobile and desktop
Challenges

Correcting the account structure

Problem

Each company was first given its own Cloudflare account so billing could be separated.

Why it was difficult

Cloudflare limits the number of sub-accounts, so the model could not grow with the group.

Solution

Moved all projects onto one account, keeping only externally managed projects separate, then folded everything into one company platform with tenant separation.

What I learned

Check platform limits before mapping business structure onto infrastructure.

Tenant isolation without row-level security

Problem

D1 has no row-level security, yet tenants share each service's database.

Solution

Isolation enforced in layers: JWT organisation, licence and tenant status checks, scoped queries, organisation in every cache key, 404 across organisations, and an isolation integration test per service.

Trade-offs

Isolation relies on application code rather than the database; no leak reported. Planned: encryption at rest for records, strict authorisation at site and API level, identifiers removed from URLs.

Caching tenant data safely

Problem

Caching authenticated reads risks serving one caller's data to another, or serving stale data after a write.

Solution

Designed up front from Cloudflare best-practice research, not after an incident: caller id in the key hash, prefix invalidation on writes, related resources cleared on billing writes, 60 second TTL as a backstop, no public edge caching of tenant data.

Trade-offs

The next read after a write can be briefly stale.

Decisions

One account and one company platform (corrected decision)

Alternatives

An account per company for separate billing

Why this choice

Separate accounts per company hit Cloudflare's sub-account limit; SaaS is a future option. Scales with the group and makes tenant separation the product model.

Trade-off

Billing is no longer split by account; externally managed projects stay on their own accounts for least privilege.

Composable services in separate repositories

Alternatives

One application with every feature

Why this choice

Projects need different combinations of services. Future-proofs later projects: combine all services or a subset.

Trade-off

Shared toolkit changes reach every service on its next install; version pinning is a suggested next step.

One D1 per service, application-enforced tenancy

Alternatives

Separate databases or accounts per product

Why this choice

SaaS needs tenant separation; D1 has no row-level security. One schema per service and organisation-scoped access.

Trade-off

Isolation relies on middleware, scoped queries and tests.

KV read-through cache

Alternatives

Read D1 on every request

Why this choice

Authenticated reads repeat often. Fewer database reads with safe, tenant-aware keys.

Trade-off

Brief staleness after writes; 60 second TTL backstop.

Single public gateway

Alternatives

A public hostname per service

Why this choice

Many services and many clients. One entry point; private services stay unreachable.

Trade-off

The gateway is on every request path.

Evidence
  • Merged pull requests103(GitHub, all time to 24 Nov 2026)
  • Repositories in the organisation61(GitHub, 24 Nov 2026)
  • Services using the shared KV read cache21(Architecture records, 24 Nov 2026)
Reflection

- Learned: mapping each company to its own account was a mistake once Cloudflare's sub-account limit applied; one platform with tenants fits the group and a future SaaS offer - Learned: designing caching and tenancy rules from research up front avoided learning them through incidents - Planned: encryption at rest for records, strict authorisation at site and API level, and identifiers removed from URLs to close an attack vector - Next: roll the companion apps out to restaurant team members for schedules, clock in and out and work tasks, and to managers, area managers and admins