DEV Community

Cover image for I developed a Smart Frontend Application for Personality Assessment
Muhammad Usman
Muhammad Usman

Posted on

36 3 3 5 6

I developed a Smart Frontend Application for Personality Assessment

How Our Personality Assessment Application Works

Table of Contents

  1. Overview
  2. Architecture
  3. User Flow
  4. Technical Components
    • 4.1 HTML Structure
    • 4.2 CSS Implementation
    • 4.3 JavaScript Logic
  5. Question Structure
  6. Scoring System
  7. Result Calculation
  8. Special Features
  9. Third-Party Integrations

Link to actual frontend application:
Click: Personality Assessment Test

Here is the source code, you can use it however you like:
And checkout your personality, and share it with your social media, if you like it.

1. Overview of the Personality Assessment Application

This personality assessment is a frontend web-based application that check user personality traits by asking 21 multiple-choice questions.
It provides:

  • Real-time progress tracking
  • Interactive question presentation
  • Visual result representation
  • Personality type classification
  • Social sharing capabilities

2. Architecture of this Personality Assessment Application

Personality Welcome Screen

A Three-screen single-page application:

  1. 1st is Welcome Screen
  2. 2nd is Test Screen
  3. Third and final is Results Screen

3. User Flow: How the Application works for the User?

Welcome Screen β†’ Start Test β†’ Answer Questions β†’ View Results β†’ (Share/Retake)
Enter fullscreen mode Exit fullscreen mode

4. Technical Components of the Application

4.1 HTML Structure

Three main sections:

<!-- Welcome Screen -->
<div class="screen welcome-screen active">...</div>

<!-- Test Screen -->
<div class="screen test-screen">...</div>

<!-- Results Screen -->
<div class="screen results-screen">...</div>
Enter fullscreen mode Exit fullscreen mode

4.2 CSS Implementation

Key features:

  • CSS Variables for theme management
  • GSAP-powered animations
  • Responsive grid layouts
  • Dynamic gradient effects
  • Progress ring animation
  • Neo-morphism design elements

4.3 JavaScript Logic for the Test

Core class: PersonalityAssessment

class PersonalityAssessment {
  constructor() { /* Initializes all components */ }
  initializeProgressCircle() { /* SVG progress ring setup */ }
  calculateTraitFrequencies() { /* Normalization data */ }
  renderQuestion() { /* Dynamic question display */ }
  handleAnswer() { /* Score calculation */ }
  calculateResults() { /* Trait percentage conversion */ }
  setPersonalityType() { /* Type classification */ }
}
Enter fullscreen mode Exit fullscreen mode

5. Questions Structure

Each question object in the application contains:

{
  question: "How do you prefer to spend your free time?",
  options: [
    { text: "Reading alone πŸ“–", trait: "introvert", emoji: "πŸ“–" },
    // ... other options
  ],
  category: "Social"
}
Enter fullscreen mode Exit fullscreen mode

6. Scoring System

  • 16 personality traits tracked
  • Each option adds +5 to its trait
  • Maximum possible score per trait: (number_of_questions * 5)
  • Normalization formula:
(traitScore / (traitFrequency * 5)) * 100
Enter fullscreen mode Exit fullscreen mode

7. Result Calculation for the Personality Test

Personality Results Screen

  • Convert raw scores to percentages
  • Sort traits by percentage
  • Determine primary trait
  • Generate personality description
  • Create visual chart (Graph)

8. Special Features

  • Dynamic Color Scheme: Primary color changes based on strongest trait
  • Confetti Animation: Canvas-confetti integration
  • Progress Ring: SVG-based circular progress indicator
  • Social Sharing: Platform-specific share URLs (LinkedIn, Facebook, Pinterest, Reddit, Twitter, WhatsApp)
  • GSAP Animations: Screen transitions and element animations

9. Third-Party Integrations

  • Chart.js: Radar chart visualization
  • GSAP: Smooth animations
  • Canvas-confetti: Result celebration effect
  • Google Fonts: Poppins typeface

For Technical Users who wants to enhance this application

Key Algorithms

Trait Normalization

value = Math.min(100, Math.round(
  (traitScore / (traitFrequency * 5)) * 100
))
Enter fullscreen mode Exit fullscreen mode

Personality Type Mapping

const typeMap = {
  Extrovert: {
    title: "The Social Catalyst",
    desc: "You thrive in group settings..."
  },
  // ... other types
}
Enter fullscreen mode Exit fullscreen mode

Color Scheme Animation

gsap.to(":root", {
  "--primary-hue": hueMap[trait] || 250,
  duration: 1.5,
  ease: "power2.out"
});
Enter fullscreen mode Exit fullscreen mode

Performance Considerations

  • Preloading: CSS/JS files preloaded
  • Lazy Loading: Chart.js loaded on demand
  • DOM Recycling: Question elements reused
  • GPU Acceleration: GSAP animations use transforms

Security Aspects

  • Content Security Policy (CSP) compatible
  • XSS protection through textContent
  • URL encoding for share links
  • Sanitized DOM manipulation

Extension Points

  • Add new questions while maintaining trait frequencies
  • Expand typeMap with additional personality types
  • Integrate with backend API for result storage
  • Add localization support
  • Implement question randomization

Keep supporting, keep sharing, and let’s grow together! πŸš€

πŸ“ Find me on: LinkedIn | Medium | Bluesky | Hackernoon

Heroku

Deploy with ease. Manage efficiently. Scale faster.

Leave the infrastructure headaches to us, while you focus on pushing boundaries, realizing your vision, and making a lasting impression on your users.

Get Started

Top comments (16)

Collapse
 
ansellmaximilian profile image
Ansell Maximilian β€’

Looks great!

Collapse
 
web_dev-usman profile image
Muhammad Usman β€’

Thanks!

Collapse
 
ravi-coding profile image
Ravindra Kumar β€’

Good !

Collapse
 
web_dev-usman profile image
Muhammad Usman β€’

Thanks!

Collapse
 
juststevemcd profile image
Steve McDougall β€’

Awesome job, fun and educational!

Collapse
 
web_dev-usman profile image
Muhammad Usman β€’

Thanks

Collapse
 
madhurima_rawat profile image
Madhurima Rawat β€’

Great ideaπŸ’‘ The UI is so beautiful and smooth.

Keep up the good work ✨️

Collapse
 
web_dev-usman profile image
Muhammad Usman β€’

Thanks!

Collapse
 
zunaid_ahammed_34632b005d profile image
ZUNAID AHAMMED β€’

Nice work bro

Collapse
 
web_dev-usman profile image
Muhammad Usman β€’

Thank you!

Collapse
 
shahid_shaikh_3e6c1ade147 profile image
SHAHID SHAIKH β€’

Nice work

Collapse
 
web_dev-usman profile image
Muhammad Usman β€’

Thanks!

Collapse
 
abdulmgt profile image
Adulmajid Muhammad Bala β€’

Keep it up.πŸ‘

Collapse
 
web_dev-usman profile image
Muhammad Usman β€’

Sure, I will, and thank you for the support!

Collapse
 
johnson_tolulope_4abbb236 profile image
johnson tolulope β€’

You are cr@zy man.. awesome project

Collapse
 
web_dev-usman profile image
Muhammad Usman β€’

Thank you so much!

Some comments may only be visible to logged-in visitors. Sign in to view all comments.

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

πŸ‘‹ Kindness is contagious

Explore a trove of insights in this engaging article, celebrated within our welcoming DEV Community. Developers from every background are invited to join and enhance our shared wisdom.

A genuine "thank you" can truly uplift someone’s day. Feel free to express your gratitude in the comments below!

On DEV, our collective exchange of knowledge lightens the road ahead and strengthens our community bonds. Found something valuable here? A small thank you to the author can make a big difference.

Okay