/shinkgs

A JavaScript client for the KGS Go Server

Primary LanguageJavaScriptMIT LicenseMIT

Shin KGS

An unofficial JavaScript client for KGS Go Server.

Available at https://shin.gokgs.com/

Screenshot - iOS Safari

Goals

  • First-class web and mobile experience
  • Retain community vibe of KGS
  • Start small, release early
  • Work towards native versions (Electron, React Native, Cordova)
  • Bus factor > 1

Progress

  • Game lists
  • Game spectating and chat
  • Room chat
  • User chat (direct messaging)
  • View and edit user details
  • Submit challenge proposal (no negotiating)
  • Create challenge
  • Negotiate challenge
  • Automatch
  • Basic game playing
  • Full-featured game playing (fine-tuned UI, rengo, simul)
  • Review tools
  • Admin/moderation tools
  • Everything else

More detail: Version 1 Milestone

Contributing

Contributions welcome. Please check the Version 1 Milestone and Issues to help coordinate efforts. Feel free to create an issue if there isn't one already for what you have in mind.

Issues with the "difficulty: starter" label are good tasks to get started on. Reach out if you need any guidance!

Code Overview

This project uses JavaScript, React, and ES6+ with Flow types. VS Code (with eslint and flow extensions added) is a great editor for this setup.

State is managed with a Redux-like pattern: there is a single, primary source of truth for app state, plus a bit of component-local state. Messages describing actions are dispatched, which handlers then process to produce the next app state. Unlike typical Redux, no implicit context is used. Everything is passed down through props.

Development Setup

You'll need Node.js and Yarn.

To install and start a local dev server, run:

yarn
yarn start

Note: the dev server will use HTTPS, which is required to interact with the KGS API. You will have to trust the self-signed certificate.

Requests are sent to the official KGS API by default. To use a custom API endpoint:

REACT_APP_API_URL=https://example.com/api/access yarn start

(Note: Safari does not allow cookies from unvisited third-party domains, so in development mode requests will be proxied through a local server.)

If you don't have eslint or flow in your editor, you can check for errors with:

yarn lint

Deploying the Web App

The easiest way to deploy the app is to use the ▲now service:

yarn global add now
yarn deploy-now

This builds the app then pushes it out to the cloud with a unique URL.

Running an API Server

This project depends on the new JSON-based KGS API.

The official API is available at https://www.gokgs.com/json/. Obsolete older versions are (at least for now) available for download.

There's a Dockerfile in the kgs-api directory that makes running the older API on your local machine easy. To use it, install Docker, then:

cd kgs-api
docker build -t kgs-api .
docker run -p 8080:8080 kgs-api

This will start a server at http://localhost:8080

To deploy to now.sh using their Dockerfile support:

now kgs-api

References

Similar Projects