A starter project for building modern cross-platform desktop apps in Go, HTML, Typescript and React.
This is really nothing more than a Typescript-flavoured "Create React App"-bootstrapped app combined with a modified example from the fine "Lorca" project.
Check out those projects for how to use each component.
Either just clone this repo and start coding, or repeat the simple steps taken to create it yourself to get that warm fuzzy feeling of having done it all "by hand".
Since this project builds on Lorca, you need Chrome installed to develop and run your app. You also need recent enough versions of Go (1.12), Node.js (v8.X) and npm (v5.2) installed.
- Clone this repo:
git clone --depth=1 https://github.com/erkkah/lorca-ts-react-starter.git <NEWPROJECTNAME>
- Go to the newly created directory:
cd <NEWPROJECTNAME>
- Install dependencies:
npm install
- Launch the app in development mode:
npm start
- Read the code and start building your app!
- Create a React app with Typescript:
npx create-react-app <NEWPROJECTNAME> --typescript
- Go to the newly created directory:
cd <NEWPROJECTNAME>
- Initialize the Go part of the project:
go mod init <APPNAME>
- Copy the Go stub files from this project to your project
- Copy the
scripts
part frompackage.json
to your project - Make sure to update
./app
inbrowser.js
to<APPNAME>
from above - Install
npm-run-all
since the scripts need it:npm install --save-dev npm-run-all
- Launch the app in development mode:
npm start
- Read the code and start building your app!
In the project directory, you can run:
Runs the app in the development mode. The "backend" Go part will launch Chrome to display the HTML content.
The page will reload if you make edits to the React parts. You will also see any lint errors in the console.
Builds the app for production, creating a single executable will all assets bundled. It correctly bundles React in production mode and optimizes the build for the best performance.
Runs the test suites for both Go and React parts.
To launch React tests in watch mode, run npm run react:test -- --watchAll=true