Skip to content

misterdrac/surveys-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📑 Surveys App

A secure and user-friendly survey web application built with Java Spring Boot, supporting:

  • OAuth2 (Google) and username/password authentication
  • Administrator-only user management
  • Dynamic survey completion
  • Viewing and downloading survey responses (PDF/CSV)
  • Role-based access control using Spring Security

🚀 Features

  • 🔐 Authentication

    • Google OAuth2 login
    • Username/password login (with BCrypt password encoding)
    • JWT-based token generation for API access
  • 🧾 Surveys

    • Users can complete randomly generated surveys
    • Results are stored and linked to user accounts
    • Each user can complete survey only once, this rule sticks also for administrators
    • Survey questions can be different kinds of topics, this instance used for IT Department
  • 📊 Survey Results

    • Users can view their own survey responses
    • Administrators can view all users' responses
    • Administrators can download each users' response in PDF or CSV format
  • ⚙️ Administrator page

    • Home page is rendered with more buttons, also containing ones regular users have access to
    • List all users and shows their survey results
    • Promote/demote users between roles, administrator can't change role of other administrators, prevent demotion of admins via disabled buttons

🛠️ Tech Stack

  • Backend: Java 17, Spring Boot, Spring Security, Spring Data JPA
  • Frontend: Thymeleaf, HTML/CSS/JavaScript
  • Database: PostgreSQL 17.4 (or other JDBC-compatible DB)
  • PDF/CSV Export: iText 8

🔑 Roles & Permissions

Role Can Complete Survey View Own Responses View All Users Modify Roles Download Others' Responses
user
administrator

🧪 Running Locally

🐘 Prerequisites

  • Java 17+
  • Maven
  • PostgreSQL 17.4+ database (or configure another one in application.properties)
  • Google OAuth2 Client ID and Secret (if OAuth is enabled)

▶️ Build & Run

# Clone the repository
git clone https://github.com/misterdrac/surveys-app.git
cd surveys-app

# Run the app
./mvnw spring-boot:run
  • or press run button if you are using IntelliJ IDEA Community Edition 2025.1

⚙️ Configuration

To run application locally, you need to configure your database and Google OAuth2 credentials.

Create or modify file at

src/main/resources/application.properties

Paste following configuration and update upholders with your credentials

application.properties

spring.datasource.url=jdbc:postgresql://localhost:5432/surveydb
spring.datasource.username=your_db_user
spring.datasource.password=your_db_pass

spring.security.oauth2.client.registration.google.client-id=your-client-id
spring.security.oauth2.client.registration.google.client-secret=your-client-secret

🌐 How to access the application when you launch it?

  • App entry point: http://localhost:8080/login
  • Other endpoints: /complete-registration, /main-page, /create-a-survey, /list-surveys, /results-page, /take-a-survey, /user-management, ...

📉 Database Scheme (Entity Relationship diagram)

  • Here's database ER Diagram, created by dbdiagram.io

  • it includes all entities used during development of this project

    PostgreSQL ER Diagram

📄 License

This project is licensed under the MIT License.


🤹 Author

  • Dario Golubović

🧮 Final words

In my own eyes, this project brought me a lot of new knowledge that I'm sure will fuel me in my future advances. Maybe in near future, I would continue to work on it, but for now, I will look forward to new projects. This project helped me grasp more about Spring Boot and it's security features. With also whole workflow from front-end to back-end using JPA and Hibernate. I'm really happy how this turned and I'm open for suggestions for improvements.

About

Web app for secure survey participation with randomly selected 5-question sets, JWT and OAuth2 login, and admin export tools (PDF/CSV)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors