Git Product home page Git Product logo

intro-extro's Introduction

This is a Next.js project bootstrapped with create-next-app.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying pages/index.tsx. The page auto-updates as you edit the file.

Workflow

  1. Start at "/" home page where the introvert/extrovert questionnaire is shown to user(React)
  2. Data: Questions and options comes from SQlite database handled by Prisma ORM. The query is donde as GetStaticProps.
    Also there we create a sessionId a to link user answer to result(after submitted)
  3. The Questionnaire shows 5 questions with 4 choices each. All choices has a score(totally subjective)
  4. When the 5 questions are already responded the form let user to submit data.
  5. The data is sent through tRPC mutation
  6. In the backend tRPC endpoint "putAnswer" validate request body, and then calculate a total
    score(linear interpolation) then we use Prisma to create a new Response mapped to user sessionId
  7. MeanWhile the front-end waits for the mutation to return a status === success, when that
    happens it triggers the routing to /result page
  8. At Result page ("/result"), sessionId saved on session storage is used to query database.
    This is done via tRPC Query with React-Query useQuery hook and gets a Result This Results has a totalScore value (0-100) that we pass to a Gauge component that render a Gauge showing the value.

App Architecture

architecture image

Test E2E

Test for home page run:

npm run test:e2e

intro-extro's People

Contributors

renato1010 avatar

Watchers

 avatar  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.