Kamon Game on CLI, web, mobile.
This project is a set of 5 packages :
- @kamon/core: the logic of the game
- @kamon/cli: the game playable in CLI
- @kamon/webapp: the game playable on a browser and the API, built on the top of NestJS
- @kamon/mobileapp: the game playable on mobile, built with Expo and React Native
- @kamon/admin: manage users and games, build with React-admin
Almost all of these packages use a part of @kamon/core.
- docker
- docker compose
This command will build dockers containers and up these
make start-dev
# with build
EXTRA_PARAMS=--build make start-dev
You can access to applications as follow:
- Webapp: http://127.0.0.1
- Webapp Swagger: http://127.0.0.1/api
- Admin: http://127.0.0.1:8080
- PostgREST: http://127.0.0.1:3001
- PostgREST Swagger: http://127.0.0.1:8181
To stop all
make stop-dev
Disclaimer: you need a database to run the webapp and the API, at this time, you can use Docker to run it
All this packages use yarn workspace
, first, install every dependencies:
cd kamon
make install
Some packages like @kamon/webapp, @kamon/admin need a database.
First to first, make sure you followed the Before you start section to configure applications with .env
files.
Then start docker containers
docker compose up -d
- Node.js ^18
- yarn
## Re-run the script on change
yarn workspace @kamon/core watch
# build once
make build-core
# build watch, usefull to developp other apps
yarn workspace @kamon/core build -w
make test-core
- Node.js ^18
- yarn
## Re-run the script on change
yarn workspace @kamon/cli dev
# build once
make build-cli
# build watch
yarn workspace @kamon/cli build -w
## initialize a new game
make run-cli
## resume a game from a target save file
yarn workspace @kamon/cli start -f my_save_file.json
This package is build over NestJS, so all available command in NestJS are available here.
Edit the .env
file in ./webapp
as follow
#POSTGRES_HOST=kamon_postgres
POSTGRES_HOST=0.0.0.0 # access database in dev mode
yarn workspace @kamon/webapp db:migrate
# development
yarn workspace @kamon/webapp run start
# or
make run-webapp
# watch mode
yarn workspace @kamon/webapp run start:dev
# production mode
yarn workspace @kamon/webapp run start:prod
# unit tests
yarn workspace @kamon/webapp run test
# or
make unit-test-webapp
# e2e tests
yarn workspace @kamon/webapp run test:e2e
# or
make e2e-test-webapp
# test coverage
yarn workspace @kamon/webapp run test:cov
yarn workspace @kamon/webapp build
# or
make build-webapp
This package is build over Expo and React Native.
Before you want to run the app, you need to run @kamon/webapp
because it's the API of the game.
Create a .env
based on .env.local
and configure it. To use a local API (eg: localhost), use the same IP that Expo expose to you.
Exemple: your Expo application run on http://192.168.86.27:19000
, your API endpoint should look like http://192.168.86.27:3000
. That's it.
Install Expo Go on your phone and run
make run-mobileapp
First, you need an Expo account to build on the Expo Cloud.
When you have an account, you have to run these commands as explain here
npm install -g eas-cli
eas login
To build the application as an APK, run this
eas build --platform android --profile apk
This package is build over React-admin, and allow admin to manage users and games.
make dev-admin
# or
yarn workspace @kamon/admin dev
make dev-admin
# or
yarn workspace @kamon/admin build
make test-admin
# or
yarn workspace @kamon/admin test --run