Skip to content

Commit 1e34ff7

Browse files
authored
feat: standalone web app decoupled from electron (#365)
1 parent 3fba923 commit 1e34ff7

139 files changed

Lines changed: 1130 additions & 183 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,19 @@ can:
5252
The source code for the app lives in the
5353
[`raga-app` package](https://github.com/adidahiya/raga/blob/main/packages/raga-app/README.md).
5454

55+
### For Web Developers: `raga-web-app`
56+
57+
The web UI components of _raga_ have been extracted into a separate package called
58+
[`raga-web-app`](https://github.com/adidahiya/raga/blob/main/packages/raga-web-app/README.md).
59+
This allows the UI to be:
60+
61+
- Run as a standalone web application for testing and development
62+
- Deployed to static web servers for preview and demonstration
63+
- Embedded within the Electron app for the full desktop experience
64+
65+
The web app provides a limited set of features when running outside of Electron due to browser
66+
security restrictions, but it's useful for UI development and testing.
67+
5568
### For developers: `raga-lib` and `raga-cli`
5669

5770
Much of _raga_'s data management functionality lives in a separate Node.js library called
@@ -79,6 +92,8 @@ Getting started:
7992

8093
Dev tasks:
8194

95+
- `yarn dev:web` - runs the web app in standalone mode at http://localhost:3000
96+
- `yarn dev:electron` - runs the full Electron app with all features enabled
8297
- `yarn build` - builds TypeScript sources and bundles up the Electron app
8398
- `yarn dist` - creates the Electron app distributable package
8499

eslint.config.mjs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export default tseslint.config(
6262
},
6363
},
6464
{
65-
files: ["packages/raga-app/src/client/**/*.{ts,tsx}"],
65+
files: ["packages/raga-web-app/src/**/*.{ts,tsx}"],
6666
plugins: {
6767
react: reactPlugin,
6868
"react-hooks": fixupPluginRules(reactHooksPlugin),
@@ -71,10 +71,6 @@ export default tseslint.config(
7171
...reactPlugin.configs["recommended"].rules,
7272
...reactPlugin.configs["jsx-runtime"].rules,
7373
...reactHooksPlugin.configs.recommended.rules,
74-
// HACKHACK: until we can get Sass CSS modules type-checked
75-
"@typescript-eslint/no-unsafe-assignment": "off",
76-
"@typescript-eslint/no-unsafe-member-access": "off",
77-
"@typescript-eslint/no-unsafe-argument": "off",
7874
// unnecessary with TypeScript
7975
"react/prop-types": "off",
8076
},

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
"check-lint": "nx run-many -t check-lint",
1212
"check-types": "nx run-many -t check-types",
1313
"clean": "nx run-many -t clean",
14+
"dev:web": "yarn workspace @adahiya/raga-web-app dev",
15+
"dev:electron": "yarn workspace @adahiya/raga-app dev",
1416
"dist": "nx run-many -t dist",
1517
"fix-format": "prettier --write \"./**/*.{js,json,md,scss,ts,tsx,yaml,yml}\"",
1618
"fix-lint": "nx run-many -t lint-fix"

packages/raga-app/package.json

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -19,62 +19,30 @@
1919
},
2020
"dependencies": {
2121
"@adahiya/raga-lib": "workspace:^",
22-
"@emotion/react": "^11.14.0",
23-
"@mantine/colors-generator": "^7.17.3",
24-
"@mantine/core": "^7.17.3",
25-
"@mantine/dates": "^7.17.3",
26-
"@mantine/dropzone": "^7.17.3",
27-
"@mantine/form": "^7.17.3",
28-
"@mantine/hooks": "^7.17.3",
29-
"@mantine/modals": "^7.17.3",
30-
"@mantine/notifications": "^7.17.3",
31-
"@mantine/nprogress": "^7.17.3",
32-
"@mantine/spotlight": "^7.17.3",
33-
"@number-flow/react": "^0.5.8",
34-
"@roarr/browser-log-writer": "^1.3.0",
35-
"@table-library/react-table-library": "^4.1.12",
22+
"@adahiya/raga-web-app": "workspace:^",
3623
"@tinyhttp/app": "^2.5.2",
3724
"ansis": "^3.17.0",
3825
"app-root-dir": "^1.0.2",
39-
"chroma-js": "^3.1.2",
40-
"classnames": "^2.5.1",
41-
"clsx": "^2.1.1",
42-
"date-fns": "^4.1.0",
43-
"dayjs": "^1.11.13",
4426
"disconnect": "^1.2.2",
4527
"effection": "^3.4.0",
46-
"immer": "^10.1.1",
47-
"mantine-contextmenu": "^7.17.1",
4828
"milliparsec": "^5.0.2",
49-
"motion": "^12.6.3",
5029
"node-taglib-sharp": "^6.0.1",
51-
"pluralize": "^8.0.0",
5230
"radash": "^12.1.0",
5331
"react": "^19.1.0",
5432
"react-dom": "^19.1.0",
55-
"react-dropzone": "^14.3.8",
56-
"react-icons": "^5.5.0",
57-
"react-resizable-panels": "^2.1.7",
5833
"react-scan": "^0.3.4",
5934
"roarr": "^7.21.1",
6035
"serialize-error": "^12.0.0",
6136
"sirv": "^3.0.1",
62-
"use-immer": "^0.11.0",
63-
"usehooks-ts": "3.1.1",
64-
"vite-plugin-html-config": "^2.0.2",
65-
"wavesurfer.js": "^7.9.4",
66-
"web-audio-beat-detector": "^8.2.27",
67-
"zustand": "^5.0.3"
37+
"vite-plugin-html-config": "^2.0.2"
6838
},
6939
"devDependencies": {
7040
"@electron-forge/cli": "^7.8.1",
7141
"@electron-forge/maker-deb": "^7.8.1",
7242
"@electron-forge/maker-zip": "^7.8.1",
7343
"@electron-forge/plugin-vite": "^7.8.1",
7444
"@types/app-root-dir": "^0.1.4",
75-
"@types/chroma-js": "^3.1.1",
7645
"@types/node": "^22.15.24",
77-
"@types/pluralize": "^0.0.33",
7846
"@types/react": "^19.1.6",
7947
"@types/react-devtools": "^3.6.2",
8048
"@types/react-dom": "^19.1.5",

packages/raga-app/src/client/globalWindow.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

packages/raga-app/src/client/main.tsx

Lines changed: 0 additions & 26 deletions
This file was deleted.

packages/raga-app/src/renderer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
/* eslint-disable simple-import-sort/imports */
3030

31-
import "./client/index.scss";
31+
import "../../raga-web-app/src/index.scss";
3232

3333
import { scan } from "react-scan"; // import this BEFORE react
3434
import "react";
@@ -40,6 +40,6 @@ if (typeof window !== "undefined" && process.env.NODE_ENV === "development") {
4040
});
4141
}
4242

43-
import "./client/main";
43+
import "../../raga-web-app/src/main";
4444

4545
/* eslint-enable simple-import-sort/imports */

packages/raga-app/vite.renderer.config.mjs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,19 @@ export default defineConfig({
1414
}),
1515
react(),
1616
],
17-
publicDir: "./src/client/assets",
17+
// Use the web app's assets directory
18+
publicDir: "../raga-web-app/src/assets",
1819
build: {
1920
target: "esnext",
21+
rollupOptions: {
22+
external: ["react-scan"],
23+
},
24+
},
25+
resolve: {
26+
alias: {
27+
// Ensure proper resolution of the web app package
28+
"@adahiya/raga-web-app": "../raga-web-app",
29+
},
2030
},
2131
cssPreprocessOptions: {
2232
sass: {

packages/raga-web-app/.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Dependencies
2+
node_modules/
3+
4+
# Build outputs
5+
dist/
6+
.vite/
7+
8+
# IDE
9+
.idea/
10+
.vscode/
11+
*.swp
12+
*.swo
13+
14+
# OS
15+
.DS_Store
16+
Thumbs.db
17+
18+
# Logs
19+
*.log
20+
npm-debug.log*
21+
yarn-debug.log*
22+
yarn-error.log*
23+
24+
# Environment
25+
.env
26+
.env.local
27+
.env.development.local
28+
.env.test.local
29+
.env.production.local

packages/raga-web-app/README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Raga Web App
2+
3+
This package contains the portable web UI for Raga music library management. It can be run as a standalone web application or embedded within the Electron app.
4+
5+
## Development
6+
7+
To run the web app in development mode:
8+
9+
```bash
10+
yarn dev
11+
```
12+
13+
This will start a Vite dev server at http://localhost:3000
14+
15+
## Building
16+
17+
To build the web app for production:
18+
19+
```bash
20+
yarn build
21+
```
22+
23+
The built files will be in the `dist` directory.
24+
25+
## Preview
26+
27+
To preview the production build:
28+
29+
```bash
30+
yarn preview
31+
```
32+
33+
## Architecture
34+
35+
This web app is designed to work in two modes:
36+
37+
1. **Standalone mode**: When running as a regular web app, it uses a mock API (`webApi.ts`) that provides the same interface as the Electron API but with limited functionality.
38+
39+
2. **Electron mode**: When embedded in the Electron app, it uses the actual Electron API exposed through the context bridge.
40+
41+
## Key Features
42+
43+
- Built with React 19 and TypeScript
44+
- Uses Mantine UI components
45+
- Vite for fast development and optimized builds
46+
- Sass modules for styling
47+
- Zustand for state management
48+
49+
## Limitations in Standalone Mode
50+
51+
When running as a standalone web app (not in Electron), certain features are limited:
52+
53+
- File system access is restricted to web standards
54+
- No direct audio file tag writing
55+
- No native OS integrations
56+
- IPC communications are mocked
57+
58+
These limitations do not apply when the app is running within Electron.

0 commit comments

Comments
 (0)