Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 5 months ago

Frontend Quiz App | Fullstack application

c#, postgres, react, sass/scss, typescript
P
Huy Phan•3,430
@huyphan2210
A solution to the Frontend Quiz app challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What are you most proud of, and what would you do differently next time?

The app is built with:

  • UI: React with TypeScript, Vite, and SASS/SCSS
  • Server: ASP.NET Core (C#), using Entity Framework Core as the ORM (Object Relational Mapper)
  • Database: PostgreSQL
  • Hosting: Vercel (UI) and Heroku (Server)
What challenges did you encounter, and how did you overcome them? 1. Database Choice

Initially, I used SQLite for my app. However, I quickly discovered that Heroku doesn't support SQLite well, as its ephemeral file system causes data loss upon app restarts. To resolve this, I switched to PostgreSQL, using Heroku's built-in PostgreSQL add-on, which provides better scalability and persistence.

2. Preventing Users from Seeing Quiz Answers in the Network Tab

I considered the possibility that users who know how to inspect the Network tab in their browser could view quiz answers before attempting them. This was a serious concern, as it could compromise the integrity of the quiz.

From a performance perspective, making a request every time the user advances to the next question is inefficient. Instead, I decided to fetch all questions for a selected category at once. However, this introduces the risk of exposing answers in the network response.

Solution: Encrypting Answers Before Sending Them to the Client

To prevent answer leakage, I implemented client-side encryption:

  1. The UI generates a unique encryption key using Crypto API whenever it requests questions.
  2. This key is sent securely to the server, which uses it to encrypt the answers before sending them back.
  3. The UI then decrypts the answers using the same key, ensuring they remain unreadable in transit.

This approach enhances security while maintaining efficient data retrieval.

There are other challenges as well, but the above caused the most trouble.

What specific areas of your project would you like help with?

I will update the Readme.md in my repository on how to setup and run the application on local machine, but that would take some time.

In the meantime, feel free to ask me any question regarding this solution.

Code
Loading...

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on Huy Phan's solution.

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License