1 of 18

How Intuit open sourced apollo-mock-http

Vamshi Suram, Senior Software Engineer

Sept 7th 2024

© 2024 Intuit Inc. All rights reserved.

1

2 of 18

MISSION

Intuit Confidential and Proprietary

2

© 2024 Intuit Inc. All rights reserved.

2

3 of 18

Agenda

Introduction to GraphQL & React

Problem Statement

Demo of our approach

Q&A

Vamshi

© 2024 Intuit Inc. All rights reserved.

3

4 of 18

GraphQL Intro

Web Applications flow

UI (Browser)

Backend

Database

Vamshi

© 2024 Intuit Inc. All rights reserved.

4

5 of 18

GraphQL Intro

Web Applications flow (1 level down)

components

components

Apollo Client

Backend

UI (Browser)

Vamshi

© 2024 Intuit Inc. All rights reserved.

5

6 of 18

What is GraphQL ?

Query

Response

Operation Name

Vamshi

© 2024 Intuit Inc. All rights reserved.

6

7 of 18

Problem Statement ?

Vamshi

© 2024 Intuit Inc. All rights reserved.

7

8 of 18

Control on data?

components

components

Apollo Client

Backend

UI (Browser)

Vamshi

© 2024 Intuit Inc. All rights reserved.

8

9 of 18

Sample React GraphQL app

Vamshi

© 2024 Intuit Inc. All rights reserved.

9

10 of 18

Problem Statement (scenarios)

API not ready / API is down!!

Mock data, undo mocking - problems

Simulate error scenarios, missing data..

Expensive re-setup

Ex: delete employee

Vamshi

© 2024 Intuit Inc. All rights reserved.

10

11 of 18

How to mock data?

components

components

Apollo Client

Backend

UI (Browser)

Apollo Client

Vamshi

© 2024 Intuit Inc. All rights reserved.

11

12 of 18

Initial approach

components

components

Apollo Client

Backend

Mocked responses

Mocking made easy (complete client-side)

One point maintenance, PROD quality code

Disconnected completely

*Mock all responses of UI - not maintainable!!

Vamshi

© 2024 Intuit Inc. All rights reserved.

12

13 of 18

Challenges - scope for improvement

  • Mocking data is hard, and lot of undo work, After undo - is app working?
  • Mock some stuff, sometimes..!!
  • Enable / disable mocking
  • Can I push the code to Prod?
  • Easy to install / use

Better Solution?

Maintainable way of data mocking

Vamshi

© 2024 Intuit Inc. All rights reserved.

13

14 of 18

New and better approach

components

components

Apollo Client

Backend

Mocked response

Mocking made easy (complete client-side)

One point maintenance, PROD quality code

Orchestration of workflows (actual/mock mix)

Vamshi

© 2024 Intuit Inc. All rights reserved.

14

15 of 18

Simple API

Vamshi

© 2024 Intuit Inc. All rights reserved.

15

16 of 18

Resources

Vamshi

© 2024 Intuit Inc. All rights reserved.

16

17 of 18

Q&A

© 2024 Intuit Inc. All rights reserved.

17

18 of 18

Q&A

#slido-name

© 2024 Intuit Inc. All rights reserved.

18