133: Sam Selikoff - Building Production-Ready SPAs Fast with Mirage.js
Episode
63 min
Read time
2 min
Topics
Productivity, Relationships, Startups
AI-Generated Summary
Key Takeaways
- ✓Development workflow integration: Mirage runs in the same process as your front-end application without requiring separate terminal tabs or port configurations. Import the library into your bootstrap file, instantiate the server in development mode, and define endpoints that intercept fetch requests while maintaining identical application code for production.
- ✓In-memory database layer: Mirage maintains referential integrity across route handlers through a shared JavaScript object database. Create data using factory patterns inspired by Rails' factory_bot, define relationships like director-has-many-movies, and mutations persist across navigation without managing foreign keys manually, enabling realistic multi-page workflows during development.
- ✓Testing and development code reuse: The same route handler definitions work in both development and testing environments. Tests start with an empty database and use server.create to set up specific scenarios, while development uses seed hooks. This eliminates duplicate mocking code and keeps tests focused on assertions rather than API implementation details.
- ✓Serializer layer flexibility: Mirage separates database conventions from API response formats through a serializer layer. Store data using camelCase JavaScript conventions internally, then configure serializers for JSON API, Active Model Serializer, or custom formats. Built-in serializers handle root keys, meta information, and relationship linking without changing database structure.
- ✓State management advantages: Front-end developers can define multiple data scenarios locally without coordinating shared staging environments or running complex back-end infrastructure. Switch between states like anonymous user, subscriber, or admin by changing variables in seed files. Hot module reloading applies data changes instantly without restarting servers or running database migrations.
What It Covers
Sam Selikoff explains Mirage.js, an API mocking tool that intercepts HTTP requests in JavaScript applications, enabling front-end developers to build production-ready features without waiting for back-end APIs by creating an in-memory database alongside their development workflow.
Key Questions Answered
- •Development workflow integration: Mirage runs in the same process as your front-end application without requiring separate terminal tabs or port configurations. Import the library into your bootstrap file, instantiate the server in development mode, and define endpoints that intercept fetch requests while maintaining identical application code for production.
- •In-memory database layer: Mirage maintains referential integrity across route handlers through a shared JavaScript object database. Create data using factory patterns inspired by Rails' factory_bot, define relationships like director-has-many-movies, and mutations persist across navigation without managing foreign keys manually, enabling realistic multi-page workflows during development.
- •Testing and development code reuse: The same route handler definitions work in both development and testing environments. Tests start with an empty database and use server.create to set up specific scenarios, while development uses seed hooks. This eliminates duplicate mocking code and keeps tests focused on assertions rather than API implementation details.
- •Serializer layer flexibility: Mirage separates database conventions from API response formats through a serializer layer. Store data using camelCase JavaScript conventions internally, then configure serializers for JSON API, Active Model Serializer, or custom formats. Built-in serializers handle root keys, meta information, and relationship linking without changing database structure.
- •State management advantages: Front-end developers can define multiple data scenarios locally without coordinating shared staging environments or running complex back-end infrastructure. Switch between states like anonymous user, subscriber, or admin by changing variables in seed files. Hot module reloading applies data changes instantly without restarting servers or running database migrations.
Notable Moment
Selikoff reveals that some development teams have successfully deployed Mirage-powered prototypes to production using local storage for persistence, creating fully functional demos for sales teams. Future plans include generating real Node.js back-end servers directly from Mirage definitions, potentially eliminating the need to manually build APIs for data-driven applications.
Episode Transcript
In this episode of Fullstack Radio, I talked to Sam Salikoff about using Mirage JS to build production ready at front end features even if your API isn't ready yet. This is Fullstack Radio episode one thirty three. So the other day, you when was the other day? Like, Friday? Was it Friday? Friday. Yeah. So Friday, you released kind of the first real deal version of Mirage JS. And even that is actually a little bit confusing to me, and I'm interested in getting the story around that because as far as I know, like, Mirage has been a tool that people have been using in the Ember community, for a long time. So what is Mirage in the fewest kind of words possible? And why is it that just now we're getting kind of like the universal, Mirage release? And what is different compared to what people have been using for years in Ember? Good question. Good question. And the confusion is understandable. Yeah. Mirage is an API mocking tool for front end developers. So specifically, it monkey patches, window XML HTTP request and fetch. And anytime your application code tries to use those to make a network request, which is how JavaScript apps get get data from a server, Mirage is gonna intercept those and return some, dummy data instead, basically. Got it. So I think, someone would hear that pitch and it would be easy for them to assume that Mirage is like a library that you use when running your tests, and that's kind of its main job. Like, oh, yeah. It's like a plug in for Jest or something. You know, it almost feels like it fits in that category. But from kinda like learning more about the project from you over the last couple of months where you've been kinda hacking on it, I think the real powerful part of it is kinda, like, the actual front end development workflow it enables rather than, like, how it could or could not be used for testing. So do you mind talking a little bit about, like, why it's a useful tool even for well, not even for, but why it's a useful tool just as part of your front end development workflow completely ignoring, like, the whole writing automated tests side of things. Yeah. Definitely. So, it it did come from a testing world, but what it is today is different. And like you said, it's really the development work flow it enables, which is one of the main value propositions of Mirage. And that is kind of this front end first workflow where, a team that is working on a fat client app, you know, an SPA or, you know, even teams that build, like, native iOS apps. Those kinds of apps have a data layer. They have these really nice boundaries between kind of the client interactions and the server piece. And so what happens when you're building apps like that is …
Get the full transcript (12,740 words) + summary by email — free
One-time email with the complete transcript and AI summary of this episode. No account needed.
One email, no spam. We’ll also show you what SignalCast does.
You just read a 3-minute summary of a 60-minute episode.
Get Full Stack Radio summarized like this every Monday — plus up to 2 more podcasts, free.
Pick Your Podcasts — FreeKeep Reading
More from Full Stack Radio
153: DHH – Omarchy and Designing Your Own OS on Arch Linux
Aug 21 · 76 min
Odd Lots
NYT CEO Meredith Kopit Levien on Running a Media Brand in the Age of AI
Aug 10
More from Full Stack Radio
152: Ben Orenstein - How to Stand Out When Applying for a Job at a Small Company
Jan 28 · 47 min
Odd Lots
The Creator of Claude Code on The Hottest Piece of Software in the World
Jul 20
Books, tools, and gear mentioned in this episode
SignalCast may earn commission on purchases via these links.
Tools
“Create data using factory patterns inspired by Rails' factory_bot, define relationships like director-has-many-movies, and mutations persist across navigation.”
“Sam Selikoff explains Mirage.js, an API mocking tool that intercepts HTTP requests in JavaScript applications, enabling front-end developers to build production-ready features without waiting for back-end APIs.”
More from Full Stack Radio
We summarize every new episode. Want them in your inbox?
153: DHH – Omarchy and Designing Your Own OS on Arch Linux
152: Ben Orenstein - How to Stand Out When Applying for a Job at a Small Company
151: DHH – Building HEY with Hotwire
150: Secret Screencasting Tips & Behind the Scenes of Tailwind CSS 2.0
149: Choosing a Payment Processor, Radical Icons & W3C Hype
Similar Episodes
Related episodes from other podcasts
Odd Lots
Aug 10
NYT CEO Meredith Kopit Levien on Running a Media Brand in the Age of AI
Odd Lots
Jul 20
The Creator of Claude Code on The Hottest Piece of Software in the World
The Vergecast
Jul 16
The one AI detector people actually trust
Eye on AI
Jul 13
Inside the Enterprise Browser Rebuilding Security for the AI Era | Bradon Rogers, Island
10% Happier with Dan Harris
Jul 1
How To Regulate Your Nervous System: Anxiety, Relationships, and the Baggage You Didn't Ask For | Dr. Bruce Perry
Explore Related Topics
This podcast is featured in Best Cybersecurity Podcasts (2026) — ranked and reviewed with AI summaries.
Read this week's Startups & Product Podcast Insights — cross-podcast analysis updated weekly.
You're clearly into Full Stack Radio.
Every Monday, we deliver AI summaries of the latest episodes from Full Stack Radio and 192+ other podcasts. Free for one show.
Start My Monday DigestNo credit card · Unsubscribe anytime