Better Upload

Other Frameworks

Better Upload can work in any framework with API routes that use standard Request and Response objects. You can even use it in a separate backend server, like Hono.

Here are some examples of how to use Better Upload in other frameworks:

Full Stack

Remix

The only difference when using Better Upload with Remix is how you define your handler. You can use handleRequest to handle a generic request.

app/routes/api.upload.ts
import { ActionFunctionArgs } from '@remix-run/node';
import { handleRequest } from 'better-upload/server';
 
export async function action({ request }: ActionFunctionArgs) {
  return handleRequest(request, {
    // your router config...
  });
}

Backend

When using a different backend server, make sure to update the api option on the client hooks and components.

Hono

import { Hono } from 'hono';
import { handleRequest } from 'better-upload/server';
 
const app = new Hono();
 
app.post('/api/upload', (c) => {
  return handleRequest(c.req.raw, {
    // your router config...
  });
});

On this page