Visualize FastAPI endpoints with FastAPI-Voyager

(newsyeah.fun)

126 points | by tank-34 4 days ago ago

24 comments

  • brulard 4 days ago ago

    I would appreciate some quick info what this is all about. Clicking on link presents me with a huge diagram i know nothing about. What am I looking at?

    • tank-34 4 days ago ago

      this project is inspired by https://apis.guru/graphql-voyager/, which visualize the entity relationships based on graphviz and add fancy ui effects.

      fastapi-voyager, from left to right, is tag, routes(apis) and response_models, it indicates the internal relationship between routes, which can help developers/PO easily figure out the data structure.

      • tonyhart7 4 days ago ago

        ok, how is this better than OpenAPI schema???

        • tank-34 4 days ago ago

          in swagger, from the definition of schema you are not able to easily figure out the related class, the name is marked as <object> or array<object>

          in voyager their relationships are visualized and very close to the source code.

          • Noumenon72 3 days ago ago

            What are the files like router.sample_1.schema? Is that a convention you use for your Pydantic models or something generated by OpenApi?

            • tank-34 3 days ago ago

              https://github.com/allmonday/composition-oriented-developmen...

              those are clusters based on modules, you can swith off by toggle 'show module cluster'

              • Noumenon72 3 days ago ago

                So this isn't really "visualize FastAPI endpoints", it's "visualize the inheritance cascade caused by using the pydantic-resolve approach to data fetching/transformation, which involves adding post-hooks to compositions of Pydantic objects". A vanilla FastAPI user like myself is going to have trouble understanding it without realizing how tied it is to that framework.

                • tank-34 2 days ago ago

                  to better describe the relationship, it borrows the concept 'subset' from pydantic-resolve, which act like pick several fields from original class but you can still reference to it.

                  @subset(User) class PickedUser: ....

                • nine_k 3 days ago ago

                  While at it, what do you use to parse / validate / cast request data into nice typechecked objects?

                  • tank-34 2 days ago ago

                    the return value in resolve/post method will be automatically validated by the pydantic class defined in field annotation.

                • tank-34 3 days ago ago

                  it's not bound with pydantic-resolve, for vanilla fastapi user if the business model are well designed and composed, it can benefited from this visualization approach too.

                  the goal is to make the dependencies clear for developers, and figure out the potential impacts from one node to others.

                  pydantic-resolve is just another my project to make the process of data composition close to ER model and get rid of glue codes like 'for loops'.

        • tracker1 2 days ago ago

          This seems to show much deeper into the backend... OpenAPI really only shows the API surface as kind of a black box for external usage... this seems to be to aid diagnostics and understanding of internal calls and relationships.

          • tank-34 2 days ago ago

            you are right, in fact the most valuable part in our backend is 'business mode/logic', with voyager we can have a new choice to better understand them.

      • agumonkey 4 days ago ago

        Pretty nice

  • tank-34 3 days ago ago

    if you double click route / pydantic class and click 'view in vscode', it will lead you to the file in github

    and in local env, you can 'really' open it in vscode.

  • jmpeax 3 days ago ago

    There has to be a better way to view this than the tangled web of overlapping lines, like that at lower left of the "services" rectangle on the right, even with the selection highlighting. Perhaps there is not, and it is fertile ground for developing a new visualization.

    • nine_k 3 days ago ago

      Click any node, and everything not related to that node fades.

      The tangled mess kind of picture is still sometimes useful: you can roughly see bunches grouped, and notice things that are all over the place.

  • btbuildem 4 days ago ago

    Needs more discovery interactions - first one being node mouseover highlights all associated links.

    It's 2025, I don't want to look at a giant hairball. At top level, give me a summary, reveal detail as I drill down.

    Am I using this as a reference? The search looks promising, I can follow thru and find specifics on a particular item I am after.

    • tank-34 3 days ago ago

      thanks for suggestion. this project is still in early stage, I've listed some ux related Todos but not yet finished. TBH, i dont expected it to be noticed in hacker's news LOL

  • tank-34 4 days ago ago
  • throwaway0X13 4 days ago ago

    Mapping software in /src/ modding, either with GIS software for positional API voyaging, which designate the tiers for endpoints.

  • ldng 3 days ago ago

    Is that de Chrome-only webapp ? Does not seem to work with Firefox.

  • nexusgrj 2 days ago ago

    nice tool, everyone writing web service with FastAPI should take a try : )

  • tank-34 4 days ago ago

    scroll to zoom in/out

    pick tag/routes at left panel, and see subgraphs

    double click to see field table and source code, click link to see source code in github

    click focus to hide other nodes.

    ...