Coder Social home page Coder Social logo

babyfoot-manager's Introduction

2024 UPDATE: It was a project for a job application as a Fullstack Developer. It was fun to create, and I got the job! The repo is now public since I'm not working with them anymore.

Babyfoot Manager

Introduction

Mnage babyfoot games and chat with your friends in live. The application allows users to create games and update the game status (in progress / done) with other users in real-time. You can tchat with other people and make the babyfoot game crazier !!

Demo

Web Capture

Table of Contents

Babyfoot API Documentation

To view the API documentation locally, visit localhost:3010/api/v1.

Setup

To run and deploy the application, you may install Docker and Docker-compose. Then, follow the setup through docker-compose section. Containers make managing the project easier. When you edit a file, it edits the file on the container automatically.

Otherwise, you can set up and run the project locally on your laptop without containers. Follow the Installation without docker-compose section.

Quick Start

Installation through docker-compose

Ensure you have installed docker-compose and docker before continuing; otherwise, install here.

You must create at the root directory an env file called ".env" with the following configuration:

PGHOST='db.babyfoot.website.com'
PGPORT=5432
PGUSER='root'
PGPASSWORD='root'
PGDATABASE='babyfoot'
PORT=3010

Create a directory, postgres-data, that will be used by postgres container to persist the data:

$ mkdir postgres-data

to run the project:

$ docker-compose up -d

Now the web application is running on http://localhost:3010. You can develop then refresh your browser to see the changes.

To run the unit tests, you must keep the containers up:

$ docker-compose -p bf-test run -p 3000 --rm bf-server npm run test

to stop the project:

$ docker-compose down

Installation without docker-compose

You must have postgresql installed before continuing, check-out.

If you have not created a user, you should run execute the following command: createuser <username> --createdb. First, you need to create your database with the following command:

$ createdb -h localhost -p 5432 -U $USER babyfoot

Then create the tables by dumping the database:

$ psql babyfoot < ./db/init.sql

If you want to check your database on postgresql, you can run: psql -U $USER -d babyfoot and display the tables in the psql cli with: \dt;

Create a the root directory with an env file ".env" with the following configuration:

PORT=3010 # Server port
PGHOST='localhost' # Postgresql Host
PGPORT=5432 # Postgresql Port
PGUSER='$USER' # Postgresql User - insert your laptop username
PGPASSWORD=null # Postgresql password by default null
PGDATABASE='babyfoot' # Database name

Then, install the required packages in the root directory:

$ npm install

Launch the project with the following command:

$ npm start

Now the web application is running on http://localhost:3010

To launch the tests, execute the command:

$ npm test

File Structure

Within the download, you will find the following directories and files:

|-- Babyfoot Manager,
    |-- .dockerignore',
    |-- .gitignore',
    |-- Dockerfile',
    |-- README.md',
    |-- app.js',
    |-- docker-compose.yml',
    |-- package-lock.json',
    |-- package.json',
    |-- api',
    |   |-- index.js',
    |-- bin',
    |   |-- www',
    |-- db',
    |   |-- init.sql',
    |-- doc',
    |   |-- captured.gif',
    |   |-- structure.jpg',
    |   |-- swagger.yml',
    |-- public',
    |   |-- index.html',
    |   |-- favicons',
    |   |   |-- android-icon-144x144.png',
    |   |   |-- android-icon-192x192.png',
    |   |   |-- android-icon-36x36.png',
    |   |   |-- android-icon-48x48.png',
    |   |   |-- android-icon-72x72.png',
    |   |   |-- android-icon-96x96.png',
    |   |   |-- apple-icon-114x114.png',
    |   |   |-- apple-icon-120x120.png',
    |   |   |-- apple-icon-144x144.png',
    |   |   |-- apple-icon-152x152.png',
    |   |   |-- apple-icon-180x180.png',
    |   |   |-- apple-icon-57x57.png',
    |   |   |-- apple-icon-60x60.png',
    |   |   |-- apple-icon-72x72.png',
    |   |   |-- apple-icon-76x76.png',
    |   |   |-- apple-icon-precomposed.png',
    |   |   |-- apple-icon.png',
    |   |   |-- browserconfig.xml',
    |   |   |-- favicon-16x16.png',
    |   |   |-- favicon-32x32.png',
    |   |   |-- favicon-96x96.png',
    |   |   |-- favicon.ico',
    |   |   |-- manifest.json',
    |   |   |-- ms-icon-144x144.png',
    |   |   |-- ms-icon-150x150.png',
    |   |   |-- ms-icon-310x310.png',
    |   |   |-- ms-icon-70x70.png',
    |   |-- images',
    |   |   |-- delete.png',
    |   |-- javascripts',
    |   |   |-- main.controller.js',
    |   |   |-- main.design.js',
    |   |   |-- babyfoot',
    |   |   |   |-- babyfoot.api.service.js',
    |   |   |   |-- babyfoot.controller.js',
    |   |   |   |-- babyfoot.design.js',
    |   |   |-- services',
    |   |   |   |-- websocket.service.js',
    |   |   |-- tchat',
    |   |       |-- tchat.api.service.js',
    |   |       |-- tchat.controller.js',
    |   |       |-- tchat.design.js',
    |   |-- stylesheets',
    |       |-- babyfoot.css',
    |       |-- global.css',
    |       |-- tchat.css',
    |       |-- themes.css',
    |-- routes',
    |   |-- api.js',
    |   |-- index.js',
    |-- test',
        |-- api.test.js',

Project Structure

structure schema

babyfoot-manager's People

Contributors

steevepay avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.