DEV Community

Dobrosav Vlaskovic
Dobrosav Vlaskovic

Posted on

How I implemented a local-first Git workflow in an Electron/React app (building a Postman alternative)

Hey everyone,

I recently got frustrated with API clients forcing cloud sync and requiring accounts just to save a few HTTP requests. I wanted my API collections to live directly inside my project repositories as plain JSON files, so I decided to build my own local-first API client using React 19, Vite, and Electron.

The biggest architectural challenge wasn't the HTTP client itself, but integrating native Git operations so users could branch, commit, and push their collections without leaving the UI.

I wanted to share how I structured this, in case anyone else is building local-first Electron apps:

  1. The Architecture (IPC Bridge) You obviously can't run Git commands directly from the React frontend. I used simple-git in the Electron Main process. I exposed specific handlers via contextBridge in the preload script.

Instead of exposing a generic command runner (which is a security risk), I strictly typed the IPC channels for operations like git:status, git:commit, and git:push.

  1. Handling the UI State In the React frontend, I tied the Git status to the workspace context. Whenever a JSON file is saved (e.g., when a user modifies a request body or URL), it triggers a background Git status check. If there are changes, the UI updates to show a modified state, and users can commit directly from a custom Git panel.

  2. The Result What ended up happening is a tool where you open any local folder, and it automatically reads the .json request files and picks up the .git repository status. It treats API testing exactly like writing code.

I've open-sourced the core version of this project under the MIT license. If you're curious about the code, want to see how the Electron IPC bridge is set up with React, or just want a lightweight API client that doesn't spy on you, feel free to check it out:

GitHub Repo:https://github.com/Dobrosav/restless

Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.