June 09, 2021

How Poppy Uses Prisma Client to Ship Confidently

Poppy offers rides of all kinds through its mobile app. Whether it's a car, scooter, or e-step, Poppy has it. Prisma plays a vital role in helping Poppy ship quickly and confidently and is a big reason they've just hit 1.5 million total rides taken.

Rides of All Kinds

Poppy is a mobility sharing service with huge value proposition: customers get a ton of choice over what kind of ride they want. Based in Belgium, Poppy offers over 500 shared cars, 400 e-scooters, and 200 e-steps in Antwerp, Brussels and now also Mechelen. All of these are available with a few taps in Poppy's mobile app.

While Poppy's offering is straight-forward and their user experience smooth, the architecture that makes this possible is fairly complex.

Not only does Poppy need to ship mobile apps that work on all devices, they also need to handle several complexities behind the scenes. Some of these include things like handling location awareness, payments, notifications, and more.

Even with all these complexities, Poppy moves quickly on development and ships new features consistently. One key technology that has helped them achieve rapid development is Prisma Client.

Prisma at the Core

Thibaut Nguyen is Poppy's CTO. A fan of GraphQL, he's been following along with Prisma's development since the early days. As Prisma matured to become the top choice for those wanting a type-safe database access client for Node.js, Thibault knew he wanted to use Prisma in his next greenfield project.

Two of us in the team were early graph.cool fans and were super impressed by the quality and developer experience. I remember checking Prisma 1 at the time but was a bit reluctant to add an additional server to set it up. Then when came the time to start on a greenfield project we gave Prisma 2’s early release a shot and were immediately convinced we had to use it as it integrated Typescript so well.
Thibaut NguyenThibaut Nguyen, CTO at Poppy

Today, all of Poppy's engineers are developing with Prisma and it is being used in production to serve thousands of rides per week.

Poppy's tech stack is somewhat complex. This complexity is there behind the scenes to help ensure riders have a smooth experience. However, the tools that Prisma offers and, specifically, the great TypeScript experience provided by Prisma Client, have helped to reduce that complexity and have enabled Poppy's engineers to move quickly while being confident in their code.

Poppy's tech stackPoppy's tech stack

Poppy's tech stack includes popular options across hosting, frameworks, and third-party services, including:

  • Node with Fastify
  • React Native
  • PostgreSQL
  • Redis
  • Twilio
  • Docker
  • Google Cloud Platform

Poppy's service requires a large degree of location awareness. This is where some of the complexities in their stack arise.

PostGIS is an extension for PostgreSQL which gives geospatial capibilities to the database. Poppy uses PostGIS for geometry calculations and to do location-aware database queries.

On top of this, Poppy collects IoT data from its vehicles in Google Big Query. This represents a large volume of data that needs to be managed.

Type-safe database access through Prisma Client has been essential to help reduce coding errors for Poppy. This added layer of confidence when writing database access code has helped Poppy reduce overall complexity in their codebase and has enabled them to ship faster.

The combination of Prisma, TypeScript and our pretty thorough coverage with integration tests gives us the confidence to refactor critical parts of our code.
Thibaut NguyenThibaut Nguyen, CTO at Poppy

Type-safe database access through Prisma Client has been essential to help reduce coding errors for Poppy. This added layer of confidence when writing database access code has helped Poppy reduce overall complexity in their codebase and has enabled them to ship faster.

Type-Safe Database Access for Fun and Profit

Type safety is becoming ever more important for developers of all kinds. TypeScript's popularity has been skyrocketing and it's with good reason. The confidence developers get from working with type-safe code add enormous benefits to any organization.

Type safety for database access is also becoming crucial. Instead of writing raw SQL with a lot of trial and error when querying a database, developers instead want to know exactly what they can and cannot do.

With Prisma, developers get a type-safe database access client out-of-the-box.

Database models are written with the Prisma Schema Language and TypeScript types are generated from it automatically.

Databases modeled with Prisma are simple to read and write.

datasource db {
url = env("DATABASE_URL")
provider = "postgresql"
}
generator client {
provider = "prisma-client-js"
}
model User {
id Int @id @default(autoincrement())
email String @unique
name String?
posts Post[]
}
model Post {
id Int @id @default(autoincrement())
title String @db.VarChar(255)
author User? @relation(fields: [authorId], references: [id])
authorId Int?
}

With a single command, the Prisma model provides a type-safe database access client.

npx prisma generate
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
async function getPosts() {
return await prisma.post.findMany({
include: {
author: true,
},
})
}

Conclusion

Prisma has been crucial for Poppy's success to date and the team anticipates it will continue to play a large role as the company grows. Type safety translates to confidence. Confidence at the database is especially important and, with Prisma Client, Poppy is able to achieve this.

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

Join the discussion

Follow @prisma on Twitter

Don’t miss the next post!

Sign up for the Prisma newsletter