All Projects â†’ aperkaz â†’ yarn-workspaces-electron

aperkaz / yarn-workspaces-electron

Licence: MIT license
🧶 Yarn workspaces with electron, for fun and profit

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects
shell
77523 projects

Projects that are alternatives of or similar to yarn-workspaces-electron

zsh-yarn-completions
Yarn completions for Z-shell that supports yarn workspaces
Stars: ✭ 35 (+40%)
Mutual labels:  yarn-workspaces
Puppeteer Extra
💯 Teach puppeteer new tricks through plugins.
Stars: ✭ 3,397 (+13488%)
Mutual labels:  yarn-workspaces
mono.ts
A minimal example of a typescript mono repo with pre-build support (tests, vscode).
Stars: ✭ 58 (+132%)
Mutual labels:  yarn-workspaces
React-Native-Web-TypeScript-Prettier-Boilerplate
A starterkit to work with nextjs, react-native, storybook… all with prettified typescript and in a monorepo
Stars: ✭ 16 (-36%)
Mutual labels:  yarn-workspaces
tangerine-monorepo
A "fast" TypeScript-based Node.js monorepo setup powered by esbuild & turborepo
Stars: ✭ 191 (+664%)
Mutual labels:  yarn-workspaces
mock-spy-module-import
JavaScript import/require module testing do's and don'ts with Jest
Stars: ✭ 40 (+60%)
Mutual labels:  yarn-workspaces
vscode-monorepo-workspace
📦✨Manage monorepos with multi-root workspaces. Supports Lerna, Yarn, Pnpm, Rushjs and recursive package directories.
Stars: ✭ 93 (+272%)
Mutual labels:  yarn-workspaces
yarn-workspaces-simple-monorepo
Yarn Workspaces basic monorepo management without Lerna for coding examples
Stars: ✭ 31 (+24%)
Mutual labels:  yarn-workspaces
perseus
An Apollo GraphQL Server & React Client in a Yarn Workspace deployed with Zeit 2.0
Stars: ✭ 35 (+40%)
Mutual labels:  yarn-workspaces
react-monorepo
a simple monorepo setup for react & react-native using yarn workspaces.
Stars: ✭ 40 (+60%)
Mutual labels:  yarn-workspaces
nest-react
Simple NestJS + React boilerplate using the Yarn workspaces - Full on TS!
Stars: ✭ 40 (+60%)
Mutual labels:  yarn-workspaces
devto-monorepo
Source code for the Dev.to article - Next.js, Apollo Client and Server on a single Express app
Stars: ✭ 33 (+32%)
Mutual labels:  yarn-workspaces
cra-monorepo-demo
Monorepo example using create-react-app and common component library structure with yarn workspaces
Stars: ✭ 37 (+48%)
Mutual labels:  yarn-workspaces
nextjs-typescript-yarn-workspaces
A simple example to help you get started with Next.js + typescript + yarn workspaces.
Stars: ✭ 75 (+200%)
Mutual labels:  yarn-workspaces

🧶 Advanced electron starter with yarn workspaces

Desktop apps are often a mix of UI and business logic.

In some cases, the business logic runs in a server and the desktop app may be a simple UI that interacts with said server executing CRUD operations.

In other cases, the app itself needs to contain the business logic and perform expensive computations (ex. machine learning, CPU intensive calculations).

Electron.js is a powerful framework that enables JS developers to create cross-platform desktop apps with the same technology stack used in the web. While the default process model of Electron scales well for UI heavy apps, there are limitations that may cause laggy UIs and poor developer experience.

This starter aims to bridge those limitations, focusing on performance and developer experience. It combines the latest web libraries with Electron.

This is exactly how my app Taggr is architected.

High-level architecture

As mentioned above, this starter proposes an advanced architecture, best suited for complex Electron.js apps. Avoid over engineering your solution in the beginning, and consider the switch if you experience performance or developer experience limitations.

The architecture of this starter is divided into three modules: frontend, electron-backend and shared.

The code sharing between modules (the shared module) is managed with yarn workspaces.

Architecture

Frontend

Stack: TypeScript + React (CRA) + Redux + Storybook

The frontend module is responsible of all things UI, no business logic should live in this module.

During development, the frontend is served live from the webpack dev-server (from http://localhost:3000). In production, the frontend statics are build and copied into the installable.

Main features

  • Full TypeScript support.
  • Develop components in isolation using Storybook.
  • Store the fully-typed app state in Redux.
  • Interact with the electron-backend through async message passing with node-ipc.
  • Access to the shared module (through yarn workspaces).
  • Tests with jest.

Electron-backend

Stack: TypeScript + Node.js

The electron-backend module is responsible for the business logic, and the integrations with external dependencies such as databases and REST APIs.

It also contains the electron code required to build and package the app into a cross-platform executable.

In development, the backend code runs withing an Electron render process (browser window). In production, the backend code runs as a separate node.js process (forked from the electron node.js process).

The architecture schema when in development:

Development architecture

Main features

  • Full TypeScript support.
  • Perform costly CPU and GPU operations without impacting the UI.
  • Support for native modules.
  • Interact with the frontend through async message passing with node-ipc.
  • Access to the shared module (through yarn workspaces).
  • Tests with jest.

Shared

Stack: TypeScript

There are great benefits to having a decoupled architecture. It is often easier to reason about and modify parts of it without impacting the other parts of the system, as long as the interaction contract between the modules it kept (API).

Since the frontend and electron-backend are separated modules, shared enables code sharing between them. This allows to define the frontend and electron-backend async event passing APIs in one place, and evolve the modules separatedly.

Main features

  • Full TypeScript support
  • Enable code sharing between fronted and electron-backend (through yarn workspaces).

Communication

The communication between the frontend and electron-backend modules is done by node-ipc, following the blueprint proposed in this great post.

It uses asynchronous message passing to transfer the events, and the communication layer is typed in the shared module. By doing so, both the frontend and electron-backend are decoupled, and the communication layer offers full type safety.

The frontend can trigger code in the backend by passing messages, and wait for an answer asynchronously. However, in some cases, the operations that backend should do may take significant time and resources.

Thats why the frontend also exposes event handlers, so that the backend can modify the state of the frontend (redux store) when needed.

Getting up and running

# install dependencies
yarn

# watch changes in the modules
yarn modules:watch

# start the app in development mode
yarn watch

In order to refresh the Backend or Frontend window, you can press command + R.

Building app for production

yarn build
# executable in: `./electron-backend/dist`
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].