Skip to content

A microservice-based application that enables users to conduct surveys anonymously.

Notifications You must be signed in to change notification settings

SujanKumarMitra/survey-app

Repository files navigation

Anonymous Surveys

An application which allows users to conduct surveys anonymously.

This application has two actors

  1. Survey-Creator: One who creates the survey.
  2. Survey-Respondent: One who responds to the said survey.

The reason it is called Anonymous is;

  • Survey-Creator does not know who are submitting the responses (unless respondent has implicitly provided).
  • Survey-Respondent does not who has created the survey (unless creator has implicitly provided).

Features

  • Create survey forms with a few clicks
  • Wide range of widgets for various types of questions
  • Question types include:
    • Text
    • Date
    • Time
    • Single Choice (Radio)
    • Multiple Choice (Checkbox)
  • Share submission link and start monitoring responses.
  • Download all responses locally in CSV format.

Workflow:

  • Survey-Creator first creates a survey.
  • A survey consists of one or more-than one question(s)
  • Questions can be marked as compulsory
  • Survey-Creator submits to create the survey.
  • After successfully creating a survey, the following are generated:
    • A unique survey-ID
    • An access key (to access responses)
    • Submission link to submit responses
  • Survey-Creator will share the submission link with the Survey-Respondent(s).
  • Survey-Respondent(s) visits the submission link and submits their response.
  • Survey-Creator access with survey responses, with the survey-ID and access key generated after survey creation.
  • Responses are displayed in the form of a table.
  • Survey-Creator downloads the survey-responses in the form of CSV.

Dependencies

  • Java 11
  • Node.JS
  • MongoDB (database)
  • Redis (cache)

Design

This whole system is split into different microservices.

  • Data Storage Service: Responsible for storage and retrieval of created surveys and its submissions. (acts as the DAO layer)
  • Form Service: Responsible for handling form-creation and submission of surveys.(acts as the service layer)
  • API Gateway: Responsible for routing requests from clients to the microservices.
  • Discovery Service: Service Registry for microservice inter-communication.
  • Config Server: Centralized Configuration Server to provide configurations to the microservices.
  • App-UI: (Not a microservice) but acts as main front-end client app.

To Start

  1. Clone the project (including submodules)
  2. Navigate to project root directory
  3. Specify MongoDB configuration in data-storage-service-dev.yml
  4. Specify Redis configuration in form-service-dev.yml
  5. Start your MongoDB and Redis Server
  6. Run the following commands to start spring-boot apps (for first two commands; wait until it's fully up and running):
    1. ./mvnw spring-boot:run -f discovery-server/pom.xml &
    2. ./mvnw spring-boot:run -f config-server/pom.xml &
    3. ./mvnw spring-boot:run -f gateway-server/pom.xml &
    4. ./mvnw spring-boot:run -f data-storage-service/pom.xml &
    5. ./mvnw spring-boot:run -f form-service/pom.xml &
  7. Open http://localhost:8761 to see if these four instances are showing registered or not.
  8. Navigate to app-ui directory
  9. Run the following commands to start react app:
    1. npm run build
    2. npx serve -s build/ &
  10. Open http://localhost:5000

To Stop

  1. Open http://localhost:8761
  2. Navigate to Instances currently registered with Eureka
  3. Note down the ports of the services (Check the Status column and last 4 digits are the port number on which the services are listening to)
  4. Run the following command for each terminal
    • curl -X POST http://localhost:${PORT}/actuator/shutdown
    • replace PORT with the actual port
  5. Finally run curl -X POST http://localhost:8761/actuator/shutdown to terminate the Eureka server.
  6. Run kill $(lsof -t -i:5000) to stop npm serve
  7. Don't forget to stop your MongoDB and Redis servers.

Screenshots

  • Homepage:

  • Create Survey:

  • Widgets:

  • Survey Creation Success:

  • Submit Response:

  • Date & Time Widgets:

  • Submit Success:

  • Access Response:

  • Responses:

  • Downloaded Responses CSV file: