Introducing Tartiflette: dailymotion's Open Source GraphQL Implementation for Python 3.6+
Vivendi’s acquisition of dailymotion three years ago proved to be an important turning point for our organization, that allowed us to rethink how we were working — rethink our whole way of working — from top to bottom. We used that opportunity to evaluate dailymotion as a whole, our infrastructure, and, more importantly, the core of how we were building our products.
In the end, this introspection confirmed what we already knew: our desire to geo-distribute our platform and build API-driven web, mobile and TV applications. That meant ditching our current monolithic structure and adopting an API-centric approach. This article chronicles the path we took to get there.
Criteria and POCs
We started by kicking-off this project by identifying our API criteria, which we narrowed down to four points:
- Provides a good DX (developer experience), easy to use and implement
- Cultivates a substantial and growing community, one that enables us to recruit and capitalize on widespread technologies
- Acts as a gateway in terms of software architecture, simplifying the transformation of our system integration from a monolith to an SOA (service-oriented architecture)
- Allows for the implementation of API management tools, namely API interface management, documentation, and access to data
Next, we chose the following API models and performed several POCs to determine feasibility:
- Rest API with Swagger
- GraphQL API with Graphene
- API with Falcor
After rigorous testing, GraphQL and its Graphene implementation met our criteria more closely than the other two models. It enabled our front-end engineers to consume our API more easily and simplified its use in client applications (e.g., React JS and Apollo Client). GraphQL also proved easier and more efficient as a pattern gateway in our architecture. We collectively agreed to move forward with GraphQL and Graphene.
The road to production
In April 2017, after an intensive six-month development phase, we went into production with our API. By summer we had moved all dailymotion products (web, mobile, and TV) to our GraphQL API.
When we chose GraphQL three years ago it was still in beta and had not yet reached the popularity it has today. We were one of the first big players, and this made our revamp even more gratifying.
The birth of Tartiflette
In the early months of 2018, after more than half a year of using Graphene, we decided to go a step further and build our own GraphQL engine. This would allow us to meet certain requirements that weren’t being met with Graphene. The criteria for our custom engine:
- Offers a better developer experience that respects the Python mindset
- Uses SDL (Schema Definition Language)
- Uses asyncio as the sole execution engine
After almost a year of development and many weeks of testing on our infrastructure (averaging more than 100 million calls processed per day), we are proud to offer our open-source Tartiflette engine to the GraphQL community.
- Tartiflette is a GraphQL Server implementation built with Python 3.6+
- The GraphQL schema is defined with the brand new SDL (Schema Definition Language).
- Performance is the core of our work and this is obvious with Tartiflette.
- Built with the Zen of Python in mind. No over-engineering.
Hello world, from Tartiflette
Discover some other features through our tutorial on tartiflette.io.
What’s next for Tartiflette?
The open-sourcing of Tartiflette is the starting of our second milestone and exciting things to come. Here are some of the ideas and plans we have for the future of Tartiflette:
- Polish the documentation for our users and community
- Provide more examples and advanced use-cases to encourage you to experiment with the flexibility and powers of Tartiflette
- Improve performance, mainly on the execution engine
And now… we need you!
You can use our project for nearly any purpose and help us build the next version of Tartiflette! Please, give it a spin, feel free to inspect errors or inconsistencies in our code and give us feedback to improve our product. We truly believe that Tartiflette will become even better with the collaboration of the community.
How to contribute?