Skip to content

Latest commit

Β 

History

239 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

DevToolsHub logo

DevToolsHub

Free, fast, and developer-friendly online tools β€” no installation required.

Website Next.js MongoDB License


✨ Tools

Tool URL Description
πŸ”§ JSON Formatter /json-format-vertical Validate & pretty-print JSON with syntax highlighting
πŸ”„ XML ↔ JSON /xml-to-json-vertical Convert between XML and JSON instantly
πŸ”‘ JWT Decoder /jwt-decode Inspect JWT header, payload, and signature
πŸ”’ Base64 /base64 Encode and decode Base64 strings
πŸ–ΌοΈ Image ↔ Base64 /image-to-base64 Convert images to Base64 (or render Base64 back), with full image info & EXIF
πŸ“‘ Morse Code /morse-code-decoder Translate text ↔ Morse code with audio playback
πŸ“± QR Code /qr-code-generator Create custom QR codes with logo & color support
🌐 HTML Render /html-render Live HTML/CSS/JS preview with resizable split pane
πŸ“¬ Temp Mail /temp-mail Disposable inbox that self-destructs β€” no signup

πŸ› οΈ Tech Stack

Layer Technology
Framework Next.js 15 β€” Pages Router
Language TypeScript
Styling Tailwind CSS + daisyUI
Animation Framer Motion
Auth NextAuth.js (Google OAuth)
Database MongoDB via Mongoose
Icons Heroicons
Alerts SweetAlert2
State Recoil
Deployment Vercel

πŸš€ Getting Started

Prerequisites

  • Node.js β‰₯ 18
  • MongoDB Atlas cluster (or local instance)
  • Google OAuth credentials β€” create here

Installation

# 1. Clone the repository
git clone https://github.com/Mark-Notify/devtoolshub.git
cd devtoolshub

# 2. Install dependencies
npm install       # or: yarn install

# 3. Configure environment variables
cp .env.example .env.local
# β†’ Fill in MONGODB_URI, NEXTAUTH_SECRET, GOOGLE_CLIENT_ID, etc.

# 4. Start the dev server
npm run dev       # or: yarn dev

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

Build for Production

npm run build     # runs: next build
npm run start

🌐 API Reference

All routes live under /api/.

πŸ” Health Check

Method Endpoint Auth Description
GET /api/health β€” Check server & MongoDB connection status

200 Response:

{ "status": "ok", "db": "connected", "timestamp": "2024-01-01T00:00:00.000Z" }

503 Response (DB unreachable):

{ "status": "error", "db": "disconnected", "message": "Database connection failed" }

πŸ“œ History

History is strictly per-user β€” users only see their own records. A public share link can be generated for individual entries.

Method Endpoint Auth Description
GET /api/get-data βœ… Session List the current user's history (newest first)
POST /api/save-data βœ… Session Save a new history entry
PATCH /api/get-data βœ… Session Generate a public share link for one entry
GET /api/history/share/[id] β€” Public View a single entry via its shareId
GET /api/history/cleanup πŸ” CRON_SECRET Delete all entries older than 1 month

Generate a share link

Request:

PATCH /api/get-data
Content-Type: application/json

{ "id": "<MongoDB _id>" }

Response:

{ "shareId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" }

Share URL: https://www.devtoolshub.org/api/history/share/<shareId>

The share endpoint returns only tool, inputData, outputData, and createdAt β€” userEmail is never exposed.


⭐ Favorites

Method Endpoint Auth Description
GET /api/favorites βœ… Session List favorited tools
POST /api/favorites βœ… Session Add a tool to favorites
DELETE /api/favorites βœ… Session Remove a tool from favorites

πŸ’Ύ Snippets

Method Endpoint Auth Description
GET /api/snippets βœ… Session List saved snippets
POST /api/snippets βœ… Session Create a snippet
PUT /api/snippets βœ… Session Update a snippet
DELETE /api/snippets βœ… Session Delete a snippet

βš™οΈ Environment Variables

Copy .env.example to .env.local and fill in the values:

# MongoDB
MONGODB_URI=mongodb+srv://<user>:<password>@cluster.mongodb.net/devtoolshub

# NextAuth.js
NEXTAUTH_SECRET=<random 32-byte base64>
NEXTAUTH_URL=http://localhost:3000

# Google OAuth
GOOGLE_CLIENT_ID=<your-client-id>.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=<your-client-secret>

# Cron job secret (protects /api/history/cleanup)
CRON_SECRET=<random 32-byte base64>

# Temp Mail β€” comma separated; the first one is the default for Free users
TEMP_MAIL_DOMAINS=mail.example.com,inbox.example.com

# Shared secret between the Cloudflare Email Worker and /api/temp-mail/inbound
TEMP_MAIL_INBOUND_SECRET=<random 32-byte base64>

Generate a secret:

openssl rand -base64 32

πŸ• Cron Jobs

vercel.json configures Vercel Cron to call /api/history/cleanup on the 1st of every month at 02:00 UTC.

The endpoint requires:

Authorization: Bearer <CRON_SECRET>

πŸ“¬ Temp Mail

Disposable inboxes at /temp-mail. Vercel cannot run an SMTP server, so mail is accepted by Cloudflare Email Routing and pushed into the app as JSON.

Next.js UI ──► /api/temp-mail/* ──► MongoDB (mailboxes + messages, TTL indexes)
                     β–²
                     β”‚ POST /api/temp-mail/inbound  (x-tempmail-secret)
                     β”‚
        Cloudflare Email Worker ◄── Cloudflare MX ◄── Internet Mail

Mailbox and message documents carry an expiresAt TTL index, so MongoDB deletes them on its own β€” no Redis or queue worker to run.

Free Pro
Lifetime 10 minutes 24 hours
Mailboxes 1 5
Read mail βœ… βœ…
Attachments ❌ βœ… (1 MB/file, 4 MB/mail)
Custom prefix + domain ❌ βœ…

Pro has no payment flow yet. It is granted by an allow-list in MongoDB β€” sign in with Google, and Pro applies if that email is in the prowhitelists collection:

db.prowhitelists.insertOne({ email: "someone@gmail.com", active: true, createdAt: new Date() })

Setting up the mail path is documented in workers/temp-mail-inbound/README.md.


πŸ“ Project Structure

devtoolshub/
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ HtmlEditor/          # Live HTML/CSS/JS preview (split-pane)
β”‚   β”œβ”€β”€ JsonFormat/          # JSON formatter & XML converter
β”‚   β”œβ”€β”€ Jwt/                 # JWT decoder
β”‚   β”œβ”€β”€ Layout/              # Header + responsive sidebar
β”‚   β”œβ”€β”€ QRCode/              # QR code generator
β”‚   └── ...
β”œβ”€β”€ models/                  # Mongoose schemas
β”‚   β”œβ”€β”€ UserData.ts          # History entries (with optional shareId)
β”‚   β”œβ”€β”€ Favorite.ts
β”‚   β”œβ”€β”€ SavedSnippet.ts
β”‚   └── UserPreferences.ts
β”œβ”€β”€ lib/
β”‚   └── mongodb.ts           # Singleton MongoDB connection helper
β”œβ”€β”€ pages/
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”œβ”€β”€ health.ts        # GET  β€” DB health check
β”‚   β”‚   β”œβ”€β”€ get-data.tsx     # GET/PATCH β€” user history + share link
β”‚   β”‚   β”œβ”€β”€ save-data.tsx    # POST β€” save history entry
β”‚   β”‚   β”œβ”€β”€ history/
β”‚   β”‚   β”‚   β”œβ”€β”€ cleanup.ts   # GET  β€” cron: delete entries >1 month
β”‚   β”‚   β”‚   └── share/
β”‚   β”‚   β”‚       └── [id].ts  # GET  β€” public share endpoint
β”‚   β”‚   β”œβ”€β”€ favorites.ts
β”‚   β”‚   β”œβ”€β”€ snippets.ts
β”‚   β”‚   └── auth/
β”‚   β”œβ”€β”€ [slug].tsx           # Dynamic tool pages
β”‚   └── index.tsx
β”œβ”€β”€ public/                  # Static assets & logo
β”œβ”€β”€ vercel.json              # Cron job configuration
└── .env.example             # Environment variable template

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feat/my-feature
  3. Commit your changes: git commit -m "feat: add my feature"
  4. Push and open a Pull Request

πŸ“ License

MIT Β© DevToolsHub

Releases

Packages

Used by

Contributors

Languages