This is an Analytics Tool I made using Node.js and React.js.
An image is placed in the footer of a website and fires a request to an API every time a page loads:
<img src="http://api.my-analytics.test/visits/create/{{site-id}}">The API processes the request and creates a visit containing information about the country and city from which the request has been made, the device that has been used, the website that received that visit and the user who owns it.
The visit is then stored in a MongoDB collection.
The API also provides routes to register / login users and authenticate them (using JSON Web Token, Bcrypt and JSON Schemas).
From a front-end interface, the user can then access his websites analytics data that are represented using charts in order to ease their reading (see screenshots below).
Ansible is used locally to provision the Virtual Machine built with Vagrant and in production to provision the VPS.
Capistrano is used to deploy the application and execute commands remotely.
Clone project:
$ git clone git@github.com:julienreo/my-analytics-react-node.gitAdd api.my-analytics.test host to /etc/hosts file:
$ sudo vim /etc/hosts
# Add the followings IP address / host pairs
192.168.33.90 app.my-analytics.test
192.168.33.90 api.my-analytics.testCreate, launch and SSH into the Vagrant:
$ vagrant up
$ vagrant sshInstall dependencies:
$ cd /var/www/my_analytics/api
$ yarn installStart API:
$ cd /var/www/my_analytics
$ pm2 start dev.config.jsonInstall dependencies:
$ vagrant ssh
$ cd /var/www/my_analytics/app
$ yarn installLaunch app:
$ yarn startAccess app through your browser: http://app.my-analytics.test
$ cap production deploy



