API Reference

Complete API reference for pushduck - from client hooks to server configuration and storage operations

Complete API Documentation

Complete reference documentation for all pushduck APIs, from client-side hooks to server configuration and storage operations.

Type-Safe by Design: All pushduck APIs are built with TypeScript-first design, providing excellent developer experience with full type inference and autocompletion.

Client APIs

Server Configuration

Server APIs

Developer Tools

Quick Reference

Basic Server Setup

import { createS3Router, s3 } from 'pushduck/server';

const uploadRouter = createS3Router({
  storage: {
    provider: 'aws-s3',
    region: 'us-east-1',
    bucket: 'my-bucket',
    credentials: {
      accessKeyId: process.env.AWS_ACCESS_KEY_ID!,
      secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY!,
    },
  },
  routes: {
    imageUpload: s3.image().maxFileSize("5MB"),
    documentUpload: s3.file().maxFileSize("10MB"),
  },
});

export const { GET, POST } = uploadRouter.handlers;

Basic Client Usage

import { useUpload } from 'pushduck/client';

function UploadComponent() {
  const { upload, uploading, progress } = useUpload({
    endpoint: '/api/upload',
    route: 'imageUpload',
  });

  const handleUpload = async (file: File) => {
    const result = await upload(file);
    console.log('Public URL:', result.url);           // Permanent access
    console.log('Download URL:', result.presignedUrl); // Temporary access (1 hour)
  };

  return (
    <div>
      <input type="file" onChange={(e) => handleUpload(e.target.files![0])} />
      {uploading && <div>Progress: {progress}%</div>}
    </div>
  );
}

Architecture Overview

Getting Started: New to pushduck? Start with the Quick Start guide, then explore the specific APIs you need for your use case.

API Categories

CategoryPurposeBest For
Client APIsFrontend file uploadsReact components, user interactions
Server APIsBackend upload handlingRoute definitions, validation
Storage APIsFile managementListing, deleting, URL generation
ConfigurationSetup and customizationProject configuration, advanced features
Developer ToolsDevelopment workflowSetup, debugging, optimization

Next Steps

  1. New to pushduck? → Start with Quick Start
  2. Setting up uploads? → Check S3 Router
  3. Building UI? → Explore React Hooks
  4. Managing files? → Use Storage API
  5. Need help? → Visit Troubleshooting