Skip to content

A modern, lightweight API testing tool built with Next.js 16, React 19, and TypeScript. Inspired by Postman and Requestly, designed for developers who need a fast, clean interface for testing APIs.

License

Notifications You must be signed in to change notification settings

Pratham-Prog861/mini-postman

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

16 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ Mini Postman

A modern, lightweight API testing tool built with Next.js 16, React 19, and TypeScript. Inspired by Postman and Requestly, designed for developers who need a fast, clean interface for testing APIs.

Mini Postman React TypeScript

โœจ Features

  • ๐ŸŽฏ All HTTP Methods: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS
  • ๐Ÿ“ Custom Headers: Add, edit, and toggle custom request headers
  • ๐Ÿ“ฆ JSON Body Editor: Built-in JSON validation and formatting
  • ๐ŸŽจ Beautiful UI: Dark mode with zinc color scheme using shadcn/ui
  • โšก Fast & Responsive: Smooth animations with Motion (Framer Motion)
  • ๐Ÿ“Š Response Viewer: Tabbed interface for Body, Headers, and Raw response
  • ๐Ÿ• Request History: Automatically saves last 10 requests to localStorage
  • ๐Ÿ”’ No CORS Issues: Server-side proxy bypasses all CORS restrictions
  • ๐ŸŒ Universal Access: Test localhost, Render, Vercel, or any backend URL
  • โŒจ๏ธ Keyboard Shortcuts:
    • Ctrl+Enter (or Cmd+Enter) to send request
    • Ctrl+K (or Cmd+K) to focus URL bar
  • ๐Ÿ“‹ Copy Response: One-click copy to clipboard
  • ๐Ÿ” Syntax Highlighting: Properly formatted JSON responses
  • ๐Ÿšจ Error Handling: Comprehensive error messages for network, CORS, and validation issues
  • ๐Ÿ“ฑ Mobile Friendly: Responsive design that works on all devices

๐Ÿ› ๏ธ Tech Stack

  • Framework: Next.js 16.0.3 (App Router)
  • Language: TypeScript 5
  • Styling: Tailwind CSS 4
  • UI Components: shadcn/ui (zinc theme)
  • Animations: Motion (Framer Motion)
  • HTTP Client: Axios
  • JSON Viewer: react-json-view-lite
  • Notifications: Sonner
  • Icons: Lucide React

๐Ÿ“ฆ Installation

# Clone the repository
git clone https://github.com/Pratham-Prog861/mini-postman.git
cd mini-postman

# Install dependencies
npm install

# Run development server
npm run dev

Open http://localhost:3000 in your browser.

๐Ÿš€ Usage

Making a Request

  1. Select HTTP Method: Choose from GET, POST, PUT, DELETE, PATCH, HEAD, or OPTIONS
  2. Enter URL: Type or paste your API endpoint
  3. Add Headers (optional): Switch to Headers tab and add custom headers
  4. Add Body (optional): For POST/PUT/PATCH, switch to Body tab and enter JSON
  5. Click Send: Or press Ctrl+Enter to send the request

Example Requests

GET Request

Method: GET
URL: https://jsonplaceholder.typicode.com/posts/1

POST Request

Method: POST
URL: https://jsonplaceholder.typicode.com/posts
Headers:
  Content-Type: application/json
Body:
{
  "title": "Test Post",
  "body": "This is a test",
  "userId": 1
}

Request History

  • All requests are automatically saved to localStorage
  • Click any history item to restore that request
  • Maximum 10 requests are stored
  • Clear all history with the "Clear All" button

Keyboard Shortcuts

  • Ctrl+Enter / Cmd+Enter: Send request
  • Ctrl+K / Cmd+K: Focus URL input

๐ŸŽจ Project Structure

mini-postman/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ app/
โ”‚   โ”‚   โ”œโ”€โ”€ layout.tsx          # Root layout with fonts
โ”‚   โ”‚   โ”œโ”€โ”€ page.tsx            # Main application page
โ”‚   โ”‚   โ””โ”€โ”€ globals.css         # Global styles & theme
โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”œโ”€โ”€ ui/                 # shadcn/ui components
โ”‚   โ”‚   โ”œโ”€โ”€ BodyEditor.tsx      # JSON body editor with validation
โ”‚   โ”‚   โ”œโ”€โ”€ HeaderEditor.tsx    # Key-value header editor
โ”‚   โ”‚   โ”œโ”€โ”€ MethodSelector.tsx  # HTTP method dropdown
โ”‚   โ”‚   โ”œโ”€โ”€ RequestForm.tsx     # Tabbed request configuration
โ”‚   โ”‚   โ”œโ”€โ”€ RequestHistory.tsx  # Sidebar history panel
โ”‚   โ”‚   โ””โ”€โ”€ ResponseViewer.tsx  # Tabbed response display
โ”‚   โ”œโ”€โ”€ hooks/
โ”‚   โ”‚   โ””โ”€โ”€ useApiRequest.ts    # Custom hook for API logic
โ”‚   โ”œโ”€โ”€ lib/
โ”‚   โ”‚   โ”œโ”€โ”€ apiClient.ts        # Axios wrapper with error handling
โ”‚   โ”‚   โ””โ”€โ”€ utils.ts            # Utility functions (cn)
โ”‚   โ””โ”€โ”€ types/
โ”‚       โ””โ”€โ”€ index.ts            # TypeScript type definitions
โ”œโ”€โ”€ public/                     # Static assets
โ””โ”€โ”€ package.json

๐Ÿ”ง Configuration

Environment Variables

No environment variables required! The app runs entirely in the browser.

CORS Issues

No more CORS problems! ๐ŸŽ‰

This app uses a built-in server-side proxy that runs on Next.js API routes. All requests are proxied through your server, which means:

โœ… No CORS restrictions - Works with any API (localhost, Render, Vercel, etc.)
โœ… Test localhost APIs - Even from a deployed site
โœ… No external proxy needed - Everything runs on your own server
โœ… Secure - Your requests stay private

The proxy automatically:

  • Forwards your requests server-side
  • Handles all response types (JSON, text, etc.)
  • Preserves headers and status codes
  • Bypasses browser CORS policies

๐Ÿงช Testing APIs

Recommended Public APIs for Testing

  • JSONPlaceholder: https://jsonplaceholder.typicode.com
  • ReqRes: https://reqres.in/api
  • HTTPBin: https://httpbin.org
  • Dog API: https://dog.ceo/api
  • Cat Facts: https://catfact.ninja

๐ŸŽฏ Features in Detail

Error Handling

The app handles various error scenarios:

  • Invalid URL: Validates URL format before sending
  • Network Errors: Detects connection issues, timeouts, DNS failures
  • CORS Errors: Provides helpful messages and suggestions
  • Invalid JSON: Real-time validation in body editor
  • HTTP Errors: Displays status codes and error messages

Response Display

  • Body Tab: Formatted JSON with syntax highlighting and collapsible nodes
  • Headers Tab: Clean key-value display of response headers
  • Raw Tab: Plain text view of response body
  • Status Badge: Color-coded status (green for 2xx, red for errors)
  • Response Time: Millisecond-accurate timing

๐Ÿš€ Build & Deploy

# Build for production
npm run build

# Start production server
npm start

# Run linter
npm run lint

๐Ÿ“ License

MIT License - feel free to use this project for personal or commercial purposes.

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ› Known Issues

  • localStorage has a 5-10MB limit (sufficient for 10 requests)

๐Ÿ”ฎ Future Enhancements

  • Collections/Folders for organizing requests
  • Environment variables support
  • Request/Response export (JSON, cURL)
  • Authentication helpers (Bearer, Basic, API Key)
  • Query parameters editor
  • File upload support
  • WebSocket testing
  • GraphQL support
  • Dark/Light mode toggle
  • Request chaining

๐Ÿ“ง Support

For issues or questions, please open an issue on GitHub.


Built with โค๏ธ using Next.js 16 and React 19

About

A modern, lightweight API testing tool built with Next.js 16, React 19, and TypeScript. Inspired by Postman and Requestly, designed for developers who need a fast, clean interface for testing APIs.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages