133: Sam Selikoff - Building Production-Ready SPAs Fast with Mirage.js
Episode
63 min
Read time
2 min
Topics
Product & Tech Trends
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.
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
The Productivity Show
The Three Investments That Compound Like Crazy (TPS613W)
May 20
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
The Compound and Friends
It’s a Wave Not a Bubble, Nvidia Preview, Google’s I/O Highlights, Investing in Space Stocks
May 20
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
The Productivity Show
May 20
The Three Investments That Compound Like Crazy (TPS613W)
The Compound and Friends
May 20
It’s a Wave Not a Bubble, Nvidia Preview, Google’s I/O Highlights, Investing in Space Stocks
Feel Better, Live More
May 19
The Simple Nutrient That Could Transform Your Gut Health, Brain Power & Longevity with Dr Emily Leeming #658
The Journal
May 19
Trapped in the Strait of Hormuz
The Long Run with Luke Timmerman
May 19
Ep201: Jeremy Levin on Biotech in the Balance
Explore Related Topics
This podcast is featured in Best Cybersecurity Podcasts (2026) — ranked and reviewed with AI summaries.
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 up to 3 shows.
Start My Monday DigestNo credit card · Unsubscribe anytime