Rails Engine
Running Global Manufacturing on Ruby (among other things)

Summarized using AI

Running Global Manufacturing on Ruby (among other things)

Lee Edwards • November 10, 2016 • Cincinnati, OH

In this presentation titled "Running Global Manufacturing on Ruby (among other things)", Lee Edwards, the VP of Engineering at Teespring, discusses how Ruby is integral to managing Teespring's global manufacturing processes. He begins by sharing his background in robotics and manufacturing, leading into the discussion of the manufacturing technologies used today, particularly in custom apparel production. Key points include:

  • Historical Context of Screen Printing: Edwards traces the evolution of screen printing from its origins in China to its impact on modern art, specifically mentioning artists like Warhol who utilized this technique to reproduce art en masse.

  • Teespring's Business Model: He describes Teespring as a marketplace that empowers creators to produce custom apparel without needing to understand manufacturing complexities. He shares an example of a shirt designed for Louisiana flood relief that raised significant funds.

  • Manufacturing Processes: Edwards outlines the detailed processes involved in both screen printing and digital printing, including:

    • Artwork separation for screen printing, where designers manually adjust designs for color separation.
    • The use of high-quality latex paint and the precision required in screen alignment during printing.
    • The technological advancements in digital printing, likening it to inkjet printing technologies and the complexity of these machines.
  • Role of Ruby: Edwards emphasizes Teespring's reliance on Ruby, particularly Rails, for developing software that supports operational processes and employee efficiency, despite the challenges posed by less-than-ideal APIs from manufacturing machines.

  • Fulfillment and Order Management: He explains how fulfillment jobs are created and managed, highlighting the campaign model Teespring employs, which draws parallels to crowdfunding models. This model influences how orders are processed, printed, and delivered, particularly in coordinating with third-party printers.

  • Operational Efficiency: The importance of constant measurement and improvement in manufacturing is underscored through the use of tools like Apollo, which monitors jobs to reduce waste and improve efficiency, tying into broader principles from lean manufacturing.

The presentation concludes with a reminder that software development should be centered around people and the processes that facilitate their work. Teespring’s practices underscore a commitment to innovation in both manufacturing and employee welfare, and Edwards invites engagement from potential hires, suggesting that Teespring values collaboration and growth.

Running Global Manufacturing on Ruby (among other things)
Lee Edwards • November 10, 2016 • Cincinnati, OH

RubyConf 2016 - Running Global Manufacturing on Ruby (among other things) by Lee Edwards

A few miles from this convention center, Teespring prints millions of short-run custom products every year from modern direct-to-garment printers and ships them all over the world. Like most companies, Teespring's architecture is polyglot, but the core business logic is in Ruby. We'll discuss how we use large at-scale manufacturing and production systems to help anyone, anywhere turn their ideas into reality.

RubyConf 2016

00:00:15.170 Great! Okay, so I'm Lee Edwards, the VP of Engineering at Teespring. I get to follow up on probably the cutest tech talk I've ever seen in my entire life. If you didn't see the talk on father-daughter pair programming, you should definitely go to ConFreaks and check that out.
00:00:22.290 Now that this is off to a really good start, I told everyone to leave. So yeah, my name is Lee, and I want to talk about how we do global manufacturing at Teespring using Ruby. In the fashion of 2016 Ruby talks, we also use lots of software that is in Ruby.
00:00:33.149 I'm super excited to be working with hardware again. I've been writing Ruby since about 2008, but before that, I worked in robotics for a company called iRobot, where I was actually a mechanical design engineer. I worked a lot with different manufacturing methods like sheet metal, milling, CNC lathe, and 3D printing.
00:00:46.710 So manufacturing is something I've always really liked, and I had no idea my career would swing back this way. You don't always think about technology when you think about t-shirts and garments, but the truth is, there's a whole lot of technology behind it.
00:00:53.670 The oldest technology is screen printing, which we actually started seeing in China during the Song Dynasty in about the 10th century. The technology looks very, very different now, but the principles are quite similar. Essentially, you have a screen that has a negative image on it, you fill this with ink or paint, and then you're going to squeeze or roll that ink or paint through onto a substrate like cloth or a garment.
00:01:08.400 You can see a lot of really cool Chinese art created during this time using screen printing, but we didn't start to see it spread outside of China until the 17th and 18th centuries. They were using the trade route known as the Silk Road, which was the trade route from China to the rest of the world at that time.
00:01:19.500 The reason that silk and screen printing were tied together is that you've likely heard the phrase 'silk screen printing.' The silk was required because it was a very strong material, and you couldn't really do screen printing using cotton for the screen.
00:01:31.470 We saw screen printing go into the West around that time, and then in the 1950s and 1960s, we witnessed really cool advances in screen printing with artists like Warhol and Lichtenstein. What's fascinating is that screen printing was essential to what Warhol was trying to achieve with his art.
00:01:42.340 He was attempting to comment on how art is perceived and valued—how there's only one Mona Lisa, and that makes it valuable. Every painting is unique, and Warhol wanted to challenge that by making a thousand of them, or even a hundred thousand. They could be identical, and that’s exactly what you get with screen printing: the ability to create large quantities of something identical.
00:01:55.220 Today, a factory that specializes in screen printing comes a long way since then. This is our facility in Hebron, Kentucky, called Mercury, which is about 15 minutes from here. I should share a bit about what we do so you can get context for some of the topics I'll be discussing.
00:02:04.469 The way I usually describe Teespring is that we're essentially a marketplace that allows someone with a design or brand to create a product and turn it into reality. We take away the need for creators to understand how to manufacture their products.
00:02:13.120 We have this facility and work with third-party printers, which I'll discuss a little later. These creators can establish an online business or create a campaign, like raising money for charity. For example, I'm wearing this shirt which Bo Bergeron, a designer from Oakland, California, created to raise money for Louisiana flood relief. He raised over fifty thousand dollars—maybe even quite a bit more.
00:02:24.909 That’s how we operate, and screen printing is essential to managing larger campaigns where we're printing thousands of shirts. Typically, the process begins with artwork separation. If you have a design with, say, ten colors, you're going to need ten screens. First, we'll separate the design in a room full of designers using Photoshop on iMacs.
00:02:40.670 They pull the layers apart and make necessary adjustments. Automation isn't feasible for this step as it demands a good amount of artistry and craftsmanship. During this process, designers might remove discrepancies or decide to combine two similar colors to reduce costs, which is a judgment call.
00:02:52.150 Once the artwork is prepared, we might simultaneously pick the blank inventory off the rack. In a traditional e-commerce fulfillment center, this might be the complete process: receiving products, scanning them, entering their details into an inventory system, stocking them, and labeling them. We do all this as part of our process.
00:03:06.199 Then, you create the screens, which are made using several different methods. However, in high-volume manufacturing facilities for screen printing, they typically use a similar process. You have a flatbed inkjet printer that prints a positive image onto the screen. This process is very quick, and you'll need one screen for each color.
00:03:22.630 The screens go through a heating process to burn through the emulsion, converting the positive image into a negative. This resembles the screens used to push paint through, making it ready for production.
00:03:35.890 You usually have a large inventory of paint, and you'll need to mix colors based on the designs. The paint we use is a thick, latex-based mixture designed to bond well with the fabric, ensuring it lasts through washes.
00:03:46.580 Here, you can see a screen printing press with a range of blank t-shirts. The operator must align the shirt precisely against the screens to ensure the print is correctly positioned. A skilled screen press operator can print a shirt in about eight seconds.
00:03:53.000 When the machine is in action, each screen presses down on the garment and forces the paint through the image onto the shirt. The final step is a curing process, which dries the shirt and cures the paint so that it bonds to the fabric.
00:04:05.430 I mentioned multiple manufacturing processes; the second one is relatively newer—digital printing. The company that manufactures the digital printers we use has been around since about 2002. Early digitally printed shirts didn't last long and were of low quality, but today, the technology is impressive.
00:04:17.670 If you're familiar with inkjet printers, digital printing operates similarly. It involves a pump connected to a piezoelectric crystal. This technology uses the piezoelectric effect, meaning mechanical pressure on the crystal creates an electric field, which further drives the pumps to control ink droplets.
00:04:29.380 These droplets are electrically charged and passed between two high-voltage plates to deposit onto the substrate. While this explanation is simplified, the printers in today's industry utilize more complicated, multistage systems.
00:04:39.200 Here you can see one of our printers in action. My good friend Alex, who is not as fast at setting up shirts on the machine, has to align the garment carefully. Similar to screen printing, everything has to be lined up before printing. This particular machine can handle two shirts at once.
00:04:57.960 Configuration is crucial, as each garment has specific requirements determined by material and color. A significant part of our technology involves hard experimentation to produce high-quality shirts through digital printing.
00:05:11.210 If you're still waiting to see where Ruby comes in, you might be disappointed. Unfortunately, the proprietary machines we use do not provide nice, beautiful REST APIs. This is a common scenario in production systems where the software may not offer the ideal APIs one might expect from consumer-oriented tech like Arduino or Raspberry Pi.
00:05:24.040 As a software engineer in a company like this, you have to remember that the software is ultimately about people. This mantra is often repeated in retail but holds true on the operational and manufacturing side as well.
00:05:37.050 Software is also about processes, driven by individuals. Most of the software we develop is designed to monitor how our 200 employees work, aiming to identify their challenges and find ways to increase efficiency.
00:05:50.810 The technology we create is crafted around these operational processes. The reason we utilize Ruby, specifically Rails, is that a few years back, when we initiated the Teespring Rails app, we had no idea where our domain was heading.
00:06:05.340 For example, we started with screen printing, and now we're transitioning to digital. Handling a monolith is easier when the domain is uncertain, unlike microservices, which can complicate quick iterations.
00:06:18.989 We've benefitted a lot by maintaining everything in a 'majestic monolith,' even though there are several engines in our Rails app.
00:06:26.450 One segment I want to highlight is the commerce side, which refers to the buyer experience on teespring.com. Users browse categories, get recommendations, and make purchases.
00:06:35.210 On the creator side, the designer uploads their image and manages the campaign duration and pricing. We also have an artwork-related feature called Van Gogh, created in Go, convincing some that it’s necessary to include 'Go' in the title.
00:06:44.040 Most of what we develop is in Ruby, but several components interact with both the commerce and fulfillment aspects.
00:06:52.320 The fulfillment engine handles everything from the moment an order is placed until you receive the package. We’ve designed these Rails engines with the understanding that, as our engineering team grows, it may become necessary to separate certain services from the Rails app.
00:07:03.060 A natural division would separate the commerce and fulfillment domains, allowing us to establish a formal API contract between the two sections. The key concept in the fulfillment engine is called a fulfillment job.
00:07:15.010 I’ll walk you through the lifecycle of a fulfillment job regarding how we manage it within Teespring and with third-party printers. When you create an order, it depends on the campaign model. This approach originated from models taken from Kickstarter and IndieGoGo.
00:07:29.410 The campaign structure is beneficial since it creates urgency and a sense of community when, for instance, a campaign runs for seven days and shows progress: 100 people have already purchased, making others feel part of something.
00:07:41.590 With screen printing, there's a significant upfront fixed cost. You invest in screens and labor upfront, but as it becomes efficient, the marginal cost per shirt is minimal, allowing larger volumes at lower cost per item. This is similar to injection molding in manufacturing.
00:07:55.559 On the other hand, digital printing incurs a fixed cost for each order, regardless of the number printed, but it allows testing smaller orders profitably. The campaign structure supports this model, allowing us to collect numerous orders over time.
00:08:09.670 The campaign tender is a worker that operates through Sidekiq. We have methods that verify the campaign's validity and checks if orders meet the minimum requirements for printing, which can vary from three units or even one, depending on specific conditions.
00:08:21.800 The campaign tender also assesses if it is profitable for the creator, considering manufacturing costs, to prevent them from going into debt. If the campaign meets all these criteria, it ends successfully.
00:08:34.040 Next, we determine which printer will fulfill the order. We have multiple printers in our Mercury facility and work with several third-party printers when necessary. These partnerships can speed up shipping and allow us to experiment with merchandise.
00:08:45.320 There are two primary ways jobs get assigned to printers: the auto-assignor and our manual method through a printer designer. The auto-assignor identifies eligible printers with capacity to fulfill jobs, while the manual assignments occur when someone reviews printer availability.
00:08:59.320 After a job is assigned, a fulfillment job is created, which is an ActiveRecord object that includes fulfillment line items. Each item corresponds to a product being printed and shipped, and the fulfillment job exists throughout the entire fulfillment process.
00:09:14.570 We manage fulfillment through two main channels: within Mercury and using a product known as the printer portal. This portal allows our printers to review fulfillment jobs and manage their acceptance or rejection based on capacity.
00:09:27.170 Alternatively, printers can also integrate with our API for fulfilling jobs. Our APIs support various types of requests, including creation and updates to fulfillment jobs, and they’re documented using Grape and Swagger.
00:09:41.400 Another critical component is Apollo, which runs in our facility. Apollo is a Python-based application that tracks jobs throughout production. Each station is equipped with Apollo to log activities, ensuring we can measure efficiency and identify bottlenecks.
00:09:55.000 If you've ever engaged in Kanban software development, many principles apply equally to manufacturing, such as reducing waste—a concept that originates from lean manufacturing.
00:10:11.759 Apollo manages jobs from start to finish, eventually reaching the packing stage. We utilize an auto-bagger to streamline the packaging process, scanning barcodes along the way. Every order retains its barcode until it arrives at your door.
00:10:26.539 The entirety of the process from bagging to labeling is managed through our Rails application, allowing easy label printing for fulfillment jobs.
00:10:41.630 The conveyor belt is crucial too, transporting bags to shipping. A fun fact is that every visit to Mercury reveals layout changes—it's dynamic, continuously learning and adapting to improve, except for the conveyor belt, which is fixed.
00:10:56.259 However, sometimes the process doesn't go perfectly. We do have customer service capabilities and a comprehensive admin tool to handle inquiries and issues efficiently, ensuring customer satisfaction.
00:11:12.259 The takeaway I would love for you to retain from this presentation is the intertwining of software and manufacturing. While I might not remember all the historical details, the essence is that software should serve people, as processes inherently revolve around individuals.
00:11:25.229 Our focus extends beyond crafting clean APIs—it's about identifying challenges, innovating solutions, and improving how our team operates every day, as evidenced by the physical t-shirts we produce from lines of code.
00:11:41.240 Thank you for your time! I'd love to answer any questions.
00:11:55.190 Regarding the elevation characteristic of screen-printed shirts, digital versions lack this elevation because their inks blend more with the fabric. A stylistic choice emerges, as many associate the raised look of screen printing with a retro aesthetic.
00:12:07.360 On the architecture of our system, we have multiple Rails engines divided by domain, which share models and hit the same database. This design allows for closer collaboration between components and puts us in a position to separate services as needed.
00:12:25.440 About the absence of public APIs for our printers, we indeed use excellent printers—but they don't currently provide those APIs due to their unique manufacturing processes. While they produce fantastic machines, their approach is rudimentary rather than highly automated.
00:12:41.270 Consequently, I wouldn’t want to suggest they've totally automated their offerings—there's a significant amount of craftsmanship involved. Our approach is about preserving jobs and ensuring equitable working conditions for our employees.
00:12:56.270 So yes, Teespring is hiring, and I would love to connect with anyone interested!
Explore all talks recorded at RubyConf 2016
+82