ryan-west-casino / bowie-backend

Backend for casino lobby application, frontend repo is at https://github.com/ryan-west-casino/bowie-frontend

Home Page:https://bowie.casinoman.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bowie Backend

Bowie is a simple casino lobby. I've created this to learn more about frontend and to fill my portfolio with code, I will be working on it while bored finding job/next challenge.

Development

This is an app I've developed from scratch utilizing Lumen (backend), React/NextJS (frontend), Docker/Kubernetes (container).

This repository contains the backend. For frontend check other repository. Get app run in 1 command on Docker.

Demo

You could check if bowie.casinoman.app is up (vercel.com hosted frontend connected to this backend code in middleware), to give impression:

screen recordings:

login/register screen

pre auth screen login/register more images @ me.casinoman.app or at ryan-west-casino/bowie-media

Casino Features

Has 2 inhouse games which really are filler games, external game is an example available (but obviously you would need to build in your api).

By default you start with 100$ balance, you can change this in App\Http\Controllers\AuthController.

Frontend

Frontend is seperately run and is not in this repository, you can run this in vercel.app, check frontend repository for this.

Setup backend: development/staging

The oficial php image from Google Cloud Platform is updated once in a lifetime so I decided to manage my own php images.

  • Set the .env variables, see .env.example that is already configured to point to pgsql and redis services
  • Run the container with docker-compose up. Alternatively, if you have an older laptop, try running remotely with Blimp.
  • Enter into app container with docker exec -it default-structure-app bash
  • Run php composer, something like composer install --no-cache --no-ansi -n -o
  • Run the migrations with php artisan migrate:fresh
  • Run php artisan key:generate to generate secret hash
  • Run php artisan jwt:secret to set JWT auth secret

And it's up and running, set public domain to this api on frontend :)

Setup backend: production

See the contents of the .k8s folder :)

Alternative Images

If you would turn this setup up for production and scale, you should probably be using alpine on most php images, you can find example in Dockerfile.alpine.

Base Lumen API Features

  • 2FA
  • ACL
  • Audit
  • CORS
  • Device authorization
  • Etag
  • Lumen (9x)
  • Login
  • Login history
  • Multiple localizations, preconfigured with en_US and pt_BR
  • Password reset
  • Password must not be in one of the 4 million weak passwords
  • PHPCS PSR2, phpinsights and sonarqube analysis
  • Register
  • Swoole
  • Tests
  • Transactional events: Listen to events and send notifications only if the transaction is commited
  • uuid

Database structure

Screen Shot 2019-05-26 at 17 55 32

Routes

Screen Shot 2019-05-26 at 17 56 41

About

Backend for casino lobby application, frontend repo is at https://github.com/ryan-west-casino/bowie-frontend

https://bowie.casinoman.app


Languages

Language:PHP 57.8%Language:Blade 39.6%Language:Dockerfile 1.7%Language:Shell 0.9%