Shipping one music app to the web, Windows, Linux and Android
How Melodius ships to four platforms as a solo developer: Next.js on the web, the same UI in a Tauri 2 desktop window, Expo for Android, and a shared TypeScript core for schemas, playback and Jams.
Melodius runs on the web, Windows, Linux and Android, and I build it alone. That only works if adding a platform does not mean writing the product again. This is the structure that keeps four apps feeling like one.
The constraint
Every feature, from a new playlist action to a change in how Jams sync, has to reach every platform without being reimplemented. And each platform still has to feel native where it matters: a tray icon and deep links on the desktop, gestures and haptics on Android, server rendering and SEO on the web.
Three layers
- Shared core: a TypeScript package with schemas, DTOs, the API layer, playback and player logic, Jam logic, search, offline handling and design tokens.
- Shared UI: the web app's React components, stores, player engine and Tailwind theme, reused by the desktop app.
- Platform shells: the thin parts that are genuinely different on each platform.
The shared core
The core holds the logic that must behave identically everywhere. Playback rules and Jam synchronisation are the clearest examples: if the web and Android disagreed on how to apply a seek in a Jam, friends would drift apart. The 10-band equalizer's presets live there too, so a preset sounds the same on every device.
The web app is Next.js with React, server-side data in PostgreSQL through Drizzle ORM, Redis for hot paths, Auth.js for sign-in, and a separate WebSocket server for real-time features. The other apps talk to its versioned API with the same bearer tokens.
Desktop: the web UI in Tauri
The Windows and Linux app is the web UI rendered by Vite inside a Tauri 2 window. Nothing in it is a second copy of the product. The trick is module aliasing: the desktop build points Next-specific imports at small shims, and points server actions at adapters that call the API instead.
next/link, next/navigation, next/image -> small desktop shims
@/server/actions/* -> adapters that call /api/v1
@mobile-endpoints -> the Android app's endpoint bindingsSo the same component that calls a server action on the web makes an API call on the desktop, without knowing the difference. What is truly desktop-only stays small: the screens that are server components on the web, the Rust shell, and plugins for deep links, notifications and the tray.
Android with Expo
Android is built with Expo and React Native. It cannot reuse web components, but it reuses everything beneath them: the core's schemas, playback and Jam logic, and its own endpoint bindings, which the desktop app borrows in turn. The parts that are Android's own are the ones users touch: gestures, haptics, notifications and Discord presence.
Trade-offs
- Aliasing is a contract. Shared components must not reach for Next-only APIs outside the shimmed set, or the desktop build breaks. Tests and the desktop build catch that early.
- The API is the boundary. Because desktop and Android go through the same versioned API, a breaking change there is a breaking change for two apps at once. It gets versioned, not edited.
- Release cadence differs. The web deploys continuously; desktop and Android ship through stores. Older clients stay in use for a while, which is another reason the API changes carefully.
The payoff is that a feature is written once and arrives everywhere. The desktop app shipped for Linux as version 1.13.1 without a separate Linux codebase. More in the Melodius case study, or download the apps from melodius.in/download.
