BattleStax is a stateful JAMStack game that is wholesome fun for the entire crew.
BattleStax's folder structure is (mostly) generated from Create React App. We then add a Netlify Functions and Github Actions.
- .github - Github Actions configuration
- .storybook - Storybook Documentation Storybook configuration
- functions - Netlify Functions Lambda function definition
- public - Static files
- src - create-react-app source files
- tutorial - tutorial content
- A Github account - Github
- A fork of the
BattleStax Tutorial
repository - Repository - NodeJS 12 - Download - Recommended alternative: Setup your local development environment with nodeenv
- A Netlify account (it's free!) - Netlify
- An Astra account and database (it's free!) - Astra
Using nodeenv allows you to keep your NodeJS version and dependencies isolated for the project you're
working on. To get started using it for BattleStax, install it using homebrew or easy_install
.
# install using homebrew
brew install nodeenv
# install using easy_install
sudo easy_install nodeenv
Once nodeenv is installed, setup a virtualenv in the project folder, and then activate it.
# setup a nodeenv in the venv folder using NodeJS 12
nodeenv venv --node=12.18.4
# activate the nodeenv
. venv/bin/activate
Create a .env
file and fill it with values from the .env.example
file.
Make sure the package dependencies are installed
# install dependencies
npm install
Then, start the app in dev mode. Changes in the src
or functions
directories will trigger reloads.
# start battlestax in dev mode
npm run dev
To run storybook, make sure you have some {ComponentName}.stories.js files and then:
# start storybook
npm run storybook
Test your react/redux client
# run the client tests
npm test
Test your netlify functions
# run the function tests
npm run test:functions