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.
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 !!
To view the API documentation locally, visit localhost:3010/api/v1.
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.
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
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
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',