electron-trpc-prisma
electron-trpc-prisma copied to clipboard
The most typesafe way to build an Electron app.
Based on: https://github.com/cawa-93/vite-electron-builder The tRPC over IPC code is based on the electron-trpc package, adapted to support tRPC v10 by using tRPC source.
Running locally
-
Run
npm run bootstrap. This installs the dependencies and sets up the database. -
Run
npm run devThis starts a development watch process usingvite. It hot reloads on changes torenderer/It reloads the web page on changes topreload/It fully reloads the Electron app on changes tomain/
Packaging the app
electron-builder is used to compile this codebase into an executable.
- Run
npm run compile
This executes the scripts/compile.ts file.
It uses the electron-builder programmatic API.
If you want to compile an installable executable, change dir to false in the call to build().
Notes
The resolve.alias stuff in vite.config.ts files is needed because https://github.com/vitejs/vite/issues/6828
By default, the Content-Security-Policy allows inline <style> tags.
If you use a different method of applying CSS, change the relevant line in renderer/index.html.
eg:
<meta
http-equiv="Content-Security-Policy"
content="default-src 'self'; script-src 'self'; style-src 'self'"
/>