July 06, 2021

How migrating from Sequelize to Prisma allowed Invisible to scale

Invisible is a B2B productivity startup that allows its users to automate and outsource any complex workflow or business process through Worksharing. Prisma played a crucial role in allowing Invisible to future proof their tech stack and in supporting its scale.

How migrating from Sequelize to Prisma allowed Invisible to scale

Invisible, the solution for operational efficiency and automation

During the past year it’s become clearer to many companies that merely going digital to achieve business transformation is not enough. What enterprises need is to establish a digital transformation strategy focused on operational efficiency and automation. This is imperative to achieve productivity and efficiency gains, and to remain competitive in a market that requires an ever increasing level of customer experience.

Before Invisible, enterprises relied on BPOs (Business Process Outsourcing) for operational efficiency and RPAs (Robotic Process Automation) and other tools for automation.

However, by themselves, both these solutions are insufficient. Every enterprise has custom and complex business processes, which can’t be addressed by the one-size-fits-all approach of many RPAs. Likewise, outsourcing to BPOs might avoid the need to create new workflows, training programs, etc. for in-house resources, but it’s only ideal to support relatively simple, large-scale industrial processes.

Invisible solved this problem with Worksharing. It combines the best elements of BPOs and RPAs, without losing the crucial component of human discretion.

Invisible has operational excellence and automation in its DNA. We're industrializing knowledge work, breaking everything down to its smallest components, turning everything into a process, building tools, and aligning incentives. This is done through Invisible's Digital Assembly Line: customers can select pre-built business processes on the Invisible online portal, or build their own custom process using the available “building blocks” provided by us.

Scott DownesScott Downes, CTO at Invisible

Choosing Prisma to drive internal efficiency

Invisible ensures operational efficiency and automation for its customers by ensuring that they follow those same principles internally: they choose technologies that will allow their developers to save time, while also future-proofing their tech stack.

This is why Pieter Venter, Sr. Software Engineer, chose Prisma when designing the new tech stack for Invisible. When Pieter joined Invisible and assessed its tech stack he decided that a full refactor was needed to build solid foundations for the platform for years to come.

Using Prisma would allow the Invisible team to:

  • Rapidly evolve its schema, adding new features and processes according to market demand
  • Have flexibility in writing custom logic needed for the backend
  • Be confident in the tool used, not having to worry about constant maintainance and troubleshooting

Originally, Invisible used Sequelize, which provided them with strong TypeScript types, but required a lot of boilerplate code to create their models. Also, the type definitions and the types did not update depending on the query selection. They also investigated Hasura, but it ultimately didn’t meet their expectations, lacking the flexibility needed for their backend custom logic.

Prisma was the ideal solution:

  • It is built for GraphQL implementations
  • It provides auto-generated types in the client using inferred types based on query selection
  • The fluent API is very easy for developers to learn, allowing for a new modern query engine development

Migration from Sequelize to Prisma in a live application

The migration from Sequelize to Prisma was painless and effortless for Invisible.

The team created a Prisma client alongside their Sequelize client, which was used in an API server monolith hosted on Heroku. They used Prisma introspect to build a new Prisma file based on their database, which was ultimately very similar to their previous schema.

At the same time, they also created a new serverless GraphQL API (hosted on Vercel using Postgres) that would just use Prisma and have no Sequelize baggage. Simple data models and business logic were moved over to the new backend quickly and easily.

The high volume requests were also moved to the new serverless function in order to reduce the load on their old Heroku dynos for the old API server, and allow them to scale down on Heroku.

Currently all new core data models are built in the new repo’s Prisma schema and new Postgres database, and any remaining old queries are slowly being migrated off Sequelize and Heroku, with the intention to fully deprecate them within the year.

This gradual approach allowed Invisible to continue to have hundreds of agents working around the world 24/7 seamlessly and without interruption, and ensure that their customers experienced no downtime.

While they could have opted to complete the migration in one week, they decided to proceed gradually so that they could continue to develop new features and take advantage of Prisma to ship them more rapidly.

Invisible’s Tech Stack

Invisible uses TypeScript everywhere which allows them to have 100% type-safe code from the database straight to the frontend, without needing to maintain the types. Their stack consists of a few React Applications (NextJS), and Nodejs backend API servers. They use Prisma with a highly relational data model in Postgres.

Their current stack is composed of:

Prisma's approach to type-safe ORM is next-level when compared to Sequelize and even TypeORM. The tRPC + Prisma combo is insanely easy to get going with! It provides full type-safety without any codegen or messy types and interfaces to write and maintain. Prisma generates the types, tRPC consumes them and passes them down and we don't even need to maintain any API servers. With Nextjs and Vercel we also get great DX and UX at the fraction of the cost we'd usually have to pay to run our own stateful servers.

Pieter VenterPieter Venter, Sr. Software Engineer at Invisible

Currently, the Invisible team is focusing on refactoring the Heroku monolithic API into a collection of serverless functions, hosted on Vercel. Additionally, they have replaced GraphQL and Apollo with tRPC - a thin wrapper around React Query that handles both the client and server fetching logic. This has drastically simplified their tech stack, and will allow for faster feature development and more reliable incremental changes to the database.

Prisma works seamlessly with their new microservice architecture and has been abstracted out into its own library that can be shared across the services that require data. Prisma automatically opens and closes DB connections as the serverless functions require. Check out The world's worst pool party: Connection management with Prisma - a talk by Martina Welander on the subject!

Invisible's tech stack before and after Prisma

Invisible’s Engineering Culture

Invisible has truly embraced a culture of ownership across all departments and, in particular, the Engineering team. This is how Scott Downes, CTO at Invisible, describes the sense of shared responsibility within the team:

All our partners (the word "employee" is forbidden!) agree to a transparent, meritocratic model, where everyone earns meaningful equity over time and our salaries and bonuses are tied directly to business performance. The work of each individual directly impacts and shapes the direction of the company and its success.

Scott DownesScott Downes, CTO at Invisible

This is especially evident when looking at Pieter’s work: Pieter single handedly assessed the flaws in the previous stack and took ownership of designing a new, scalable and future-proof solution.

If you’d like to join the fully-remote Invisible team, check out all the open positions here.


Invisible’s revenue has quadrupled in the past year, as more and more companies realize the importance of driving efficiency and automation. Relying on a technology such as Prisma allows them to remain agile and scalable, and ensure that they can meet the rising demand from their customers.

Adopting Prisma allowed Invisible to deploy changes much faster than before, ensuring that they can continue to drive efficiency up for their team, while driving costs down for their customers.

To find out more about how Prisma can help your teams boost productivity, join the Prisma Slack community.

Don’t miss the next post!

Sign up for the Prisma Newsletter