Menu

#1793 [ENHANCEMENT] Server-Side Filtering in the getResponses Service

open
nobody
2023-12-18
2023-12-18
Anonymous
No

Originally created by: jobenjada
Originally owned by: anjy7

Client-side filtering doesnt scale well

Describe the solution you'd like

Description:
We are embarking on an important transition in Formbricks: moving from frontend-based filtering logic to a scalable server-side approach. As our data volume grows, loading and processing all responses on the frontend becomes increasingly impractical. Your task is to conceptualize and implement a server-side filtering mechanism for the getResponses ( packages/lib/response/service.ts) service. This concept is crucial, as it will set the stage for similar implementations in other services.

Objective:
Create a scalable and efficient server-side filtering concept for the getResponses service. This concept should handle a variety of filter configurations and provide paginated results. Your work will be foundational, setting a pattern for extending this logic to other services.

Tasks:

  1. Research and Conceptualization:
    • Familiarize yourself with our current frontend filtering logic, particularly on the survey summary page. You can create a link survey at https://app.formbricks.com/ , submit a few responses and play with the filter options.
    • Develop a concept to transition these filtering options to server-side logic. How can we find a universal approach that has a great developer experience, easily let’s the developer get all responses or only the responses that match a certain filter.
    • Include essential filters such as question values, response completion status, and tags in your concept.
  2. Design the Filtering Logic:
    • Ensure the filtering logic is adaptable and can be easily applied to other services like surveys and teams.
    • Propose a flexible mechanism for managing filters.
  3. Implementation in getResponses:
    • Implement your designed filtering logic in the getResponses service.
    • The service should efficiently handle paginated requests.
  4. Performance Optimization:
    • Construct performant Prisma queries for the filtering process.
    • Maintain effective caching that complements the new server-side filtering.
  5. Documentation:
    • Thoroughly document your filtering concept and its implementation process.
    • Provide clear guidelines for applying this pattern to other services.
  6. Collaboration and Feedback:
    • Initially, discuss your approach with Matti for alignment and valuable insights.
    • Ensure your concept aligns with our architecture and scalability goals.

Expected Outcomes:

  • A detailed and practical concept for server-side filtering.
  • Successful implementation in the getResponses service.
  • Comprehensive documentation for future reference and expansion.

Additional Notes:

  • The significance of your contribution cannot be overstated; this concept will be a cornerstone for future development in Formbricks.
  • As you work, keep in mind the need for scalability and adaptability in your design to meet our evolving needs.

Describe alternatives you've considered

No response

Additional context

No response

Discussion

  • Anonymous

    Anonymous - 2023-12-18

    Originally posted by: anjy7

    I would like to take this one :)

     
  • Anonymous

    Anonymous - 2023-12-18
     
  • Anonymous

    Anonymous - 2023-12-18

    Originally posted by: jobenjada

    you got it :) Pls make sure to talk it through with GPT first and then Matti before getting to the implementation 🤓

     

Log in to post a comment.

MongoDB Logo MongoDB