The motivation for building this app is the current traffic condition of Bengaluru.
Most of the People travel alone in their vehicle, even though people want to travel together they wouldnt know who stays near their route.
There are already ride sharing platforms but most of them are open for public, so the safety and security question is still open, if the app is private we need to pay money making it private. And for every ride we need to pay money, which doesnt make any sense.
Being nth car pool app, it should solve the fundamental problem of connecting people together and it should be free for the employees to use. Thats exactly what it does, just suggests people going near your destination.
This app is built on Firebase and follows serverless architechture. The running costs are almost nil. Which is major difference between this and other apps.
The app is running in my company since April 2017 without spending a penny on hosting and other services.
Follow the below steps for installing the app, Or email I can help you in installation.
https://the-ride-share.firebaseapp.com
- Go to https://firebase.google.com/
- Sign in
- Click "Get Started"
- Click "Add Project"
- Give a project name, click save
- From project home page go "Authentication" , click "Set up sign in method" and enable "Google"
- On the firebase project page, click on "Hosting" and click on get Started"
- Follow the instructions Install the firebase tools (Node and npm have to be installed)
- Type "firebase init" to initialise the app.
- Do the config as per the below image
- Clone the repo to a seperate directory
- Copy all the files except .firebaserc file
- Copy and replace all the existing files
- Go back to firebase project page and click "Add Firebase to your web app"
- Replace the contents firebaseConfig.js with your app cofig
//REPLACE THE CONFIG WITH YOUR CONFIG
var config = {
apiKey: "AIzaSyA9BvgAK00Af1lXWBiXbjQ1afKrm0oV3Cg",
authDomain: "the-ride-share.firebaseapp.com",
databaseURL: "https://the-ride-share.firebaseio.com",
projectId: "the-ride-share",
storageBucket: "the-ride-share.appspot.com",
messagingSenderId: "4721624756"
};
firebase.initializeApp(config);
-
Create one more gmail account, this will help sending the verification emails
-
Type in credentials for newly created gmail account
firebase functions:config:set gmail.email="" gmail.password=""
-
We need to set these things for nodemailer to send emails, other wise google will block the login
-
Remove captcha https://g.co/allowaccess
https://www.google.com/settings/security/lesssecureapps
https://accounts.google.com/b/0/displayunlockcaptcha -
Replace "gmail.com" in with your company domain
line 22 in "database.rules.json"
line 137 in app.js
line no 131 of index.html,
this makes sure your app stays private to your company. -
Set your city's geocode at line 386 and office geocode at line 568 in
mydetails.js
-
cd to functions directory and do type
npm install
, this will install necessary npm modules -
Add API keys for google maps, Visit for further instruction https://developers.google.com/maps/documentation/javascript/
-
In command line type "firebase deploy" and hit enter
-
After successful deploy, copy the hosting url and open in browser
Now you have private carpool app for you company For any question and clarification please email me.
- Delete the existing requests on a nightly basis
- Why? Whenever a person requests for a ride, the app reduces the capacity of car of the person who is offering ride
- We cannot track the completion of the ride currently, hence we cannot reset the capacity after the ride completion, hence every night we need to reset the capacity
- We have
removeActiveRequests
ahttp
infunctions/index.js
which will reset the capacity. - This needs to be called at regualr intervals, so we need to setup a cron job.
- We create and set a key to securely trigger this, for this we need npm packagge by name
crypto
, type the following in the command line.
npm install -g crypto
node -e "console.log(require('crypto').randomBytes(20).toString('hex'))"
- Copy the generated key and set it in
firebase
firebase functions:config:set cron.key="<GENERATED_KEY>"
- Verfiy if the right key is set
firebase functions:config:get cron.key
- Deploy this using
firebase deploy
- Now we have the endpoint to trigger and the structure of the url will be
https://us-central1-<PROJECT-ID>.cloudfunctions.net/removeActiveRequests?key=<YOUR_KEY>
- we will use https://cron-job.org/en/ to set up a nightly trigger, you can use any other service, we have chosen this as its free
- Open and sign up for
cron-job.org
, put the above url, and set to frequency to everyday 23.30 Hrs - You are all set !