Skip to content

A memory card game with user management that will test your wits!

License

Notifications You must be signed in to change notification settings

jacogreyling/pexeso

Repository files navigation

Waffle.io

pexeso

A memory card game that will test your wits! Three rounds, each one becoming progressively more difficult than the previous round. It also includes user registration, game statistics and a leaderboard (admin users) for those who dare to compete!

You can find an example here: https://pexeso-heroku.herokuapp.com

Features

Technology

This project is forked from Aqua which is built with the hapi framework. Hapi is a Node.js project used by Walmart to handle all (millions) mobile transactions. We're also using MongoDB as a data store for user registration and game scores.

Game cards are retrieved from various data sources via the CA Live API Creator using RESTful API's. Statistics are provided through a custom build telemetry plug-in. It uses Redis as a global state store and Hapi's multi-strategy object caching service called catbox. This allows for scaleability in a multi server environment.

The front-end is built with React developed by Facebook. We use Redux as our state container. Client side routing is done with React Router. Time keeping and formatting is done by the excellent library Moment.js. Graphs are built using Chart.js, a phenomenal open source HTML5 charting project. Unit testing is done via Lab and API / Performance testing with CA BlazeMeter and JMeter.

Lastly, we're using Gulp and webpack for our build and packaging system and CA CD Director for continuous delivery orchestration, deploying to Amazon AWS on-demand.

Requirements

You need Node.js v8.1.x or above installed. You will also need MongoDB and Redis installed and running on localhost. You can optionally download and install the CA Live API Creator to create / secure your public facing API's.

We use bcrypt for hashing secrets.

Installation

$ git clone git@github.com/jacogreyling/pexeso.git
$ cd pexeso
$ npm install

Configuration

Simply edit config/config.js. The configuration uses confidence which makes it easy to manage configuration settings across environments. Don't store secrets in this file or commit them to your repository.

Instead, access secrets via environment variables. We use dotenv to help make setting local environment variables easy (not to be used in production).

Simply copy .env-sample to .env and edit as needed. Don't commit .env to your repository.

First time setup

WARNING: This will clear all data in the following MongoDB collections if they exist: accounts, adminGroups, admins, authAttempts, sessions, users, scores and statistics.

$ npm run first-time-setup

# > pexeso@0.0.0 first-time-setup /home/jgreyling/projects/pexeso
# > node first-time-setup.js

# MongoDB URL: (mongodb://localhost:27017/pexeso)
# Root user email: jgreyling@gmail.com
# Root user password:
# Setup complete.

Running the app

$ npm start

# > pexeso@0.0.0 start /home/jgreyling/projects/pexeso
# > gulp react && gulp

# [23:41:44] Using gulpfile ~/projects/pexeso/gulpfile.js
# ...

Now you should be able to point your browser to http://127.0.0.1:8000/ and see the welcome page.

nodemon watches for changes in server code and restarts the app automatically. gulp and webpack watch the front-end files and re-build those automatically too.

Running in production

$ node server.js

Unlike $ npm start this doesn't watch for file changes. Also be sure to set these environment variables in your production environment:

  • NODE_ENV=production - This is important for many different optimizations, both server-side and with the front-end build files.
  • NPM_CONFIG_PRODUCTION=false - This tells $ npm install to not skip installing devDependencies, which we need to build the front-end files.

Want to contribute?

Contributions are welcome. If you're changing something non-trivial, you may want to submit an issue before creating a large pull request.

License

MIT

Special Thanks

A special thanks goes out to Reza Akhavan from Aqua who created the boilerplate project with built-in registration, user management and more!

The game is based on the excellent work done by ZeroSpree and ported to React by the pexeso development team.

The server side start-up script for Linux-based systems running Node.js from chovy, Modified for Amazon environments.

About

A memory card game with user management that will test your wits!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •