Skip to content

feat: initialize Electron + Vite + React + TypeScript project scaffold#37

Open
ashi2004 wants to merge 1 commit intoAOSSIE-Org:mainfrom
ashi2004:feat/electron-vite-react-ts-scaffold
Open

feat: initialize Electron + Vite + React + TypeScript project scaffold#37
ashi2004 wants to merge 1 commit intoAOSSIE-Org:mainfrom
ashi2004:feat/electron-vite-react-ts-scaffold

Conversation

@ashi2004
Copy link
Copy Markdown
Contributor

@ashi2004 ashi2004 commented Mar 29, 2026

Closes #36

📝 Description

This PR introduces the initial project scaffold, setting up an Electron-based desktop app with a React + TypeScript renderer and Vite-powered development environment.

Key Changes

  • Added Electron main process (src/main)
  • Added preload layer with safe API exposure (src/preload)
  • Added React + TypeScript renderer (src/renderer)
  • Configured Vite via electron-vite
  • Added TypeScript configs for node & web
  • Setup ESLint & Prettier
  • Added build & packaging via electron-builder
  • Included basic UI and assets for testing

How to Test

npm install
npm run dev
  • App window should open
  • DevTools can be opened (F12)
  • IPC test (ping/pong) works

Additional Checks

npm run typecheck
npm run lint
npm run build

Notes

  • This is a base scaffold intended for further feature development
  • Tooling and structure can be refined in future PRs

📷 Screenshots or Visual Changes (if applicable)

image

✅ Checklist

  • I have read the contributing guidelines.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if applicable).
  • Any dependent changes have been merged and published in downstream modules.
  • I have joined the Discord server and I will share a link to this PR with the project maintainers there

Summary by CodeRabbit

  • New Features

    • Converted the project to a desktop application with Electron, Vite, and React framework.
    • Integrated a modern development tooling stack including TypeScript, ESLint, Prettier, and Tailwind CSS.
  • Documentation

    • Updated installation and running instructions for the desktop app environment.
    • Simplified prerequisite requirements.
  • Configuration

    • Added code formatting, linting, and editor configurations.
    • Configured application build and packaging settings for multiple platforms.
    • Established TypeScript compilation targets for the desktop and renderer processes.

@github-actions github-actions bot added enhancement New feature or request configuration dependencies documentation Improvements or additions to documentation frontend javascript size/XL labels Mar 29, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 29, 2026

Walkthrough

Adds initial Electron + Vite + React + TypeScript project scaffold including configuration files for linting, formatting, and build tools, Electron main process with window management and IPC, preload scripts for API exposure, React renderer application with components and styling, and TypeScript project configurations.

Changes

Cohort / File(s) Summary
Configuration & Tooling
.editorconfig, .gitignore, .prettierignore, .prettierrc.yaml
Added editor/formatter configuration for UTF-8 encoding, 2-space indentation, LF line endings; simplified gitignore from LaTeX-focused to JavaScript/Node patterns; configured Prettier ignore rules and formatting preferences (single quotes, no semicolons, 100-char line width).
Build System & Packaging
electron-builder.yml, electron.vite.config.ts, package.json
Added Electron app builder configuration with platform-specific options for Windows/macOS/Linux; defined Electron Vite config with React and Tailwind plugins; established package.json with Electron dev/build scripts, dependencies for Electron toolkit, React 19, TypeScript, and dev tooling.
Code Quality
eslint.config.mjs
Added flat ESLint configuration with TypeScript, Electron, React, and Prettier integration; configured rules for React Hooks and Refresh plugins.
TypeScript Configuration
tsconfig.json, tsconfig.node.json, tsconfig.web.json
Created TypeScript project references structure; configured Node-specific rules for main/preload processes and web-specific rules for renderer with path aliases and JSX support.
Electron Main Process
src/main/index.ts
Implemented main process entry with window creation (900×670), preload script integration, content loading (dev/production), app lifecycle management, IPC ping listener, and external link handler.
Electron Preload Scripts
src/preload/index.ts, src/preload/index.d.ts
Added preload script exposing Electron APIs and custom api object via context bridge or direct window assignment; defined TypeScript augmentations for window.electron and window.api.
React Renderer Core
src/renderer/index.html, src/renderer/src/main.tsx, src/renderer/src/App.tsx, src/renderer/src/env.d.ts
Added HTML template with CSP, React root entrypoint with StrictMode, App component with logo/links/IPC trigger, and Vite client type definitions.
Renderer Components & Styling
src/renderer/src/components/Versions.tsx, src/renderer/src/assets/base.css, src/renderer/src/assets/main.css
Implemented Versions component displaying Electron/Chromium/Node versions; added global CSS variables, typography, layout, and responsive design rules.
Documentation
README.md
Updated prerequisites (removed Python/Flutter); clarified no .env required by default; replaced browser run instructions with Electron app launch, build, and packaging commands.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

Typescript Lang, Documentation, Linter

Poem

🐰 A project takes shape with careful care,
Electron, React, TypeScript everywhere,
Config files arranged in perfect rows,
Build tools humming as the scaffold grows,
From main to preload to renderer divine,
A desktop app scaffold—hopping fine! 🚀

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main change: introducing an Electron + Vite + React + TypeScript project scaffold, which is the primary focus of all changes in the PR.
Linked Issues check ✅ Passed The PR comprehensively addresses all coding requirements from issue #36: Electron setup (main/preload), React + TypeScript renderer, Vite configuration, ESLint/Prettier tooling, TypeScript configs for node/web, and electron-builder packaging.
Out of Scope Changes check ✅ Passed All changes are within scope of issue #36. The PR only adds project scaffold infrastructure and configuration files with no unrelated modifications to existing codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 15

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.gitignore:
- Around line 10-13: The .gitignore contains a malformed entry
"yarn.locknode_modules" that accidentally merged two entries; split this into
two separate lines by replacing "yarn.locknode_modules" with "yarn.lock" and
"node_modules" so both lockfile and node modules are ignored correctly.

In `@electron-builder.yml`:
- Around line 23-27: The mac.extendInfo block is currently a YAML sequence
instead of the required mapping, so Info.plist entries (e.g.,
NSCameraUsageDescription, NSMicrophoneUsageDescription,
NSDocumentsFolderUsageDescription, NSDownloadsFolderUsageDescription) will be
wrong; change the extendInfo value to a YAML object (key: value pairs) under the
mac configuration used by electron-builder so each NS* key maps to its string
description (preserve the same keys and messages), ensuring extendInfo is a
mapping rather than a list.

In `@package.json`:
- Around line 17-22: The macOS and Linux packaging scripts ("build:mac" and
"build:linux") bypass the shared "build" pipeline (which runs typecheck) and
thus skip typechecking; update those scripts so they run the existing "build"
script first (e.g., change "build:mac" and "build:linux" to run "npm run build
&& ..." similar to "build:win" and "build:unpack") to ensure typechecking and
the common build steps run for all platforms.

In `@src/main/index.ts`:
- Around line 14-16: The webPreferences currently sets sandbox: false which
disables Electron's renderer sandbox; remove the sandbox: false entry (or set
sandbox: true) in the webPreferences object where preload is set (see
webPreferences and preload join(__dirname, '../preload/index.js')) so the
renderer runs with Electron's default sandbox/context isolation enabled and
relies on the preload's contextBridge usage.
- Around line 24-26: The handler passed to
mainWindow.webContents.setWindowOpenHandler currently calls
shell.openExternal(details.url) with unvalidated input and ignores the returned
Promise; change it to parse and validate details.url using a URL parser and only
allow http: and https: protocols (reject file:, smb:, custom protocols), and
then call shell.openExternal(validatedUrl).await the Promise or attach .catch to
handle failures and log errors; ensure the handler still returns { action:
'deny' } to prevent Electron from opening the URL itself when the URL is invalid
or disallowed.

In `@src/preload/index.d.ts`:
- Line 1: The import for ElectronAPI is a type-only import; change the statement
importing ElectronAPI to a type-only import using "import type" so the emitted
JS remains clean and follows TS best practices—update the import that currently
references ElectronAPI to use import type ElectronAPI from
'@electron-toolkit/preload' (i.e., make ElectronAPI a type-only import).

In `@src/preload/index.ts`:
- Around line 12-13: Replace broad exposure of the entire electronAPI via
contextBridge.exposeInMainWorld with a minimal, explicit API object: keep only
the properties used by the renderer (e.g., window.electron.process.versions and
a ping function that calls ipcRenderer.send('ping')). Update the
exposeInMainWorld calls (currently exposing electronAPI and api) to expose a
small object (e.g., { process: { versions: ... }, ping: () => ... }) and apply
the same reduction in the fallback branch where you currently fall back to the
full electronAPI; ensure the exposed names remain electron and api (or the same
identifiers used by the renderer) and that ipcRenderer usage is wrapped in safe
functions rather than exposing the raw ipcRenderer object.

In `@src/renderer/index.html`:
- Line 2: The root html element is missing a lang attribute; update the root
<html> tag to include an appropriate language code (e.g., lang="en") so the
<html> element declares the document language for accessibility and standards
compliance.
- Around line 7-10: The CSP meta tag in the renderer is missing object-src and
base-uri directives; update the Content-Security-Policy value used in the <meta
http-equiv="Content-Security-Policy"> tag to include object-src 'none' and
base-uri 'self' (e.g., append "object-src 'none'; base-uri 'self';") so the
renderer prevents plugin/object injection and restricts base URL navigation.

In `@src/renderer/src/App.tsx`:
- Around line 10-17: The hardcoded UI strings in the App component (the elements
with className "creator", "text" and nested spans "react" and "ts", plus the
paragraph with className "tip" that contains the "F12" devTool hint) must be
moved to i18n resource files and replaced with lookups; add appropriate keys
(e.g., app.poweredBy, app.buildWith, app.framework.React,
app.language.TypeScript, app.devtoolHint) in your locale JSON, then import and
use your translation helper (e.g., t('...') or <Trans> from your i18n setup)
inside App.tsx to render those strings instead of the hardcoded text so the UI
is localizable.
- Around line 25-27: Replace the anchor element used for triggering IPC with a
proper interactive control: change the <a> without href to a <button
type="button"> and attach the existing onClick handler (ipcHandle) to it,
preserving any classes/styles so visual appearance stays the same; ensure you
remove any meaningless href/onClick patterns and, if necessary, add an
accessible label (aria-label or visible text) so keyboard and assistive
technologies can activate the IPC action correctly while keeping the ipcHandle
function name as the event target.
- Line 5: The renderer currently calls window.electron.ipcRenderer directly in
ipcHandle; replace that call with a typed wrapper (e.g., call
window.api.sendPing()) and remove any direct use of window.electron.ipcRenderer
from App.tsx; then implement sendPing in the preload's api object so it
internally calls ipcRenderer.send('ping') (keep the channel string inside
preload), ensuring the renderer only uses the new sendPing wrapper and ipcHandle
is updated to call it.

In `@src/renderer/src/assets/base.css`:
- Around line 34-44: The global resets currently set font-weight: normal on the
universal selector (*) and remove list bullets via ul { list-style: none; }
which strips emphasis and bullets across the renderer; remove those two rules
from the app-wide base.css (keep box-sizing and margin resets on *, ::before,
::after) and move the font-weight and list-style changes into a landing-page
scoped stylesheet or component CSS (e.g., .landing-page * { font-weight: normal;
} and .landing-page ul { list-style: none; }) so only landing page components
are affected; update or add the landing component CSS (references: the universal
selector "*", the pseudo-elements "::before/::after", and the "ul" selector)
accordingly.

In `@src/renderer/src/assets/main.css`:
- Around line 8-11: Remove global scrolling and selection restrictions from the
body rule: do not keep "overflow: hidden" and "user-select: none" on the body
selector; instead apply those properties only to the splash screen container
(e.g., the ".splash" or "#splash" element used for the app splash). Keep the
background-image and background-size on body if intended, but move overflow and
user-select into the splash container's CSS rule (create one if missing) so
normal renderer pages retain default scrolling and text-selection behavior.

In `@src/renderer/src/components/Versions.tsx`:
- Line 4: The component uses useState for static data: replace the line that
declares versions via useState in Versions.tsx with a plain constant (assign
window.electron.process.versions to versions) and remove the now-unused useState
import; update any references to the versions variable unchanged so the
component reads the static version info without React state overhead.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 93c6f370-0009-4e71-9d53-a8069b5c5faf

📥 Commits

Reviewing files that changed from the base of the PR and between 4bb58bd and 9798358.

⛔ Files ignored due to path filters (4)
  • public/stability.svg is excluded by !**/*.svg
  • resources/icon.png is excluded by !**/*.png
  • src/renderer/src/assets/electron.svg is excluded by !**/*.svg
  • src/renderer/src/assets/wavy-lines.svg is excluded by !**/*.svg
📒 Files selected for processing (22)
  • .editorconfig
  • .gitignore
  • .prettierignore
  • .prettierrc.yaml
  • README.md
  • electron-builder.yml
  • electron.vite.config.ts
  • eslint.config.mjs
  • package.json
  • src/main/index.ts
  • src/preload/index.d.ts
  • src/preload/index.ts
  • src/renderer/index.html
  • src/renderer/src/App.tsx
  • src/renderer/src/assets/base.css
  • src/renderer/src/assets/main.css
  • src/renderer/src/components/Versions.tsx
  • src/renderer/src/env.d.ts
  • src/renderer/src/main.tsx
  • tsconfig.json
  • tsconfig.node.json
  • tsconfig.web.json

@ashi2004
Copy link
Copy Markdown
Contributor Author

I’ve addressed all the automated review comments
since this PR introduces the initial project scaffold, some of the suggestions relate to structure and optimizations that can be iteratively improved as we build out features. I’ve resolved the relevant issues for now and plan to refine further in upcoming PRs as the codebase evolves
@Zahnentferner , @yatikakain Could you please reivew this PR, as this will enable the base structre for the SmartNotes:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Initial project scaffold: Electron + Vite + React + TypeScript

1 participant