- Description
- Tech Stack
- Functionality
- Running Locally
- Public Analytics Setup
- Contribution Instructions
- Examples
Post Office is a browser-based developer tool that combines a JSON formatter and an HTTP API tester in one place. It is designed to be fast, keyboard-friendly, and dependency-light - no account required, no data sent to third-party servers.
- Next.js
- React
- TypeScript
- Tailwind
- Redis
- Paste raw JSON -> instant format with syntax highlighting
- Indent control
- Minify mode
- Sort keys toggle
- Strip empty fields toggle
- Parse error display with clear messaging
- JSON stats: key count, nesting depth, byte size
- One-click copy
- Keyboard shortcuts for minify/copy
- All HTTP methods
- Query params editor with live URL preview
- Custom headers
- Request body editor
- Auth: Bearer Token, Basic Auth, API Key
- Response view: formatted JSON body, headers, request info
- Response controls: copy, download, raw/pretty toggle
- Response time + size metrics
- Quick-load presets
- Request timeout control (direct + proxy)
- cURL import and cURL export
- Recent request history (session)
- Saved requests collections (local)
- Keyboard shortcut to send request
Prerequisites: Node.js 18+
# Install dependencies
npm install
# Start the development server
npm run devOpen http://localhost:3000 in your browser.
Other available commands:
| Command | Description |
|---|---|
npm run build |
Production build |
npm run start |
Start the production server |
npm run lint |
Run ESLint |
npm run typecheck |
Run TypeScript type checks |
npm test |
Run tests |
This project supports persistent public counters on the homepage:
- Total JSON payloads formatted
- Total API endpoints tested
- Total site visits
npm install @upstash/redis @vercel/analytics @upstash/ratelimit --legacy-peer-depsCreate/update .env.local:
UPSTASH_REDIS_REST_URL="https://<your-db>.upstash.io"
UPSTASH_REDIS_REST_TOKEN="<your-upstash-token>"
# Optional: set to false to disable API route rate limiting
UPSTASH_RATE_LIMIT_ENABLED="true"Required in Vercel Project Settings as well:
UPSTASH_REDIS_REST_URLUPSTASH_REDIS_REST_TOKENUPSTASH_RATE_LIMIT_ENABLED(optional)
The counters use namespaced keys:
stats:json_formatsstats:api_testsstats:site_visits
- JSON formatter success posts to
POST /api/track/json-format - API tester sends posts to
POST /api/track/api-test - Site visit tracking posts once per browser session to
POST /api/track/visit - Homepage stats load from
GET /api/stats
@vercel/analytics is mounted in the root layout, so page traffic and usage analytics are available in Vercel.
- Upstash Redis stores counters, so values persist across redeploys.
- Route handlers run in
nodejsruntime and use async/await with error-safe JSON responses. @upstash/ratelimitprotects track endpoints from inflated request spam.- Visit tracking is session-scoped client-side (best-effort) and reinforced by server-side rate limits.
- Stats endpoint returns
Cache-Control: no-storefor fresh values.
- Fork the repository and create a feature branch from
main. - Install dependencies with
npm install. - Make your changes and ensure all checks pass:
npm run lint npm run typecheck npm test - Open a pull request against
mainwith a clear description of what was changed and why.
Please keep pull requests focused - one feature or fix per PR.
- Validate and format API payload
Paste:
{"user":{"id":42,"name":"Aidan"},"active":true,"tags":["dev","qa"]}Set indent to 2 spaces and get readable output with syntax highlighting and stats.
- Normalize object structure before sharing
Paste JSON with mixed key order, then enable:
Sort keysStrip empty
This is useful for clean diffs in PRs and consistent snapshots in tests.
- Compact large JSON for transport
Use Minify to convert pretty JSON into a compact one-line payload for query params, logs, or lightweight storage.
- Keyboard-driven workflow
Ctrl/Cmd + Shift + M: toggle minifyCtrl/Cmd + Shift + C: copy output
- Quick GET request with query params
- Method:
GET - URL:
https://jsonplaceholder.typicode.com/posts - Params:
userId = 1
Review formatted response body, headers, status, response time, and size.
- Authenticated POST JSON request
- Method:
POST - URL:
https://httpbin.org/post - Headers:
X-Trace-Id: demo-001 - Auth:
Bearer Token - Body Content-Type:
application/json - Body:
{
"title": "Post Office Demo",
"priority": "high"
}- Use proxy mode for CORS-blocked endpoints
Enable Use server proxy when direct browser requests fail due to CORS. The proxy keeps localhost/private-network safeguards in place.
- cURL import/export
Import:
curl -X POST -H "Content-Type: application/json" --data-raw '{"name":"demo"}' https://httpbin.org/postThen use Copy cURL to export the current request state back to terminal-friendly format.
- Timeout tuning for unstable endpoints
Set Timeout (ms) (for example 10000) before sending. Useful for quickly identifying slow or non-responsive APIs.
- Reuse requests with history and collections
Recent history: reload recently sent requests (session-scoped)Save request as...: persist named requests in local collections
This makes repeated debugging and regression checks much faster.
- Response tools
Copy bodyDownloadPretty/Rawtoggle for JSON responses
Great for sharing payloads in tickets, reproducing issues, and comparing response shapes.
- Keyboard shortcut to send
Ctrl/Cmd + Enter: send request