Getting started / Quickstart

Build your first
WorkOS app.

Turn a web page into a desktop app that opens text files from WorkOS Files. Start with Word Count, then make it your own.

example.txtWord Count
Hello from WorkOS3 words

Run the starter

You’ll need Python 3 and a browser for the local preview. To install your app, you’ll also need a static HTTPS host and WorkOS Browser on iPhone or iPad.

Unzip the download, open a terminal in the extracted workos-starter folder, and start a local server.

Terminal

python3 -m http.server 8000 --bind 127.0.0.1

Visit 127.0.0.1:8000. Choose Open a file and select the included example.txt. You should see example.txt · 3 words. The included SDK runs directly in the browser.

Make your first change

In app.js, find the line that assigns status.textContent inside showCount(). Replace it with this line to add a character count. Refresh the page and open the sample again.

app.js

status.textContent = handle.name + ' · ' + words + ' words · '
  + Array.from(text.trimEnd()).length + ' characters';

For the sample file you should see example.txt · 3 words · 17 characters. The code counts Unicode code points and skips trailing whitespace.

Find your way around

index.html
The app window, styles, and Open button.
app.js
The file picker, word counter, and listener for files opened from the desktop.
manifest.webmanifest
The launcher name, icon, file types, and requested WorkOS capabilities.
sdk/
The WorkOS client as browser-ready JavaScript modules. Import it locally.
example.txt
A three-word file for checking your changes.

Install it on WorkOS

  1. Upload the contents of the starter folder to a static HTTPS directory. Keep the sdk/ directory and the relative paths intact. For a first test, the hosted demo is already set up.
  2. Open the app’s directory URL in a regular WorkOS Browser tab. Choose ⋯ → Install to Desktop… → Install.
  3. Launch Word Count from the WorkOS desktop. Choose Open a file to count a text file. In a build with hosted capabilities enabled, you can also select a .txt file in Files and choose Open With… → Word Count.

To ship your own version, change the app name and icon, then share your HTTPS URL. See installation and updates for manifest changes and release-build support.