Skip to content

Commit 4262cd2

Browse files
authored
chore: claude md with deliberate details about the app (#230)
1 parent 5134e7d commit 4262cd2

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

claude.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
This is the source code for the desktop app of Requestly. It is an electron app
2+
3+
# Parts of App
4+
This primarily has two render processes:
5+
1. App Renderer:
6+
- The UI of the app that is visible to the user
7+
- held by the `webAppWindow` variable in `src/main.ts`
8+
- loads the UI from `localhost:3000` during developement. The code of which can be found outside this repo at `../requestly/app`. This is the same code as the one that is loaded for the web version of requestly (although the code there is written in a way to recognise and adapt based on whether the website loads inside the web browser or the electron app here)
9+
- this loads a react app
10+
- this process has `nodeIntegration: false` and `sandbox: false`. and this is made to be a frameless window
11+
- loads preload from `./preload.js`
12+
13+
2. Background Renderer:
14+
- The process for all the background stuff. Major responsibilities include:
15+
- running the requestly proxy (whose code can be found inside `../requestly-proxy`) for providing interception functionality and everything related to that
16+
- an abstract FS service for managing access to local files as and when needed - primarily used to provide the capability have "workspaces" that store data fully locally
17+
- held by the `backgroundWindow` variable in `src/main.ts`
18+
- this has `nodeIntegration: true`, `contextIsolation: false` and has remote module enabled.
19+
- this renderer does not load any preload script
20+
21+
3. Main process:
22+
- entry point of the app, hence takes care of core important things like
23+
- all the other parts of the app spawn on launch
24+
- initiator for all essential services and major IPC handlers
25+
- Critical place for all the IPC infrastructure that we have here (explained later)
26+
- handles custom system specific app integrations like:
27+
- handling the custom protocol that the app registers for deep link integrations
28+
- handling the files for which this becomes a default client (`.har` and `.rqly` files)
29+
- Autoupdates - code related to that should be very carefully updated as any issues there would be very hard to resolve (as they would make it difficult to make the fixed release reach affected users)
30+
- this is the node environment where the actual request is made for the Requestly API client
31+
- creates the tray menu to expose basic touch points
32+
- quitting and its related cleanup
33+
- some other basic helpers like:
34+
- preserving cookies
35+
- loading some stored user configs
36+
37+
38+
# IPC infrastructure
39+
- Electron specific constraints:
40+
- IPC can only send serializable data. Objects with functions, circular references, or complex types cannot be transmitted.
41+
- renderers can only talk to the main process and not directly to each other
42+
43+
44+
The code here has several tooling built to make the developer experience of working with IPC a lot easier
45+
46+
1. IPC.js via preload
47+
In the app renderer, there are special wrapper functions for the IPC tooling that expose easy functions for the app renderer to communicate and listen to events from both main and the background renderer
48+
49+
2. IPC forwarding:
50+
there are special IPC channels setup in main process to forward messages from app renderer to background renderer and vice versa (along with replies)
51+
these are exposed via the IPC service through the preload as well
52+
53+
3. `RPCServiceOverIPC` on top of IPC forwarding.
54+
This class in the background process provides a way to create services in the background renderer and consume them inside the app renderer through *"adapters"* that expose easy to consume methods for these services
55+
56+
57+
# Bundling / Packaging nuances
58+
- the code here uses `electron-builder` and `@electron/notarize` and custom webpack scripts to build the final build
59+
- the configs for those are in the package.json
60+
- dependencies that have native code are installed through a postInstall step. and are hence separately mentioned in `release/app/package.json`

0 commit comments

Comments
 (0)