Sign in

Michael Bleigh

@mbleigh.dev
524 followers 127 following 477 posts

Building the servers for serverless at Firebase. Web platform aficionado.

PostsRepliesMedia
Michael Bleigh @mbleigh.dev · 20/09/2026
When AI builds an interface.
0171
Michael Bleigh @mbleigh.dev · 26/08/2025
The image editing capabilities of Gemini 2.5 Flash are really something else. I think there will be some really cool stuff built on top of this, can't wait to see it!
000
Michael Bleigh @mbleigh.dev · 26/08/2025
Want to bring 🤏🍌 into your app? Frontier image editing in Genkit is just a few lines of code away. Available now, no need to upgrade your Genkit version. Just use the 'gemini-2.5-flash-image-preview' model and set responseModalities in config.
import { genkit } from "genkit";
import { googleAI } from "@genkit-ai/google-genai";

const plant = fs.readFileSync('palm_tree.png', { encoding: 'base64' });
const room = fs.readFileSync('my_room.png', { encoding: 'base64' });

const ai = genkit({googleAI()});

const { media } = await ai.generate({
  model: googleAI.model('gemini-2.5-flash-image-preview'),
  prompt: [
    { text: 'add the plant to my room' },
    { media: {url: `data:image/png;base64,${plant}`} },
    { media: {url: `data:image/png;base64,${room}`} },
  ],
  config: {responseModalities: ['TEXT', 'IMAGE']},
});

media.url; // "data:image/png;base64,..."
120
Michael Bleigh @mbleigh.dev · 21/08/2025
OK this is why you should always check your assumptions...for some reason I thought (a) you can't await a promise multiple times (b) you can't await a promise that's already resolved Neither of these are true, so you can just do this.
030
Michael Bleigh @mbleigh.dev · 21/08/2025
Is there a better pattern than the snippet below for "async initialization classes" where the constructor needs to kick off async work but I want to "push down" waiting for that async to the methods? I find myself using this pattern frequently but it feels clunky and ugly.
330
Michael Bleigh @mbleigh.dev · 23/07/2025
We've seen that lots of folks like getting started in the console (especially with our "natural language to schema/operations" features) and now there's a one-liner script to download a generated SDK from the console.
100
Michael Bleigh @mbleigh.dev · 23/07/2025
We also now support defining enums which are translated into Postgres native enums, but better than that these translate into strongly typed enums across all generated SDKs in JS, Kotlin, Swift, and Dart. Enums can be filtered and even ordered (think log levels) like any other field.
100
Michael Bleigh @mbleigh.dev · 23/07/2025
I won't bury the lede...FULL TEXT SEARCH ON FIREBASE! 🤯 You can use the "searchable" directive to make any table in your schema searchable. We manage the indexing for you with Postgres native FTS capabilities. You can also filter, order, etc like normal. Also multi-language!
100
Michael Bleigh @mbleigh.dev · 18/07/2025
We also support more than just tools! You can leverage prompts and resources from MCP servers and they are natively translated into Genkit prompts and the (brand new) resources support.
100
Michael Bleigh @mbleigh.dev · 18/07/2025
You can programmatically manage your MCP server connections including dynamically disabling, reconnecting, or efficiently updating the entire server config all at once. We took many practices we're seeing from various MCP clients in the field and built them in.
100
Michael Bleigh @mbleigh.dev · 18/07/2025
Genkit v1.15 is out and includes a feature we've been cooking for a while: a completely revamped MCP plugin tailored for building complex "host" apps that connect to many MCP servers. The new MCP Host capabilities let you pass in an "mcpServers" config...and we do the rest. ✨
140
Michael Bleigh @mbleigh.dev · 29/06/2025
It occurs to me that we probably already have a pretty accurate model for how "agents as employees" will play out: self-driving cars. There are defined "autonomy levels" and we see those playing out in the market today for cars. Let's think about them in the analogous case of software engineering.
110
Michael Bleigh @mbleigh.dev · 24/06/2025
People congratulating me on 10y at Google: "Firebase has your fingerprints all over it!" Colleague (in DM): "That sounds like something the detectives say when they are interrogating you for a crime."
A man in a hot dog costume saying "We're all trying to find the guy who did this."
030
Michael Bleigh @mbleigh.dev · 19/06/2025
Okay this is totally a brag post but it feels pretty cool to have made a small contribution to the MCP spec!
020
Michael Bleigh @mbleigh.dev · 01/06/2025
A pattern I use frequently when coding with LLMs: 1. Stub out an interface (see screenshot) 2. Write guidance in comments in the function body 3. Prompt "implement someThing in @some-file.ts following the provided comments. Add unit tests. See also @other-file.ts for context."
110
Michael Bleigh @mbleigh.dev · 22/05/2025
1️⃣ Add "llmTools" config to Data Connect to generate a tool definition file. 2️⃣ Use Genkit's Firebase plugin to make tools available to your model. 3️⃣ Build agents that can query your app's database. ✨ Enjoy the show.
100
Michael Bleigh @mbleigh.dev · 20/05/2025
We've moved the documentation for Genkit, our open-source framework for building GenAI app features, to its own dedicated website. Say hello to genkit.dev!
100
Michael Bleigh @mbleigh.dev · 20/05/2025
One example I found fun to try: "summarize my app's data model by exploring my firestore collections and fetching a few documents from each". Gemini goes brrrrr, and voila!
100
Michael Bleigh @mbleigh.dev · 20/05/2025
Firebase now has an MCP server baked into the Firebase CLI! With it you can let your AI coding tools: ✨ Provision projects 🔎 Explore data 🔧 Debug rules And much much more!
120
Michael Bleigh @mbleigh.dev · 13/05/2025
Me, after losing all my money on a bad investment: "This is impossible! They *specifically* said it wasn't a scam!"
000
Michael Bleigh @mbleigh.dev · 02/05/2025
This is why things like Genkit's Dev UI are so important. Big long workflow? Break it down into smaller chunks and rapidly play with those smaller chunks. Find a set of inputs that you like to test, save it as an eval, make a change, run the eval. Tighter loop!
000
Michael Bleigh @mbleigh.dev · 25/04/2025
Check out Dotprompt Fiddle! It's an easy way to test out prompts instantly in your browser then grab them as ready to go templates for your code. You can also generate a prompt (like this example of an RPG character sheet generator). Try it today: fiddle.genkit.dev/
000
Michael Bleigh @mbleigh.dev · 09/04/2025
🐘 Firebase Data Connect is now GA and ready for your production workloads. It's Firebase magic on top of PostgreSQL. 🆕 Generate app schema from a prompt 🆕 Perform aggregation queries (count, avg, min, max) with ease 🆕 React and Angular bindings firebase.blog/posts/...
110
Michael Bleigh @mbleigh.dev · 09/04/2025
🧑‍💻 Introducing Firebase Studio, your VM-powered development environment in the cloud that lets you vibe with prompts or switch to a full IDE at any time. This is the next evolution of Project IDX and it's in public preview today! Check it out at firebase.studio
100
Michael Bleigh @mbleigh.dev · 05/04/2025
The Gemini 2.5 models have advanced image understanding, including image segmentation! You can generate bounding boxes and masks in less than 40 lines of JS with Genkit. Want to try it yourself? Here's the full source code as a gist: gist.github.com/mble...
031
Michael Bleigh @mbleigh.dev · 30/03/2025
Maybe this is the disconnect with AI? How is an 800% productivity gain at a task not exciting? If AI makes knowledge work more productive by some low multiple (say even 2x) and does nothing else that would be an enormously impactful and important technology!
100
Michael Bleigh @mbleigh.dev · 27/03/2025
I just got a new Macbook Pro and holy moly how is this setting on by default? "I want my virtual desktops to randomly rearrange themselves constantly so I can never consistently get where I'm trying to go".
100
Michael Bleigh @mbleigh.dev · 10/03/2025
It's now super easy to create eval datasets using Genkit. You can just click "Add to Dataset" straight from a debug *or* production trace.
100
Michael Bleigh @mbleigh.dev · 04/03/2025
What can you do with multimodal LLMs? How about identifying objects by name, description, color, and even drawing a bounding box around them? 🖼️ ➡️ 📄 Gemini makes it possible, Genkit makes it simple.
130
Michael Bleigh @mbleigh.dev · 12/02/2025
I use Genkit for pretty much everything I build in GenAI. I've built out everything from synthetic data generation helpers to code generation agents to a whodunnit mystery game. 🔥 Never a better time to get started than right now! 🔥 firebase.google.com/...
010
Michael Bleigh @mbleigh.dev · 12/02/2025
These new features are on top of a polished, refined, and production-ready version of all the stuff that Genkit was already great at like text prompt templates with Dotprompt. 📄 firebase.google.com/...
100
Michael Bleigh @mbleigh.dev · 12/02/2025
🆕 "Interrupts" let you define when the generation loop should pause and wait for outside input. It's great for building rich UI for clarification as well as workflows that require "confirmation" or out-of-band actions. ⚡ examples.genkit.dev/... 📄 firebase.google.com/...
100
Michael Bleigh @mbleigh.dev · 12/02/2025
🆕 "Action Context" lets you set and access "side channel" information in your tools and prompts. This makes it much easier to build secure workflows because only your deterministic code can set context. ⚡ examples.genkit.dev/... 📄 firebase.google.com/...
100
Michael Bleigh @mbleigh.dev · 12/02/2025
Genkit JS just hit 1.0! It's the open source SDK for GenAI you don't want to sleep on. 🔄 Extensible to any model provider 🏗️ Structured output and streaming 📝 Rich text-based prompt templating 📱 Designed to integrate well with apps
120
Michael Bleigh @mbleigh.dev · 26/01/2025
Or, hear me out, shut down the whole memecoin industry and nothing of value will be lost.
We need to rethink our listing process at 
@coinbase
 given there are ~1m tokens a week being created now, and growing. High quality problem to have, but evaluating each one by one is no longer feasible. And regulators need to understand that applying for approval for each one is totally infeasible at this point as well (they can't do 1m a week). It needs to move from a an allow list to a block list, and utilize customer reviews/automated scans of onchain data etc to help customers sift through.

That and we'll continue integrating native DEX support more deeply. Customers shouldn't need to know or care whether the trade is happening on a DEX or CEX.
020
Michael Bleigh @mbleigh.dev · 28/11/2024
020
Michael Bleigh @mbleigh.dev · 27/11/2024
The Genkit MCP plugin can instantly turn your existing Genkit tools and prompts into an MCP server...in fact, it's quite a bit less code than using the MCP SDK directly!
200
Michael Bleigh @mbleigh.dev · 27/11/2024
🆕 @firebase.com Genkit is now the first (afaik) AI framework to integrate with @anthropic.com's new Model Context Protocol. MCP bundles tools, prompts, and more in a "server", and Genkit can now both consume and produce these servers. Here's a GitHub search bot in ~20 lines of code:
183
Michael Bleigh @mbleigh.dev · 26/11/2024
Should Genkit integrate with the new Model Context Protocol? Managed to get this working in an afternoon of hacking...
240
Michael Bleigh @mbleigh.dev · 05/11/2024
I'm a moderate in the sense of disagreeing strongly with each party in various domains, but human rights and personal autonomy are table stakes and only one party wants to protect them. I voted today for Harris and to protect marriage equality in California.
020
Michael Bleigh @mbleigh.dev · 03/11/2024
070
Michael Bleigh @mbleigh.dev · 28/10/2024
You can also use views to create more complex reporting queries, the kind you might show in an administrative dashboard. With an ecommerce site, for example, you can create a daily order volume report:
type Product @table { name: String!, listPrice: Int! }
type Order @table { purchaseTime: Timestamp! orderTotal: Int }
type OrderItem @table {
  order: Order!
  product: Product!
  quantity: Int
  purchasePrice: Int # fixed at checkout time
}

type DailyOrderReport @view(sql: """
SELECT 
  DATE_TRUNC('day', o.purchase_time) as order_date,
  COUNT(DISTINCT o.id) as total_orders,
  SUM(oi.quantity) as total_items,
  ROUND(AVG(o.order_total)) as avg_order_total,
  SUM(o.order_total) as total_revenue
FROM order o
LEFT JOIN order_item oi ON oi.order_id = o.id
GROUP BY DATE_TRUNC('day', o.purchase_time)
""") {
  orderDate: Date @unique
  totalOrders: Int
  totalItems: Int
  avgOrderTotal: Int
  totalRevenue: Int
}

# now we can create queries to expose easily chartable information

query DailyOrders(
  $startDate: Date, $endDate: Date
) @auth(expr: "auth.token.admin == true") {
  dailyOrderReports(where: {orderDate: {gte: $startDate, lte: $endDate}}) {
    orderDate, totalOrders, totalItems, avgOrderTotal, totalRevenue
  }
}
100
Michael Bleigh @mbleigh.dev · 28/10/2024
Use views to aggregate information about other types. If I'm building a movie review app, I'll frequently need to surface aggregate review information. Views make it as easy as selecting additional fields in your query:
type Movie @table { title: String! releaseDate: Date! }
type Review @table { movie: Movie! rating: Int }

type ReviewStats @view(sql: """
SELECT movie_id,
  COUNT(*) as count,
  ROUND(AVG(rating), 2) as avg_rating
""") {
  movie: Movie @unique
  count: Int
  avgRating: Float
}

# now I can add review stats to any query about movies…

query LatestMovies @auth(level: PUBLIC) {
  movies(orderBy: [{releaseDate: DESC}], limit: 10) {
    id, title
    reviewStats { count, avgRating }
  }
}
100
Michael Bleigh @mbleigh.dev · 28/10/2024
Use views to create virtual types. For instance, if I have a blog/publication where each article has a list of string tags, I can find top tags by creating a virtual Tag type:
type Article @table { title: String! body: String! tags: [String] }

type Tag @view(sql: """
SELECT tag, COUNT(*) as count
  FROM article, unnest(tags) as tag
  GROUP BY tag
""") {
  tag: String @unique
  count: Int
}

# now we can query it like any other type…

query TopTags(
  # if supplied, find tags with prefix e.g. "news-". if omitted, matches all tags
  $prefix: String
) @auth(level: PUBLIC) {
  tags(
    where: {tag: {startsWith: $prefix}},
    orderBy: [{count: DESC}], limit: 5
  ) { tag, count }
}
100
Michael Bleigh @mbleigh.dev · 28/10/2024
Firebase Data Connect brings SQL to Firebase and has built-in support for most common PostgreSQL queries, but what happens when you need that raw SQL power for e.g. aggregations? That's where Data Connect's @view directive comes in. A few examples...
type MyView @view(sql: """
  -- you can write an arbitrary SELECT statement as a view
  SELECT field1, user_id, SUM(field2) as total FROM my_table
  GROUP BY field1, user_id
""") {
  # then map it to GraphQL fields
  field1: Int
  # or even define relations to other types
  user: User
  total: Int
}
122
Michael Bleigh @mbleigh.dev · 09/05/2023
This has always been my fav.
071