System overview
Real estate platform for Mexico (bilingual es-MX / en-US) with PostGIS geographic capabilities. Turborepo monorepo running on Bun.
Services topology
Section titled “Services topology”graph TB
subgraph Client
Browser["Browser (SvelteKit SSR + CSR)"]
Mobile["Mobile (native iOS/Android)"]
end
subgraph Railway["Railway — kottia.com / development"]
SvelteKit["SvelteKit web app"]
API["apps/api (Hono on Bun)"]
Worker["BullMQ worker"]
Postgres["PostgreSQL + PostGIS 16"]
Valkey["Valkey (Redis-compatible)"]
Meilisearch["Meilisearch v1.9"]
imgproxy["imgproxy v3.30"]
end
Bucket["Cloudflare R2 (S3-compatible)"]
subgraph External["External"]
Resend["Resend (Email / OTP)"]
GoogleMaps["Google Maps Platform"]
Sentry["Sentry"]
Google["Google OAuth"]
Stream["GetStream (chat)"]
Knock["Knock (notifications)"]
BFL["Black Forest Labs (AI staging)"]
Claude["Anthropic Claude API"]
end
Browser --> SvelteKit
Browser --> API
Mobile --> API
SvelteKit --> Postgres
SvelteKit --> Valkey
SvelteKit --> Meilisearch
SvelteKit --> Bucket
SvelteKit --> Resend
SvelteKit --> GoogleMaps
SvelteKit --> Sentry
SvelteKit --> Google
API --> Postgres
API --> Valkey
Worker --> Postgres
Worker --> Valkey
Worker --> BFL
Worker --> Claude
Worker --> Knock
SvelteKit --> Stream
Bucket --> imgproxy
imgproxy --> Browser
DEV inter-service communication stays on Railway’s private <service>.railway.internal network; the data services have no public domains. Only the SvelteKit app, apps/api, imgproxy, and the docs site have public domains through Cloudflare DNS/proxy. Object storage remains Cloudflare R2, reached over the S3 API.
Technology stack
Section titled “Technology stack”Versions are not repeated here: the stack table in docs/ARCHITECTURE.md carries them and CI checks it against bun.lock. Meilisearch runs as a server (v1.9 image) with the meilisearch JS client; Better Auth is on the 1.6 line.
| Layer | Technology |
|---|---|
| Runtime | Bun |
| Web framework | SvelteKit + Svelte 5 |
| Mobile framework | Swift + SwiftUI (iOS 17+) / Kotlin + Jetpack Compose (SDK 26+) |
| Database | PostgreSQL + PostGIS |
| Query builder | Kysely (on pg) — typed, no ORM |
| Auth | Better Auth — email OTP + Google OAuth |
| State (web) | Svelte 5 runes ($state, $derived, $effect) |
| State (mobile) | @Observable (iOS) / StateFlow ViewModels (Android) |
| Search (locations) | Meilisearch |
| Search (properties) | @repo/redis-search — Valkey GEOSEARCH |
| File Storage | Cloudflare R2 (S3-compatible) |
| Image Processing | imgproxy (HMAC-signed URLs) |
| Styling (web) | Tailwind CSS |
| Styling (mobile) | Generated design tokens (SwiftUI / Compose) |
| UI Components (web) | bits-ui (headless) + formsnap |
| UI Components (mobile) | Hand-built per-app primitive libraries (lockstep iOS/Android) |
| Forms (web) | sveltekit-superforms + Zod |
| i18n | Paraglide JS |
| Icons | Lucide Svelte (web) / SF Symbols + Material icons (native mobile) |
| Chat | GetStream.io |
| Notifications | Knock |
| Resend | |
| Maps | Google Maps Platform |
| Background jobs | BullMQ (on Valkey) |
| Error Tracking | Sentry |
| Testing | Playwright (E2E), Bun Test (unit) |
| CI/CD | GitHub Actions (checks + post-gate vendor sync; no deploys) |
| Deploy | Railway GitHub auto-deploy (DEV from development) |
Monorepo layout
Section titled “Monorepo layout”real-estate-core/├── apps/│ ├── svelte-web/ # SvelteKit web app (public + dashboards)│ ├── ios-user/ # Native iOS customer app (Swift + SwiftUI)│ ├── ios-agent/ # Native iOS agent app (Swift + SwiftUI)│ ├── android/ # Gradle umbrella build for both Android apps│ │ ├── app-user/ # Native Android customer app (Kotlin + Compose)│ │ ├── app-agent/ # Native Android agent app (Kotlin + Compose)│ │ └── core/design-system/ # :core:design-system — generated Tokens.kt + Compose primitives│ ├── worker/ # BullMQ background worker│ ├── api/ # Standalone Hono server (tRPC + Better Auth)│ └── docs/ # This documentation site│├── packages/│ ├── api/ # Shared tRPC routers + services│ ├── contract/ # Zod wire schemas → Swift/Kotlin model codegen│ ├── database/ # Kysely client (pg) + SQL migrations + generated types│ ├── redis-search/ # Property geo-search (Valkey GEOSEARCH)│ ├── cache/ # Valkey/Redis utilities│ ├── validation/ # Shared Zod schemas│ ├── auth/ # Better Auth wiring (web + API)│ ├── notifications/ # Knock translations + email layout│ ├── integrations/ # Integration adapters (Knock, Stream, S3, Stripe, queues, rate limit)│ ├── eslint-config/ # Shared ESLint rules│ └── typescript-config/ # Shared TS configs│├── docs/ # Source-of-truth Markdown (mirrored by this site)├── context/ # Local-only design notes (gitignored)├── turbo.json # Turborepo pipeline└── package.json # Root workspaces ([email protected])Key design decisions
Section titled “Key design decisions”Architecture decisions are recorded one file per decision under docs/adr/ in the repository; the Decisions page lists them. The decisions that used to be summarised here are ADR-0017 to ADR-0025 (SvelteKit over Next.js, Valkey GEOSEARCH for property search, imgproxy, Better Auth, bits-ui, S3-compatible storage, Paraglide, the portal/dashboard split, per-app Dockerfiles), with ADR-0026 for authorization and ADR-0001 to ADR-0015 for the production landscape.
Two conventions that follow from them and are not separate records:
- Form actions on web, tRPC on mobile — web mutations are SvelteKit form actions (progressive enhancement); mobile speaks tRPC. See Conventions → Web and Conventions → tRPC.
- Standalone
apps/api— mobile and (eventually) browser tRPC traffic go through a Hono server on port 4000 that mounts both/api/auth/*and/api/trpc/*. SvelteKit hosts the same Better Auth handler for its own web flow.