Fastify + Vercel = Best Vibes – Single file, 2 mins

Sometimes you don’t need a full-blown app. You just need one endpoint. Maybe it’s for a tool you’re building. Maybe it’s a prototype. Or maybe, it’s just for the vibes. Fastify + Vercel is a great combo for that.

Let’s walk through how you can build and deploy a /books API endpoint using Fastify and Drizzle ORM — and how surprisingly easy it is.

Why Vercel for an API?

You probably know Vercel as the go-to place for frontend apps, especially Next.js. But it also works beautifully for backend use cases, like single endpoint APIs.

Here’s why:

  • Zero-config deploys
  • Built-in scalability
  • Serverless by default
  • Free tier good enough for small APIs
  • Instant previews for each commit

That means your idea can go from local to live in minutes.

Let’s Build /books CRUD

In this example, we’ll build a RESTful CRUD endpoint for managing books. We’ll use Fastify as the HTTP framework, and Drizzle as the ORM to talk to a database. You can swap Drizzle with anything else (Prisma, Kysely, raw SQL), but for this demo, we’ll show Drizzle in the code.

File: api/books.ts

import { drizzle } from 'drizzle-orm/vercel-postgres';
import { sql } from '@vercel/postgres';
import { FastifyRequest, FastifyReply } from 'fastify';
import Fastify from 'fastify';

const db = drizzle(sql);

const fastify = Fastify();

fastify.get('/books', async (req: FastifyRequest, reply: FastifyReply) => {
  const books = await db.query.books.findMany();
  return reply.send(books);
});

fastify.post('/books', async (req: FastifyRequest, reply: FastifyReply) => {
  const body = req.body as { title: string; author: string };
  const inserted = await db.insertInto('books').values(body).returning();
  return reply.code(201).send(inserted);
});

fastify.put('/books/:id', async (req: FastifyRequest, reply: FastifyReply) => {
  const { id } = req.params as { id: string };
  const body = req.body as { title?: string; author?: string };
  const updated = await db.update('books').set(body).where({ id }).returning();
  return reply.send(updated);
});

fastify.delete('/books/:id', async (req: FastifyRequest, reply: FastifyReply) => {
  const { id } = req.params as { id: string };
  await db.deleteFrom('books').where({ id });
  return reply.code(204).send();
});

export default fastify;

This file is all you need. Put it under the api/ folder in a Vercel project. Vercel will automatically treat it as a serverless function.

Deploy it

npm install -g vercel
vercel login
vercel

That’s it. You’ll get a working API endpoint at something like:

https://your-app-name.vercel.app/api/books

Test It with curl

Here’s how to add a book:

curl -X POST <https://your-app-name.vercel.app/api/books> \
  -H "Content-Type: application/json" \
  -d '{"title": "The Pragmatic Programmer", "author": "Andy Hunt"}'

You’ll get a 201 Created with the new book entry.

Popular Fastify Plugins

Fastify has a rich plugin ecosystem. Some handy ones to know:

Adding them is just a few lines of code. That’s part of the joy of Fastify.

Best Vibes

Fastify on Vercel is perfect for AI-generated APIs. When tools or agents generate code for your backend, you want:

  • Fast iteration
  • Clear docs
  • Built-in tests
  • Easy deploys

This combo checks all those boxes. It’s low friction, flexible, and fun to build with. You can write code manually or have AI generate it—and either way, it just works.

When you want to build fast and iterate even faster, this is a stack worth reaching for.


That’s it. One file, fully working CRUD API, deployable in under 2 minutes. Enjoy the vibes 🧃

Using Airtable through its API programmatically, as (almost) remote database

I recently talked a lot about the importance of collaborative and smarter documentation that will improve your personal and professional workflow. Certainly, it will be different than other competitors in an interesting use case I found myself in one of the hobby projects that I used Airtable as a remote database tool all of the sudden.

Airtable is a very nice mobile-friendly document management in a “spreadsheet” style base. You can create your data structure in any data table model. You can create different views for your data (in calendar view, or filtered table view, or kanban view…).

img_0201.jpg

What makes Airtable special for me is its API. Their API is so easy to get started and access, because you get your data-specific API documentation after you login. It shows your data in API example right and there in the dynamic documentation.

img_0200.png

Airtable API essentially makes Airtable that can be used as a remote database for small or personal projects. Managing your data belongs to Airtable’s clean and nice web or mobile interface, and you implement your data in any format you like on any platform.

If you are needing read-only access, implementing Airtable API can be a matter of minutes since the documentation gives access to your data very quickly. You only need to convert the curl request to your favorite platform’s HTTP request. If you are needing a javascript version, it also produces NodeJS example code that you can drop in and start using your data.

img_0199.png

Write access is also not very different than read-only. Your data model will be well be documented in the dynamic API documentation for your table. You only need to start constructing your API requests and make the call…

If you haven’t created an Airtable account and played with it, definitely do so: https://airtable.com/ and check out their auto-generated documentation here: https://airtable.com/api (after you login to your account).