Introducing lexiQL

Ryan McDaniel
4 min readApr 15, 2021

--

Visualize your relational database and replace RESTful APIs with GraphQL — without writing a line of code

lexiQL is a GraphQL prototyping tool and SQL database visualizer built for developers looking to optimize their queries and transition away from RESTful APIs | www.lexiQL.io

For nearly 20 years, RESTful architecture was the industry standard for API design and deployment. Database queries were widely deployed through a process familiar to many developers: client requests traverse a complex web of endpoints, are routed to a multitude of controllers and middleware, and eventually return some or all of the requested data to the client.

This long-standing architecture was a good fit for many applications, but over time its efficacy has been downgraded by changing technology: increased mobile usage now requires more efficient data loading, while the proliferation of modern web browsers requires data structures flexible enough to accommodate their different needs.

GraphQL to the rescue!

In 2015, Facebook released GraphQL as a response to many of the shortcomings of REST-based design. GraphQL is a database query language that centers flexibility and precision as core tenets. While traditional REST queries often result in over- or under-fetching of data, GraphQL allows client-side structuring of each data request, ensuring a response with the proper data content and structure.

Using REST requires a three separate requests to three different endpoints in order to fetch the required data. The result? Overfetching, since the endpoints return extra, unneeded information. (https://www.howtographql.com/basics/1-graphql-is-the-better-rest/)

Using GraphQL, a client can target specific data in a single query, fetching with pinpoint accuracy and designating the desired structure of the server response, even in complex and deeply-nested scenarios. The server response, in turn, is only as broad or narrow as the client has specified, thus preventing excessive data fetches and improving efficiency.

Here is the same request, this time made using GraphQL. Using a single query, the client specifies both the structure and the content of the server’s response. (https://www.howtographql.com/basics/1-graphql-is-the-better-rest/)

GraphQL demonstrably mitigates some of the downsides of RESTful queries, providing more efficient, declarative, precise server responses to client-side queries. Still, it is not without its own shortcomings. One of the most persistent issues for developers is the lack of built-in error handling: every GraphQL query results in a 200 status code response from the server, thus making it difficult to pinpoint query errors.

The result of this built-in query structure rigidity is that developers must know exactly what they’re querying and how their query must be structured — and even a small misspelling or typo returns a null response and no trace of what went wrong. Although the benefits of transitioning away from RESTful APIs are significant, the learning curve for GraphQL can be steep.

Enter lexiQL

lexiQL is a free and open-source dev tool designed to ease the transition from RESTful APIs to GraphQL. lexiQL takes a user’s relational database input and uses it to generate the associated GraphQL schemas, constructed with precision to remove the possibility of query errors.

Alongside this GraphQL boilerplate, lexiQL aims to help developers visualize their data with an interactive GUI that displays all of the tables in a relational database, including primary/foreign key relationships between tables, as well as each table’s columns and associated data types.

That’s awesome! How does it work?

Head over to www.lexiql.io and navigate to “Visualize” in the top right corner.

Simply input a PostgreSQL database URI, and lexiQL will do the rest! (Don’t have a database to input right now but still want to test our tool? Use our sample database to explore what lexiQL can do.)

Input a PostreSQL URI or use a provided sample database

Visualize your relational database and examine all of its table schemas in one place. Auto-generated table connections allow you to understand the relationships between your tables through primary/foreign key connections. Drag and drop nodes for interactive viewing.

Visualize and interact with your relational database tables

Toggle between your generated schema, including types and resolvers, in the right-side modal. When you’re ready, automatically copy your precise GraphQL schema and inject it directly into your code, removing the possibility of errors.

View your GraphQL schemas & resolvers and easily copy them for use in your code

Want to test out some GraphQL queries? Navigate to the “Playground” link from your data display and interact with an integrated GraphiQL interface to see GraphQL in action.

Test the functionality of schemas and resolvers using an integrated GraphiQL playground interface

GraphQL is the database query language of the future, and lexiQL’s goal is to make the migration away from the RESTful architectural pattern as seamless for developers as possible. By providing both GraphQL boilerplate and interactive database visualization, as well as a playground for schema testing, lexiQL seeks to help optimize and modernize your new or existing codebase with more efficient database querying.

lexiQL is a new tool that remains in active development. If we’ve piqued your interest, please check us out on GitHub, where our engineering team is actively seeking feedback, monitoring issues, and answering questions. We’re always looking for ways to improve!

The lexiQL Team

Christopher Carney | LinkedIn | GitHub

Stacy Learn | LinkedIn | GitHub

John Li | LinkedIn | GitHub

Ryan McDaniel | LinkedIn | GitHub | Site

--

--

Ryan McDaniel
Ryan McDaniel

No responses yet