Skip to content

οΈπŸ›  - Restructure codebase into monorepo layoutΒ #77

@maxwellmattryan

Description

@maxwellmattryan

Description

Restructure the project into a monorepo layout to support separate desktop and mobile frontends while sharing types, stores, API wrappers, utilities, and i18n.

This must happen before any mobile frontend code is written.

Scope:

  • Move src/ to apps/desktop/src/
  • Extract shared code to shared/:
    • types/ β€” all TypeScript type definitions
    • api/ β€” all Tauri IPC wrappers (same invoke() calls used by both platforms)
    • stores/ β€” shared stores: discovery, discoveryPlaylist, expandedReleases, player, tags, playlists, settings, toast
    • utils/ β€” format, sorting, selection, storage, artwork utilities
    • i18n/ β€” all locale files and i18n setup
    • services/previewPlayer.ts β€” HTML5 Audio singleton
  • Desktop-only stores stay in apps/desktop/src/lib/stores/: devices, export, sync (USB), analysis, drag, app, crash, diagnostics, missingTracks, updater, splash, backup, pageActions
  • Desktop-only components, controllers, and hooks stay in apps/desktop/
  • Update Tauri configs (tauri.conf.json, tauri.dev.conf.json, etc.) to point to apps/desktop/
  • Add $shared path alias in both svelte.config.js and vite.config.ts pointing to ../../shared/
  • Scaffold apps/mobile/ with SvelteKit, own svelte.config.js, vite.config.ts, same $shared alias
  • Update all import paths throughout the desktop frontend
  • Verify desktop build works identically after restructuring

Key files:

  • src/ β†’ apps/desktop/src/
  • shared/ β€” new directory
  • apps/mobile/ β€” new scaffolded directory
  • svelte.config.js, vite.config.ts β€” both apps
  • src-tauri/tauri.conf.json and environment-specific configs

Open questions

  • Should the root package.json use Yarn workspaces, or keep a single package.json with path aliases only?
  • Should svelte.config.js and vite.config.ts live in apps/desktop/ or remain at root with the mobile equivalents added alongside?
  • Should the ui store be split (shared core state vs. desktop-specific layout state) or kept entirely in desktop?

Acceptance criteria

  • Desktop application builds and runs identically after restructuring (no functional changes)
  • apps/desktop/src/ contains only desktop-specific code (components, controllers, hooks, desktop-only stores)
  • shared/ contains types, API wrappers, shared stores, utils, i18n, and previewPlayer service
  • apps/mobile/ is scaffolded with SvelteKit and can import from $shared
  • All import paths are updated and resolve correctly
  • src-tauri/ is unchanged in location and continues to serve both platforms
  • Tauri configs correctly reference apps/desktop/ for frontend

Tasks

TBD

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions