<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Aakash Singh Rajput</title>
    <description>The latest articles on DEV Community by Aakash Singh Rajput (@aakash4dev).</description>
    <link>https://dev.to/aakash4dev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F827822%2F27ece558-3e3f-404b-8d56-ad50c3dd75d2.png</url>
      <title>DEV Community: Aakash Singh Rajput</title>
      <link>https://dev.to/aakash4dev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aakash4dev"/>
    <language>en</language>
    <item>
      <title>I built a prompt library where every prompt shows its result first</title>
      <dc:creator>Aakash Singh Rajput</dc:creator>
      <pubDate>Wed, 04 Nov 2026 20:29:53 +0000</pubDate>
      <link>https://dev.to/aakash4dev/i-built-a-prompt-library-where-every-prompt-shows-its-result-first-3gi8</link>
      <guid>https://dev.to/aakash4dev/i-built-a-prompt-library-where-every-prompt-shows-its-result-first-3gi8</guid>
      <description>&lt;p&gt;Every AI trend comes with a prompt. A sherwani portrait, 3D balloon letters, a pet dancing next to a car. The prompt usually travels as a cropped screenshot, tuned for a different model than the one you use. You paste it and get something nothing like the picture.&lt;/p&gt;

&lt;p&gt;Prompt libraries have the same problem in a tidier form: hundreds of prompts and no idea what any of them produce until you run them.&lt;/p&gt;

&lt;p&gt;So I built &lt;a href="https://www.aiprompts.page/?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=launch" rel="noopener noreferrer"&gt;aiprompts.page&lt;/a&gt; around one rule: &lt;strong&gt;show the result before the prompt.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What it does
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;100s of tested prompts for ChatGPT, Gemini, Claude, Midjourney, Veo, Kling and more, each shown with an example of what it produced&lt;/li&gt;
&lt;li&gt;Website and game prompts come with a live demo of the exact page the prompt generated&lt;/li&gt;
&lt;li&gt;Copying is free and needs no account&lt;/li&gt;
&lt;li&gt;PromptAI, an optional built-in chat, runs a prompt with your own photo or PDF and is paid with credits&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here's how the interesting parts work.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Live demos of AI-written HTML, without trusting it
&lt;/h2&gt;

&lt;p&gt;A website prompt's "result" is a full HTML page written by a model. I wanted visitors to click around it, not look at a screenshot. That's untrusted code on my own domain.&lt;/p&gt;

&lt;p&gt;Each demo is served from &lt;code&gt;/demo/&amp;lt;slug&amp;gt;&lt;/code&gt; with its own Content-Security-Policy header:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sandbox allow-scripts allow-pointer-lock allow-popups allow-popups-to-escape-sandbox
frame-ancestors 'self'
default-src 'none'
script-src 'unsafe-inline' 'unsafe-eval' https://cdn.jsdelivr.net https://unpkg.com https://cdnjs.cloudflare.com https://esm.sh
connect-src https://cdn.jsdelivr.net https://unpkg.com https://cdnjs.cloudflare.com https://esm.sh
form-action 'none'
base-uri 'none'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;sandbox&lt;/code&gt; directive in the header gives the page an opaque origin even when someone opens &lt;code&gt;/demo/...&lt;/code&gt; directly, so its scripts never see the site's cookies or storage. Inline scripts are allowed because the demos need them, but network access is limited to a few CDNs and forms can't post anywhere. The iframe on the prompt page carries a &lt;code&gt;sandbox&lt;/code&gt; attribute as well, for older browsers.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Static pages that still update right away
&lt;/h2&gt;

&lt;p&gt;Public pages (home, categories and every prompt) are statically generated with Next.js 16 and revalidated every 5 minutes. Every published prompt is prerendered at build time; prompts published later render on first visit and are then cached. Publishing, editing or deleting a prompt invalidates the catalog immediately, so new prompts show up at once without making every page dynamic.&lt;/p&gt;

&lt;p&gt;One safety rule: if Supabase is unreachable during a build, the build fails instead of publishing an empty site. On Vercel the previous deployment keeps serving.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Letting Postgres enforce the rules
&lt;/h2&gt;

&lt;p&gt;Anyone with an account can publish a prompt instantly, so the rules can't live only in the UI. They live in the database:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;every table has row-level security, and the &lt;code&gt;anon&lt;/code&gt; and &lt;code&gt;authenticated&lt;/code&gt; roles only get column-level grants, so users can't set &lt;code&gt;status&lt;/code&gt;, &lt;code&gt;featured&lt;/code&gt; or counters on their own posts&lt;/li&gt;
&lt;li&gt;a trigger caps current posts per account and serializes concurrent submissions, so the limit can't be raced with parallel requests&lt;/li&gt;
&lt;li&gt;uploads are checked by magic bytes (PNG, JPEG and WebP only), capped at 4 MB each and 50 MB per account&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A SQL test suite starts a throwaway Postgres container, applies every migration and checks these rules on every push.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Credits that never feel unfair
&lt;/h2&gt;

&lt;p&gt;PromptAI runs on credits, and the experience I most wanted to avoid was paying for a reply that never arrived. So each request reserves the most it could cost, then settles to what it actually used:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the unused part returns to your balance as soon as the reply finishes&lt;/li&gt;
&lt;li&gt;a failed reply refunds everything it reserved&lt;/li&gt;
&lt;li&gt;a reply that never completes refunds automatically after 10 minutes&lt;/li&gt;
&lt;li&gt;one generation runs at a time per account&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Payments go through Razorpay, and credits are granted only after the payment is verified on the server. Prices are chosen server-side from the visitor's country, in 8 currencies, so the browser never sends a price.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Small things that add up
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;First-party analytics stores a signed-in ID or a random per-tab ID, never an IP address, and respects Do Not Track&lt;/li&gt;
&lt;li&gt;First-time visitors get a 30-second guided tour of the buttons&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;npm run smoke&lt;/code&gt; checks a live deployment's canonical tags, sitemap, robots.txt and security headers, and doubles as a release gate&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Stack
&lt;/h2&gt;

&lt;p&gt;Next.js 16 (App Router, React 19, React Compiler) · Supabase (Postgres, Auth, Storage) · Tailwind CSS v4 · TypeScript · Zod · Vitest · Playwright · Razorpay · Vercel&lt;/p&gt;

&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;p&gt;More trend prompts every week and better search. If you try it, I'd love to know which prompt you'd want to see next.&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://www.aiprompts.page/?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=launch" rel="noopener noreferrer"&gt;aiprompts.page&lt;/a&gt;&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>nextjs</category>
      <category>supabase</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
