Skip to content


A function ready made for next.js in order to directly export it, which handles all incoming POST requests that apps will trigger when users press buttons in your Frame. It handles all the redirecting for you, correctly, based on the FrameContainer props defined by the Frame that triggered the user action. @param req a NextRequest object from next/server (Next.js app router server components) @returns NextResponse


export { POST } from "frames.js/next/server";

With url-space saving redirects

import { POST as POSTNext, PreviousFrame } from "frames.js/next/server";
import { NextRequest, NextResponse } from "next/server";
export function POST(req: NextRequest, res: NextResponse) {
  const redirectHandler = (prevFrame: PreviousFrame) => {
    if (prevFrame.postBody?.untrustedData.buttonIndex === 4)
      return "";
  return POSTNext(req, res, redirectHandler);