To make the above installation working Goto dotenv
It is an Entry Management Cross-Platform Software built using Electron (a Node.js framework) and Firebase (for database), This app includes Email (Nodemailer Module) and SMS (Nexmo API) automation.
There are 2 collections: Host and Visits, which have entries as given below...
There are 2 categories Host and Visitor and 2 Constraint that Each Host can be visited by only one visitor and host can cannot leave until visitor leaves.
Host collection in database has an entry called "Session" which can take either true, false or "invalid"
So, initially there are 4 button:
- Add Host (always active)
- Remove Host (active iff any of host.session is found 'false')
- Check-In (active iff any of host.session is found 'false')
- Check-Out (active iff any of host.session is found 'true')
A form that stores Name,Email, Phone No and Address(abc) given by host ontu firebase, along with these entries, Time-in, time-out and session are also added where, time-in is timestamp of form submition, time-out is default to -1 and session is set to false.
Select the host to be removed, and click the button, all this button does is add update time-out of host to current timestamp and set session to "invalid". (that means host no longer available).
This makes Data remain in database and yet not included in visiting process
Dropdown box appends all hosts with session===false
.
A form that stores Name,Email, Phone No and Host ID(abc) given by visitor ontu firebase, along with these entries, Time-in and time-out are also added where, time-in is timestamp of form submition and time-out is default to -1.
It also update the Host(ID).session to 'true'. (making host accupied)
After this Email and a SMS is sent to Host using selected ID, stating the details of visitor.
Dropdown box appends all visitors with time-out===-1
.
Select the visitor to check out, and click the button, all this button does is update time-out of visitor to current timestamp and set session of host id it is associated with, to false. (that means host is no longer accupied).
After this Email and a SMS is sent to Visitor, stating the details of zer visit.
If you just want to do a simple test run of the application, you can first
- Clone the repository
$ git clone https://github.com/ra101/Entry-Management-Software.git
- Install dependencies by using the following commands.
$ cd Entry-Management-Software
$ sudo npm install
-
Obtain API Key & API Secret from Nexmo
-
Create an app in Firebase and obtain its Credentials from Firebase
- Create a
.env
file in root directory and assign the following environment variablesNOTE: don't version control your .env file, make sure .env is added in .gitignore file
$ touch .env #assuming you are in root directory of app
$ echo "EMAIL=<Your/Admin's Email Id>" >> .env
$ echo "PASS=<Your/Admin's Email Password>" >> .env
$ echo "FBKEY=<Firebase Key>" >> .env
$ echo "AUTHDOMAIN=<Firebase Authdomain>" >> .env
$ echo "DATABASEURL=<Firebase databaseURL>" >> .env
$ echo "PROJECTID=<Firebase ProjectID>" >> .env
$ echo "STORAGEBUCKET=<Firebase Storage Bucket>" >> .env
$ echo "MESSAGINGSENDERID=<Firebase Messaging SenderID>" >> .env
$ echo "APPID=<Firebase AppID>" >> .env
$ echo "NXKEY=<Nexmo API key>" >> .env
$ echo "NXSECRET=<Nexmo API Secret>" >> .env
- Firestore uses gRPC. This works in all types of Electron envs but you may see this error at first: βFailed to load gRPC binary module because it was not installed for the current systemβ . there is devDependencies to resolve that i.e. electron-rebuild, more on that in this Article.
$ npm install --save-dev electron-rebuild
Then, whenever you install a new npm package, rerun electron-rebuild:
$ npm run rebuild
- Finally run the application using
$ node start
Install electron-builder as devDep and run dist:
$ npm install --save-dev electron-builder
$ npm run dist
This will Create a "dist" named folder containing unpacked (folder with multiple files) and Installer (executable). These will show an error, as there is no .env file. To resolve this add .env in installed folder (in case of Installer) or .env directly to uppacked folder
- Add a file structure here with the basic details about files, below is an example.
.Entry-Management-Software
βββ .gitignore
βββ add.html
βββ app.html
|
ββββimages
β βββ host.png
β βββ visitor.png
|
βββ in.html
βββ index.js
βββ LICENSE
βββ min.html
βββ out.html
βββ package-lock.json
βββ package.json
βββ README.md
β
ββββscripts
β βββ app.js
β βββ display.js
β βββ form.js
β βββ messaging.js
β
ββββstylesheet
βββ app.css
βββ form.css
3 directories, 19 files