Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Benchling Engineering 8 min read Case study mediumAdept

Fragmentation to framework: Spec-first development at Benchling

Benchling replaced M×N hand-built integrations between scientific object types (DNA sequences, notebook entries, inventory) and platform capabilities (REST API, warehouse, search, config migration) with the Object Framework, a spec-first layer over its monolithic SQLAlchemy-based service. Objects are declared once in a GraphQL SDL "Domain Graph" with directives for metadata and capability behavior, expose CRUD and domain methods through registered Python Data Connectors, and are persisted via Data Mappers. Capabilities such as the V3 REST, Bulk Import/Export, Events and GraphQL APIs are then built generically, so the Bulk Import team wrote no object-specific code. Lessons include favoring interfaces over rigid implementation patterns, running an explicit adoption program with coverage dashboards, and managing the tension between object stability levels and the flexibility to change fields.

Related posts

  • Unifying Internal APIs: A Different Use Case for GraphQL Gateways

    trivago tech mediumAdept

    trivago built an internal GraphQL gateway on GraphQL Mesh v0, embedded in a Node.js Express server, that stitches more than 15 upstream sources (OpenAPI services, MySQL databases, GraphQL servers) into one graph powering a unified admin tool. Upstream services stay untouched. The gateway stays thin, using filter and prefix transforms to avoid type collisions, role-based access via composer resolvers (moving toward directives), and an audit-logging pattern that appends a logAuditEvent mutation and checks actual response values against expected ones. Six years in, a flat, partly duplicated graph has proven fine for internal consumers, and integrating services surfaced undocumented data and overlapping systems. Hard parts include the breadth of expertise needed and mixing staging and production environments.

  • Moving from Django DRF to Ninja API / Pydantic

    Kogan.com Dev Blog mediumAdept

    Kogan.com is shifting its Django APIs from Django REST Framework's serializers, viewsets and routers to Django Ninja with Pydantic schemas, defining each endpoint as a type-hinted function with separate input Schema and output ModelSchema classes. A side-by-side CRUD example for a Product model shows that Ninja requires more explicit endpoint definitions than DRF's auto-generated routes. In return it gives less hidden framework magic, automatic OpenAPI docs, and cleaner separation between API code and business logic. The listed tradeoffs are a learning curve for DRF developers, the need for an iterative migration on large codebases, and DRF's larger plugin ecosystem.

  • 10x faster python test iteration via fork(2)

    Benchling Engineering mediumAdept

    Benchling cut Python test iteration from 10 seconds to about 1 second by preloading slow-to-import dependencies and SQLAlchemy models in a parent process, then fork()ing a child that imports the changed app and test code, in the style of Rails' zeus. importlib.reload() fails because reverse dependencies keep stale bindings. Modules are split into tiers by dependency position and edit frequency, so a file change discards as little import work as possible. Calling gc.freeze() before fork avoids copy-on-write page copies caused by refcount and GC header writes, saving 160 MiB of unique set size, while calling gc.collect() first is counterproductive because freed holes get refilled in copied pages.

  • How we use GraphQL at Europe's largest fashion e-commerce company

    Zalando Engineering easyNovice

    Zalando replaced a sprawl of per-page and per-platform Backend-for-Frontend services with a single unified GraphQL API owned via a shared monorepo across 12+ domain teams. The BFFs had duplicated effort, fragmented security and observability, and produced inconsistent data across web and app. The graph is built on Entities such as Product and Campaign and runs on their own GraphQL engine, graphql-jit, under a strict no-business-logic rule. Since 2018 it has grown to serve over 80% of web and 50% of app use cases, with adoption driven by documentation, training and schema consultation, and god-component risk handled through contribution principles, circuit breakers, timeouts, retries and per-platform bulkhead deployments.

  • Micro Frontends: from Fragments to Renderers (Part 1)

    Zalando Engineering easyNovice

    Zalando replaced its Mosaic micro-frontend architecture, built on team-owned page Fragments, with Interface Framework, a unified platform where pages are trees of typed Entities (Product, Collection, Outfit) mapped via declarative rendering rules to React Renderers that declare data needs in GraphQL. A Node.js/browser Rendering Engine resolves and renders the Entity tree chosen by the recommendation system, with built-in monitoring, batched A/B testing, deployment previews against production, and performance gates such as Lighthouse CI, bundle size limits and Web Vitals reporting. Moving teams into a monorepo with a shared stack lowered the entry barrier and improved UX consistency, at the cost of blurred ownership. A hybrid mode serving Fragments and Renderers together eased migration, and about 90% of traffic now runs on IF.

The quest for software engineering knowledge.

Look:
Layout: