How Hasura took Leonardo.Ai from first code commit to production in 30 days

  • Time to market cut in half
  • 700 million AI images generated by 6 million users
  • All website user functions route through Hasura

Heralded by some as the next Canva, the hottest GenAI startup in Australia today is Leonardo.Ai. The breakthrough app for AI-driven image generation is in a period of explosive growth. In just under a year after launching, the generative AI content production app is creating 4.5 million new images a day, amassing more than 700 million images generated by a worldwide community of generative AI adopters and enthusiasts.

With the drive to move fast and the vision for both scaling up and expanding its offering to multiple clients, such as iOS, the engineers at Leonardo.Ai rely on Hasura to be the glue that holds everything together.

The origin story: Breaking the bottleneck with AI

Leonardo's founders met while working at a video game company. Facing high production costs and long development cycles, they looked at emerging AI tools and ways to incorporate generative AI into their game development workflow, especially on the visual creative process.  

“As we started thinking about how we could leverage the tech through a lens of production use cases for professional use, we came to realize that interacting with AI as a black box would soon lose its novelty. Then there would be a real need for having more control in the process,” said Jachin Bhasme Co-Founder and COO at Leonardo.Ai. “So we started building out a platform to enable creators to use generative AI for production use cases.”

Beyond the prompt: A better black box

Leonard.Ai’s solution was to start with the familiar, accessible prompt box seen on popular consumer large language models (LLMs) like ChatGPT and Bard, and build on that to bring a new level of control and fine-tuning to the image creation process. Expanding beyond the prompt, they added features like control nets and a powerful image editor built into the app.

“Quickly, people started to realize the versatility of the platform,” Bhasme said. “So within a few months, we started getting organic traction and the platform started to blow up. In terms of our user base, it grew beyond just game development to fashion, architecture, marketing, interior design… a whole range of industries.”

In its first year on the market, Leonardo.Ai had 7 million registered users generating images for practically any use case imaginable.

Shipping an early Christmas present with Hasura

On November 24, 2022, Peter Runham made the first commit to Leonardo.Ai’s code repository. A month later, on Christmas Eve, the code was pushed up to production. “Our priority was time to market,” Runham, Leonardo.Ai’s CTO and Co-Founder, said.

Runham and his co-founders coded and crunched at a breakneck speed, but they needed Hasura to meet their goals.

“We had to develop very rapidly. Hasura, with its ease of use, easy permission settings, and configuration, let us achieve that very quickly,” Runham said. “We can just plug it in straight to our database and get to work very quickly.”

Hosted on AWS, the Leonardo.Ai web application uses PostgreSQL as its primary database. Hasura also provides an internal API for the Leonardo.Ai website. Any action a user does on the website routes through Hasura.

“Hasura is the glue between our frontend and backend workloads,” Runham continued. “So whenever you're generating an image on the platform, the platform is talking to Hasura, Hasura then invokes it through an Action, it talks to one of our serverless Lambda functions, which then goes to our AI workloads.”

The B2B API available to Leonardo.Ai customers, which uses features including REST endpoints, is also created using Hasura. Creating the B2B API was easy, Runham said, because they could reuse a lot of metadata from their existing Hasura instance.

Why Leonardo.Ai chose Hasura

A common strategy when developing a web app using Next.js is to also use Next.js APIs, but the Leonardo.Ai team had a vision for the future of their app, and they recognized they needed a different approach. A web app was only the beginning. An iOS and Android app was on their roadmap as well.

“One of the core reasons that we chose Hasura is because we knew we wanted to support multiple clients and to have a universal API across that,” Runham said. “So it was important to have something that we could pick up on our iOS client and any other future clients that we may have.”

Runham said that, while the team knew they didn’t want to use Next.js APIs, they did want something with a similar developer experience.

“Rather than having to handcraft a REST endpoint for every single function on the platform, we wanted a GraphQL API – that would make it a lot easier to integrate quickly and not always require separate API development. You can just modify permissions, and for more complex business logic it's trivial to set up actions and events that point to serverless functions.,” Runham said. “Hasura was an easy choice that filled all those requirements.”

“Killer” permissions management, 2x speed to market

Hasura’s functionality to granularly manage permissions from a convenient place is another key feature the Leonardo.Ai team needed. “Working out how permissions are going to work on each individual function basis gets quite complex,” Runham said. “So being able to do that in a central location with Hasura is probably the killer feature that ultimately pushed us to use it.”

Runham added that, because Hasura connects to their database, the team can easily see what data they want to expose and exclude in the APIs they create. “Being able to secure custom Lambda functions behind a permissions matrix is incredibly powerful and we use that feature a lot,” he said.

By automating API generation and configuration, Hasura allows developers to focus on what they do best. To facilitate growth in the early stages of the project, Runham said it was very important that the team could easily offload that extra engineering work to enable rapid development. “There's no way we could have got to the market as quickly as we did without it,” he said. “We definitely got to market at least twice as fast because of Hasura.”  

The future of generative AI needs Hasura

Leonardo.Ai is revolutionizing content creation, empowering its global community to effortlessly generate ideas and realistic images with its advanced AI art generator. The use cases for generative AI are wide-ranging, spanning from environments to portraits suitable for videos, games, and websites across a variety of industries.

Hundreds of millions of images have already been generated with Leonardo.Ai, and the app has one of the largest generative AI communities globally with a Discord server with more than 1.8 million members; it is the third largest Discord community worldwide.

As Leonardo.Ai continues to evolve, they’ll do it with Hasura. Runham said he’s excited about Hasura v3 and the enhancements that will come along with the next release. “I'm looking forward to the future of Hasura,” he said.

Sign up now for Hasura Cloud to get started!

Blog
08 Jan, 2024
Email
Subscribe to stay up-to-date on all things Hasura. One newsletter, once a month.
Loading...
v3-pattern
Accelerate development and data access with radically reduced complexity.