KamSafer is a web app that enables you to log your trip's information. The purpose, total kilometers travelled by your vehicle, and notes to include your destination.
- Create logs that enables you to log your trip's information using modern technologies:React.js.
- Allows the users used app to download his logs in excel version.
- Can log in using the general user and password of the Mercy Corps organization
- Select the car I’ll be using
- Confirm your trips and keep track of my kilometers travelled
- Show the report of all logged trips
- View trips by date
- Download an excel version of my reports
- Leave the account
- React.js : https://reactjs.org/docs/getting-started.html
- Sequalize : http://docs.sequelizejs.com/
- Express JS : https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs/Introduction
- Material UI : https://material-ui.com/
- The client folder contains the front end code
- The src folder contains the backend and DB code
- The editor begins at client/components/login/index.js
- config.js contains the dummy data for the app
- The entry point is an app.js file which manages all components, get and send data to the src/app.js file which contains all app endpoints
- node 8 & npm>5
- postgres
- run
git clone
of this repo andcd
into the folder - Provision a postgres database (either locally or remotely)
- In the root directory create a
.env
file- Add the following database environment variables, taking the values from the database you set up in the previous step:
DB_DIALECT, DB_HOST, DB_NAME,DB_PASSWORD, DB_USER
- A jwt secret variable, named
SECRET
- User log in variables,
USERNAME
andHASHED
. To generate the hash runnode lib/hasher [plaintext password]
and copy the printed value.
- Add the following database environment variables, taking the values from the database you set up in the previous step:
- commands (from root):
npm i
install server dependenciesnpm start
run production servernpm run dev
run dev server using nodemoncd client && npm i
install react app dependenciescd client && npm start
run dev-server react appcd client && npm build
build react app
- The server will run on
PORT=4000
while the dev react app will run atPORT=3000
- To initialise some cars in your database you need to run the
db_build.js
file insrc/database/config/
- Edit the file to change the
carsArray
data if you want to. - When you are happy with it, run the file using
node [path to file]
NOTE This will wipe the database completely. Do not attempt to run to edit anything in a production base. The file should abort ifDB_HOST
is notlocalhost
anyway but you should not even think about running this file if you have production database credentials in your.env
.
- Edit the file to change the
https://kamsafer.herokuapp.com/
- you should have a general username and password related to Mercy Core employees to login
- select the car model you want to use
- click add trip button to add trip, then add information about your trip
- click show report button to see all trips related to this car model
- click on Download report to get a excel version
- click logout to leave account
- Sama Amro
- Shaima Ihdoosh
- Orjwan Rajaby