kasin-it

Content negotiation for Next.js — serve Markdown to LLMs and HTML to browsers from the same URL.

17
0
100% credibility
Found Feb 28, 2026 at 14 stars -- GitGems finds repos before they trend. Get early access to the next one.
Sign Up Free
AI Analysis
TypeScript
AI Summary

A library for Next.js apps that serves HTML pages to web browsers and Markdown text to AI agents and crawlers from the same URLs based on request preferences.

How It Works

1
🌐 Create your website

You build a beautiful website with pages for products and blog posts that look perfect for human visitors.

2
🤖 AI wants plain text

AI assistants and crawlers need simple, clean text versions of your pages instead of fancy web layouts.

3
🧩 Add the smart tool

You easily include a helpful tool in your website project to handle different visitor needs.

4
📝 Describe text versions

You note down quick ways to generate plain text summaries for pages like products or blogs.

5
🔗 Set up text deliverer

You add a quiet background spot that provides the plain text when specifically requested.

6
⚙️ Turn on smart switching

With one simple adjustment, your site now detects and switches between views automatically.

7
🧪 Try it out

Open your page in a browser for the pretty view, or act like an AI to receive clean text – it switches seamlessly!

🎉 Works for everyone

Your website now happily serves beautiful pages to people and easy text to AI from the exact same addresses.

Sign up to see the full architecture

6 more

Sign Up Free

Star Growth

See how this repo grew from 14 to 17 stars Sign Up Free
Repurpose This Repo

Repurpose is a Pro feature

Generate ready-to-use prompts for X threads, LinkedIn posts, blog posts, YouTube scripts, and more -- with full repo context baked in.

Unlock Repurpose
AI-Generated Review

What is next-md-negotiate?

This TypeScript library adds HTTP content negotiation to Next.js apps, letting you serve Markdown to LLMs and crawlers while browsers get standard HTML—all from the same URL. Instead of juggling separate .md endpoints or Markdown-only pages that break human users, it checks the content negotiation header like Accept: text/markdown and responds accordingly. A prime content negotiation example for REST APIs in Next.js, it handles dynamic routes with params transparently.

Why is it gaining traction?

It eliminates route duplication by generating rewrites or middleware from a single route config, working seamlessly with App Router or Pages Router—no new URLs needed. Developers love the curl-testable setup: browsers hit your page normally, AI agents get clean Markdown via content negotiation header. Unlike manual hacks or frameworks like Spring or Ktor's content negotiation manager, it's zero-overhead and AI-optimized out of the box.

Who should use this?

Next.js full-stack devs building content sites, docs portals, or product APIs scraped by LLMs and bots. Ideal for teams serving github content api-style data where browsers need rich UIs but AI wants raw text—think blog posts, product pages, or versioned endpoints with content negotiation versioning. Skip if you're not on Next.js or lack AI traffic.

Verdict

Solid content negotiation http solution for small-to-medium Next.js projects; the demo app and init CLI make onboarding fast despite 14 stars and 1.0% credibility score signaling early maturity. Try it if LLMs are hitting your site—docs are crisp, but watch for edge cases in production.

(187 words)

Sign up to read the full AI review Sign Up Free

Similar repos coming soon.