Code Monkey home page Code Monkey logo

formsg's Introduction

FormSG

Build Status Coverage Status

Table of Contents

Features

FormSG is a form builder application built, open sourced and maintained by the Open Government Products team of the Singapore Government Technology Agency to digitise paper processes.

Notable features include:

  • 19 different form field types, including attachments, tables, email and mobile
  • Verified email and mobile phone fields via integrations with Twilio and AWS SES
  • Automatic emailing of submissions for forms built with Email Mode
  • End-to-end encryption for forms built with Storage Mode
  • (Singapore government agencies only) Citizen authentication with SingPass
  • (Singapore government agencies only) Corporate authentication with CorpPass
  • (Singapore government agencies only) Automatic prefill of verified data with MyInfo
  • (beta) Webhooks functionality via the FormSG JavaScript SDK.

The current product roadmap includes:

  • (in progress) Frontend rewrite from AngularJS to React
  • Enabling payments on forms
  • Electronic signatures
  • Notifications to form admins for Storage mode submissions
  • Integration with vault.gov.sg

Local Development (Docker)

Prerequisites

Install docker and docker-compose.

Running Locally

Run the following shell command to build the Docker image from scratch. This will usually take 10 or so minutes.

npm run dev

After the Docker image has finished building, the application can be accessed at localhost:5000.

If there have been no dependency changes in package.json or changes in the src/app/server.ts file, you can run

docker-compose up

which does not rebuild the Docker image from scratch. This command usually only takes ~15 seconds to finish starting up the image.

Accessing email locally

We use MailDev to access emails in the development environment. The MailDev UI can be accessed at localhost:1080 when the Docker container is running.

Environment variables

Docker-compose looks at various places for environment variables to inject into the containers. The following is the order of priority:

  • Compose file
  • Shell environment variables
  • Environment file
  • Dockerfile

FormSG requires some environment variables in order to function. More information about the required environment variables can be seen in DEPLOYMENT_SETUP.md.

We provide a .template-env file with the secrets blanked out. You can copy and paste the variables described into a self-created .env file, replacing the required values with your own.

Trouble-shooting

You can consult TROUBLESHOOTING.md for common issues that developers face and how to resolve them.

Testing

The docker environment has not been configured to run tests. Thus, you will need to follow the following local build guide to get tests running locally.

Testing Prerequisites

The team uses macOS for development.

Make you sure have the following node version & package manager on your machine:

  • "node": ">=14.17.0"
  • "npm": ">=6.0.0"
  • "mongo": ">=4.0.0"

Run

nvm install 14
npm install
pip install "localstack[full]"

to install node modules and Localstack locally to be able to run tests. Note that localstack[full] is only compatible with Python 3.7 and above.

Running tests

Unit tests

npm run test

will build the backend and run both our backend and frontend unit tests. The tests are located at tests/unit/frontend and tests/unit/backend.

If the backend is already built, you can run

npm run test-ci

End-to-end tests

npm run test-e2e

will build both the frontend and backend then run our end-to-end tests. The tests are located at tests/end-to-end. You will need to stop the Docker dev container to be able to run the end-to-end tests.

If you do not need to rebuild the frontend and backend, you can run

npm run test-e2e-ci

Architecture

An overview of the architecture can be found here.

MongoDB Scripts

Scripts for common tasks in MongoDB can be found here.

Contributing

We welcome all contributions, bug reports, bug fixes, documentation improvements, enhancements, and ideas to code open sourced by the Government Technology Agency of Singapore. Contributors should read CONTRIBUTING.md and will also be asked to sign a Contributor License Agreement (CLA) in order to ensure that everybody is free to use their contributions.

Support

Please contact FormSG ([email protected]) for any details.

Acknowledgements

FormSG acknowledges the work done by Arielle Baldwynn to build and maintain TellForm, on which FormSG is based.

Contributions have also been made by:
@RyanAngJY
@jeantanzy
@pregnantboy
@namnguyen08
@zioul123
@JoelWee
@limli
@tankevan

formsg's People

Contributors

dependabot[bot] avatar mantariksh avatar karrui avatar tshuli avatar liangyuanruo avatar seaerchin avatar lonerifle avatar frankchn avatar arshadali172 avatar snyk-bot avatar jia1 avatar orbitalsqwib avatar chowyiyin avatar yong-jie avatar r00dgirl avatar timotheeg avatar aniruddha-adhikary avatar awhdesmond avatar barnettx avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.