Run these commands:
yarn build:dev
docker-compose -f docker-compose.yml
Then open up 2 terminal windows and run following in each
cd ./packages/server
yarn start
cd ./packages/web
yarn start
Access the app at http://localhost:3000
- Lerna monorepo (https://classic.yarnpkg.com/blog/2017/08/02/introducing-workspaces/, https://github.com/lerna/lerna)
List of packages:
- chessground (it is the fork of https://github.com/ornicar/chessground - library used for chess UI)
- core-module (modules management)
- models (models interfaces for mongoDB entity schemas and for redux state)
- normalization (used for state normalization)
- server - backend(BE) part of the app
- types - types for API, actions, state
- web - frontend(FE) part of the app
- playground (future ideas)
- yarn - package manager (https://yarnpkg.com/)
- node.js - js runtime environment (https://nodejs.org/en/download/)
- mongodb - database (https://www.mongodb.com/)
- install node.js https://nodejs.org/en/
- install yarn package manager https://classic.yarnpkg.com/en/docs/install.
- install mongodb
- run mongodb
- run
yarn install
oryarn
in project root - run
yarn build:dev
in project root - run
start
script for wanted package
- application - used for global application types (types used by the application and the modules). In a way it represents simple and more complex global functions/classes of the application.
- modules - application type implementations (building blocks)
Use .env
file for local configuration. server
and web
have .env
file where default variables like api domain, db url, aws keys and mailgun endpoint are defined.
How and what to test.
An application infrastructure (interface) should be tested after defining types. The Infrastructure tests can be unit or integration depending on the tested part. The main difference between other tests is that these tests initialise whole application before testing.
Isolated inside a single module, test type depends on a tested part. Ideally should avoid initializing the application. Dependencies should be mocked, too many dependencies may be a sign that a system is too granular.
Doesn't exist yet but should be implemented with Cypress. TBD
As an application can be initialized for a production
or development
, it makes sense to implement a test
environment with data and features that can be initialized. TBD
run yarn build
. The output can be seen in the build
folder.
In order for Stockfish 14 to work certain headers have to be defined on the top document (index.html).
'Cross-Origin-Opener-Policy': 'same-origin',
'Cross-Origin-Embedder-Policy': 'require-corp',
Craco is used to configure devServer and nginx for the production. More on this can be found at nmrugg/stockfish.js#53
This issue was partially a reason for creating S3 proxy. The problem is to add needed headers to S3.
Details specific to chesstent.com setup
Letsencryp
Used primarily for controlling the S3 headers. All in all it seems like useful thing for the future.