{"id":13554232,"url":"https://github.com/jschmidtnj/formsapp","last_synced_at":"2025-04-03T06:31:20.692Z","repository":{"id":77856184,"uuid":"145619714","full_name":"jschmidtnj/formsapp","owner":"jschmidtnj","description":"A workflow form-making application originally created for Colgate-Palmolive","archived":false,"fork":false,"pushed_at":"2018-08-29T02:32:48.000Z","size":570,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-04T02:32:48.443Z","etag":null,"topics":["bootstrap-select","bootstrap4","datatables","firebase","firebase-auth","firebase-functions","firebase-hosting","firebase-realtime-database","firebase-storage","formbuilder","forms","jquery","jquery-ui","jquery-validation","jszip","nodejs","vuejs","webpack","workflow","workflow-engine"],"latest_commit_sha":null,"homepage":"https://formsapp-9fe5b.firebaseapp.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jschmidtnj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-08-21T21:07:57.000Z","updated_at":"2019-11-01T18:32:33.000Z","dependencies_parsed_at":"2023-03-04T05:30:44.220Z","dependency_job_id":null,"html_url":"https://github.com/jschmidtnj/formsapp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jschmidtnj%2Fformsapp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jschmidtnj%2Fformsapp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jschmidtnj%2Fformsapp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jschmidtnj%2Fformsapp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jschmidtnj","download_url":"https://codeload.github.com/jschmidtnj/formsapp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246948003,"owners_count":20859359,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bootstrap-select","bootstrap4","datatables","firebase","firebase-auth","firebase-functions","firebase-hosting","firebase-realtime-database","firebase-storage","formbuilder","forms","jquery","jquery-ui","jquery-validation","jszip","nodejs","vuejs","webpack","workflow","workflow-engine"],"created_at":"2024-08-01T12:02:42.738Z","updated_at":"2025-04-03T06:31:19.232Z","avatar_url":"https://github.com/jschmidtnj.png","language":"JavaScript","readme":"# formsapp see it at https://workflows.tk\n\nThis application is created with Firebase, Bootstrap, Vuejs, jQuery formbuilder, and vanilla html. No framework was used, due to initial compatability issues. The goal is for the frontend to be serverless, and to use cloud-functions to fill in the gaps. In order for this website to have secure database calls without a server, database rules were added in firebase to ensure that only users who login from a verified domain email have the ability to view response data. Follow the steps below for installation and testing.\n\n## generate static distribution files\n\nFirst clone the repository (it works best in linux): `git clone --recursive https://\u003cgithub-account-name\u003e:\u003cgithub-account-token\u003e@github.com/\u003corganization-name\u003e/formsapp.git \u0026\u0026 cd wiki \u0026\u0026 git pull origin master \u0026\u0026 cd .. \u0026\u0026 ls`.  \nThen install [yarn](https://yarnpkg.com/lang/en/docs/install/#debian-stable).  \nRun `yarn` in the main directory.  \nFinally `dist/index.html` in a web-browser and make sure the splash page works.  \n\n## edit configuration file\n\nOpen `src/config/config.json` in a text editor. Go to [firebase](https://console.firebase.google.com) and create a new project. Then in `Project Overview`, click `\u003c/\u003e` to add a web app. Copy the fields in the `var config`, and paste the values in the `src/config/config.json` `firebase` section. Next edit the `companyemailregex` to include regex that matches your company's email address (`^.*@gmail.com$` only allows gmail accounts to see response data). Finally, edit the values in `other` as needed.\n\n## edit CORS\n\nThe file `cors.json` is needed to allow file downloads from Firebase Storage. To configure CORS, download the [gsutil utility](https://cloud.google.com/storage/docs/gsutil_install) on your computer (again, linux preferred), and run `gcloud init` to sign in. Then run `export BOTO_CONFIG=/dev/null` on linux to prevent a bug in the program. Finally, run `gsutil cors set rules/cors.json gs://\u003cyour-cloud-storage-bucket\u003e` in the parent directory to add the CORS rules, obviously changing the command for your storage bucket.\n\n## edit firebase rules\n\nThe file `database.rules.json` contains obviously the rules for users to access the database. It is fairly self-explanatory, and the only thing you have to change is `auth.token.email.matches(/.*@gmail.com$/)` to your company's regex email address domains. Any field with this rule added protects the data from being accessed by users with outside email address domains. `firebase.indexes.json` can be changed to add new indexes, which is important for speeding-up queries. `firestore.rules` can be left alone, along with storage.rules.json, because these files are not being used. `storage.rules` must be changed to include your company's email address domain regex in the expression `request.auth.token.email.matches(\".*@gmail.com$\")` to prevent people outside the company from uploading and downloading maliciously.\n\n## update rules in firebase\n\nCopy the contents of the file `database.rules.json` to the Database rules under `Database \u003e Realtime Database \u003e Rules`.  \nCopy the contents of the file `storage.rules` to the Storage rules under `Storage \u003e Rules`.\n\n## run locally\n\nTo just use the static files locally, install nodejs and npm [here](https://nodejs.org/en/download/package-manager/). Then run `npm install` in the same directory as `package.json`, followed by `npm run build`. This should generate static files in the `dist` folder (it usually takes a few minutes). Open some of the files in your web browser.  \n**Note:** Social login will not work with just opening the static files - a web server is needed. Email sign-in, however, will work.\n\n## run on nginx (or any web server)\n\nTo run the website on an nginx webserver, download Nginx ([here](https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-16-04) are instructions for downloading on Ubuntu 16.04) and point the web server to the `dist` folder. You can use the example configuration file `nginx.conf`. Installing on a server works in the exact same way, except you just go to the server's ip address.\n\n## deploy firebase functions\n\nTo start, install firebase tools: `npm install -g firebase-tools`. Login to the email used with your firebase account with `firebase login --interactive` (graphical login) or `firebase login --no-localhost` (terminal login). Then run `firebase deploy --only functions` to add the functions.\n\n## run on firebase hosting\n\nFirebase hosting was used in the deployment of this project because it keeps everything in one place, is cheap, and works relatively well compared to other options. To start, install firebase tools: `npm install -g firebase-tools`. Then login to the email used with your firebase account with `firebase login --interactive` (graphical login) or `firebase login --no-localhost` (terminal login). Then run `firebase deploy` to deploy the entire app to firebase. Go to the outputted URL to verify it worked.\n\n## add custom url\n\nTo add a custom URL, navigate to the `hosting` page and click `add domain`. Then configure your DNS rules wherever your domain name is hosted, and soon you'll be all set. There are plenty of free urls (my favorite website for this is [freenom](http://freenom.com/)) for you to get started.\n\n## add google analytics\n\nNavigate [here](https://analytics.google.com/analytics/web/provision). Sign up with the google account you used for your firebase app. Add the custom url you created as the website. Once all the terms are accepted, copy the global site tag url and paste it in every html file header located in `src/html/`.\n\n## add cloud functions\n\nThere are a few cloud functions used in this project to provide email notifications with approvals / rejections and initial submissions to workflow. They are found in the `functions/index.js` file. The first function is `sendApprovalEmailNotification`, which sends an email at each change in approval in a workflow chain, to the next group of approvers. This way the next group of approvers is notified only when needed at the approval. The next function `sendApprovedRejectedEmailNotification` sends an email to the submitter of the form when the form is finally approved or rejected by the workflow chain. The function `accountcleanup` deletes accounts that were created but not verified, and is triggered by a cronjob. Run `firebase deploy --only functions` to deploy all of the functions. See below for cronjob information.\n\n## add Cronjob to accountcleanup cloud function\n\nCloud Functions does not natively supports cron jobs. We are working around this by executing the code as an HTTPS-triggered function. Then simply use an external service to periodically \"ping\" the URL.\n\nHere is a non-exhaustive list of external services for cron jobs:\n - https://cron-job.org/\n - https://www.setcronjob.com/\n - https://www.easycron.com/\n - https://zapier.com/zapbook/webhook/\n\n### Trigger rules\n\nThe function triggers when the HTTP URL of the Function is requested.\n\n### Deploy and test\n\nSet the `cron.key` Google Cloud environment variables to a randomly generated key. This will be used to authorize requests coming from the 3rd-party cron service. For this use:\n\n```bash\nfirebase functions:config:set cron.key=\"YOUR-KEY\"\n```\n\nYou can generate a random key, for instance, by running:\n\n```bash\nnode -e \"console.log(require('crypto').randomBytes(20).toString('hex'))\"\n```\n\nThe url to use with cron jobs is as follows:\n\n```url\nhttps://us-central1-\u003cPROJECT-ID\u003e.cloudfunctions.net/accountcleanup?key=\u003cYOUR-KEY\u003e\n```\n\n## credits\n\nThank you [Chad](https://codepen.io/hellochad/pen/weMpgE) for your awesome 404 error page, and [BlackRockDigital](https://github.com/BlackrockDigital/startbootstrap-new-age) for the great Bootstrap template. For the icons and fonts, [icomoon](https://icomoon.io) is great paired with [fontawesome](https://fontawesome.com/).\n","funding_links":[],"categories":["JavaScript","firebase"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjschmidtnj%2Fformsapp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjschmidtnj%2Fformsapp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjschmidtnj%2Fformsapp/lists"}