🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.
Add post generation tools and enhance related tools section
Bill Yangb25300377a2c
diff --git a/docs/src/app/(home)/tools/(font-generators)/[slug]/page.tsx b/docs/src/app/(home)/tools/(font-generators)/[slug]/page.tsxindex 5a3d49b52..c1247c78f 100644--- a/docs/src/app/(home)/tools/(font-generators)/[slug]/page.tsx+++ b/docs/src/app/(home)/tools/(font-generators)/[slug]/page.tsx@@ -2,6 +2,7 @@ import { ToolPageLayout } from "../../components/ToolPageLayout";import { FontGeneratorTool } from "../../components/FontGeneratorTool";import AICommentForm from "../../components/AICommentForm";import PageNameGenerator from "../../components/PageNameGenerator";+import PostGenerator from "../../components/PostGenerator";import { platformConfigs, platformList } from "../../components/platform-configs";import {commentPlatformConfigs,@@ -11,6 +12,10 @@ import {pageNamePlatformConfigs,pageNamePlatformList,} from "../../components/page-name-platform-configs";+import {+ postGeneratorPlatformConfigs,+ postGeneratorPlatformList,+} from "../../components/post-generator-platform-configs";import type { Metadata } from "next";import { notFound } from "next/navigation";@@ -34,7 +39,16 @@ export async function generateStaticParams() {slug: `${platform.id}-page-name-generator`,}));- return [...fontGenerators, ...commentGenerators, ...pageNameGenerators];+ const postGenerators = postGeneratorPlatformList.map((platform) => ({+ slug: `${platform.id}-post-generator`,+ }));++ return [+ ...fontGenerators,+ ...commentGenerators,+ ...pageNameGenerators,+ ...postGenerators,+ ];}// Generate metadata dynamically based on slug@@ -43,6 +57,36 @@ export async function generateMetadata({}: PageProps): Promise<Metadata> {const { slug } = await params;+ // Check if it's a post generator+ if (slug.endsWith("-post-generator")) {+ const platformId = slug.replace("-post-generator", "");+ const platform = postGeneratorPlatformConfigs[platformId];++ if (!platform) {+ return { title: "Post Generator Not Found" };+ }++ return {+ title: `${platform.displayName} | AI-Powered ${platform.name} Posts`,+ description: platform.description,+ openGraph: {+ title: platform.displayName,+ description: platform.description,+ type: "website",+ url: `https://rybbit.com/tools/${platform.id}-post-generator`,+ siteName: "Rybbit Documentation",+ },+ twitter: {+ card: "summary_large_image",+ title: platform.displayName,+ description: platform.description,+ },+ alternates: {+ canonical: `https://rybbit.com/tools/${platform.id}-post-generator`,+ },+ };+ }+// Check if it's a page name generatorif (slug.endsWith("-page-name-generator")) {const platformId = slug.replace("-page-name-generator", "");@@ -137,6 +181,175 @@ export async function generateMetadata({export default async function PlatformToolPage({ params }: PageProps) {const { slug } = await params;+ // Check if it's a post generator+ if (slug.endsWith("-post-generator")) {+ const platformId = slug.replace("-post-generator", "");+ const platform = postGeneratorPlatformConfigs[platformId];++ // Handle invalid platform+ if (!platform) {+ notFound();+ }++ const structuredData = {+ "@context": "https://schema.org",+ "@type": "WebApplication",+ name: platform.displayName,+ description: platform.description,+ url: `https://rybbit.com/tools/${platform.id}-post-generator`,+ applicationCategory: "Utility",+ offers: {+ "@type": "Offer",+ price: "0",+ priceCurrency: "USD",+ },+ author: {+ "@type": "Organization",+ name: "Rybbit",+ url: "https://rybbit.com",+ },+ };++ const educationalContent = (+ <>+ <h2 className="text-2xl font-bold text-neutral-900 dark:text-white mb-4">+ About {platform.name} Posts+ </h2>+ <p className="text-neutral-700 dark:text-neutral-300 leading-relaxed mb-6">+ {platform.educationalContent}+ </p>++ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">+ How to Use This Tool+ </h3>+ <ol className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Describe your topic</strong> - What do you want to post+ about?+ </li>+ <li>+ <strong>Select a style</strong> - Choose from{" "}+ {platform.recommendedStyles.length} platform-optimized styles+ </li>+ <li>+ <strong>Add context (optional)</strong> - Include specific details,+ CTAs, or hashtags+ </li>+ <li>+ <strong>Click "Generate Posts"</strong> to get 3 unique variations+ </li>+ <li>+ <strong>Copy and customize</strong> your favorite post before+ publishing+ </li>+ </ol>++ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">+ Available Post Styles+ </h3>+ <ul className="grid grid-cols-2 gap-2 text-sm text-neutral-700 dark:text-neutral-300 mb-6">+ {platform.recommendedStyles.map((style) => (+ <li key={style} className="flex items-center gap-2">+ <span className="w-1.5 h-1.5 rounded-full bg-emerald-500" />+ {style}+ </li>+ ))}+ </ul>++ <h3 className="text-xl font-semibold text-neutral-900 dark:text-white mb-3">+ Best Practices for {platform.name}+ </h3>+ <ul className="space-y-2 text-neutral-700 dark:text-neutral-300 mb-6">+ <li>+ <strong>Be authentic:</strong> Personalize AI-generated content to+ match your voice+ </li>+ <li>+ <strong>Add value:</strong> Ensure your post provides insights,+ entertainment, or useful information+ </li>+ <li>+ <strong>Engage your audience:</strong> Include questions or CTAs to+ encourage interaction+ </li>+ <li>+ <strong>Optimize timing:</strong> Post when your audience is most+ active+ </li>+ <li>+ <strong>Review before posting:</strong> Always edit and customize+ generated content+ </li>+ </ul>++ <p className="text-sm text-neutral-600 dark:text-neutral-400 mt-6">+ <strong>Note:</strong> While this tool generates high-quality posts,+ always review and personalize content before publishing. Authentic+ engagement comes from adding your unique perspective and voice.+ </p>+ </>+ );++ const faqs = [+ {+ question: `How does the ${platform.name} post generator work?`,+ answer: `This tool uses AI to create platform-optimized posts based on your topic and chosen style. It considers ${platform.name}'s best practices, character limits, and engagement patterns to generate content that resonates with your audience.`,+ },+ {+ question: "What post styles are available?",+ answer: `You can choose from ${platform.recommendedStyles.length} styles: ${platform.recommendedStyles.join(", ")}. Each style is optimized for ${platform.name} and designed to maximize engagement for different types of content.`,+ },+ {+ question: "Should I edit the generated posts?",+ answer:+ "Yes! Generated posts are starting points. Always personalize them with your unique voice, specific details, and brand personality. The best posts combine AI efficiency with human authenticity.",+ },+ {+ question: "How many posts can I generate?",+ answer:+ "The tool generates 3 unique post variations per request. You're limited to 5 requests per minute. If you need more variations, try adjusting your topic or style.",+ },+ {+ question: "Will the posts sound natural?",+ answer: `Yes! The AI is trained to create authentic, engaging content that matches ${platform.name}'s tone and style. However, adding your personal touch makes posts even more effective and genuine.`,+ },+ {+ question: "How can Rybbit help me measure post performance?",+ answer: (+ <>+ Rybbit tracks clicks, engagement, and traffic from your{" "}+ {platform.name} posts. See which content drives the most interaction+ and optimize your social media strategy.{" "}+ <a+ href="https://rybbit.com"+ className="text-emerald-600 hover:text-emerald-500 underline"+ >+ Start tracking for free+ </a>+ .+ </>+ ),+ },+ ];++ return (+ <ToolPageLayout+ toolSlug={`${platform.id}-post-generator`}+ title={platform.displayName}+ description={platform.description}+ badge="AI-Powered Tool"+ toolComponent={<PostGenerator platform={platform} />}+ educationalContent={educationalContent}+ faqs={faqs}+ relatedToolsCategory="social-media"+ ctaTitle={`Optimize your ${platform.name} strategy with Rybbit`}+ ctaDescription="Track which posts drive the most engagement and refine your content strategy with data-driven insights."+ ctaEventLocation={`${platform.id}_post_generator_cta`}+ structuredData={structuredData}+ />+ );+ }+// Check if it's a page name generatorif (slug.endsWith("-page-name-generator")) {const platformId = slug.replace("-page-name-generator", "");diff --git a/docs/src/app/(home)/tools/components/PostGenerator.tsx b/docs/src/app/(home)/tools/components/PostGenerator.tsxnew file mode 100644index 000000000..078942698--- /dev/null+++ b/docs/src/app/(home)/tools/components/PostGenerator.tsx@@ -0,0 +1,212 @@+"use client";++import { CheckCircle, Copy, Loader2 } from "lucide-react";+import { useState } from "react";+import type { PostGeneratorPlatformConfig } from "./post-generator-platform-configs";++interface PostGeneratorProps {+ platform: PostGeneratorPlatformConfig;+}++export default function PostGenerator({ platform }: PostGeneratorProps) {+ const [topic, setTopic] = useState("");+ const [style, setStyle] = useState(platform.recommendedStyles[0]);+ const [additionalContext, setAdditionalContext] = useState("");+ const [posts, setPosts] = useState<string[]>([]);+ const [isLoading, setIsLoading] = useState(false);+ const [error, setError] = useState("");+ const [copiedIndex, setCopiedIndex] = useState<number | null>(null);+ const [remainingRequests, setRemainingRequests] = useState<number | null>(+ null+ );++ const generatePosts = async () => {+ if (!topic.trim()) {+ setError("Please describe what you want to post about");+ return;+ }++ setIsLoading(true);+ setError("");+ setPosts([]);++ try {+ const response = await fetch("/api/tools/generate-post", {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ },+ body: JSON.stringify({+ topic: topic.trim(),+ style,+ additionalContext: additionalContext.trim(),+ platform: platform.id,+ characterLimit: platform.characterLimit,+ }),+ });++ const remaining = response.headers.get("X-RateLimit-Remaining");+ if (remaining) {+ setRemainingRequests(parseInt(remaining));+ }++ if (!response.ok) {+ const data = await response.json();+ throw new Error(data.error || "Failed to generate posts");+ }++ const data = await response.json();+ setPosts(data.posts);+ } catch (err) {+ setError(err instanceof Error ? err.message : "An error occurred");+ } finally {+ setIsLoading(false);+ }+ };++ const copyToClipboard = async (text: string, index: number) => {+ try {+ await navigator.clipboard.writeText(text);+ setCopiedIndex(index);+ setTimeout(() => setCopiedIndex(null), 2000);+ } catch (err) {+ console.error("Failed to copy:", err);+ }+ };++ return (+ <div className="space-y-6">+ <div>+ <label+ htmlFor="topic"+ className="block text-sm font-medium text-neutral-700 dark:text-neutral-300 mb-2"+ >+ What do you want to post about?+ </label>+ <textarea+ id="topic"+ rows={4}+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500 resize-y"+ placeholder={`Describe your post topic or key message (e.g., "Sharing lessons learned from building a startup" or "Tips for productivity")`}+ value={topic}+ onChange={(e) => setTopic(e.target.value)}+ maxLength={1000}+ />+ <p className="mt-1 text-xs text-neutral-500 dark:text-neutral-400">+ {topic.length} / 1000 characters+ </p>+ </div>++ <div>+ <label+ htmlFor="style"+ className="block text-sm font-medium text-neutral-700 dark:text-neutral-300 mb-2"+ >+ Post Style+ </label>+ <select+ id="style"+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-emerald-500"+ value={style}+ onChange={(e) => setStyle(e.target.value)}+ >+ {platform.recommendedStyles.map((styleOption) => (+ <option key={styleOption} value={styleOption}>+ {styleOption}+ </option>+ ))}+ </select>+ <p className="mt-1 text-xs text-neutral-500 dark:text-neutral-400">+ Choose a style that fits your content and audience+ </p>+ </div>++ <div>+ <label+ htmlFor="additionalContext"+ className="block text-sm font-medium text-neutral-700 dark:text-neutral-300 mb-2"+ >+ Additional Context (Optional)+ </label>+ <textarea+ id="additionalContext"+ rows={2}+ className="w-full px-4 py-3 bg-white dark:bg-neutral-800 border border-neutral-300 dark:border-neutral-700 rounded-lg text-neutral-900 dark:text-white placeholder-neutral-400 focus:outline-none focus:ring-2 focus:ring-emerald-500 resize-y"+ placeholder="Any specific details, CTAs, or hashtags you want to include"+ value={additionalContext}+ onChange={(e) => setAdditionalContext(e.target.value)}+ maxLength={500}+ />+ </div>++ <button+ onClick={generatePosts}+ disabled={isLoading || !topic.trim()}+ className="w-full px-6 py-3 bg-emerald-600 hover:bg-emerald-500 disabled:bg-neutral-400 dark:disabled:bg-neutral-700 text-white font-medium rounded-lg transition-colors flex items-center justify-center gap-2"+ >+ {isLoading ? (+ <>+ <Loader2 className="w-5 h-5 animate-spin" />+ Generating Posts...+ </>+ ) : (+ "Generate Posts"+ )}+ </button>++ {remainingRequests !== null && (+ <p className="text-sm text-center text-neutral-600 dark:text-neutral-400">+ {remainingRequests} requests remaining this minute+ </p>+ )}++ {error && (+ <div className="p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg">+ <p className="text-sm text-red-800 dark:text-red-200">{error}</p>+ </div>+ )}++ {posts.length > 0 && (+ <div className="space-y-4">+ <h3 className="text-lg font-semibold text-neutral-900 dark:text-white">+ Generated Posts+ </h3>+ {posts.map((post, index) => (+ <div+ key={index}+ className="p-4 bg-white dark:bg-neutral-800 border border-neutral-200 dark:border-neutral-700 rounded-lg"+ >+ <div className="flex items-start justify-between gap-3 mb-3">+ <p className="flex-1 text-neutral-900 dark:text-white whitespace-pre-wrap leading-relaxed">+ {post}+ </p>+ <button+ onClick={() => copyToClipboard(post, index)}+ className="flex-shrink-0 p-2 hover:bg-neutral-100 dark:hover:bg-neutral-700 rounded-lg transition-colors"+ title="Copy to clipboard"+ >+ {copiedIndex === index ? (+ <CheckCircle className="w-5 h-5 text-emerald-600" />+ ) : (+ <Copy className="w-5 h-5 text-neutral-600 dark:text-neutral-400" />+ )}+ </button>+ </div>+ <p className="text-xs text-neutral-500 dark:text-neutral-400">+ {post.length} characters+ {platform.characterLimit &&+ ` / ${platform.characterLimit} limit`}+ </p>+ </div>+ ))}+ </div>+ )}++ <div className="p-4 bg-neutral-50 dark:bg-neutral-800/50 border border-neutral-200 dark:border-neutral-700 rounded-lg">+ <p className="text-sm text-neutral-700 dark:text-neutral-300">+ <strong>Platform Guidelines:</strong> {platform.contextGuidelines}+ </p>+ </div>+ </div>+ );+}diff --git a/docs/src/app/(home)/tools/components/post-generator-platform-configs.ts b/docs/src/app/(home)/tools/components/post-generator-platform-configs.tsnew file mode 100644index 000000000..8ec2f0303--- /dev/null+++ b/docs/src/app/(home)/tools/components/post-generator-platform-configs.ts@@ -0,0 +1,286 @@+export interface PostGeneratorPlatformConfig {+ id: string;+ name: string;+ displayName: string;+ description: string;+ simpleIconSlug: string;+ colorHex: string;+ characterLimit?: number;+ educationalContent: string;+ contextGuidelines: string;+ recommendedStyles: string[];+}++export const postGeneratorPlatformConfigs: Record<+ string,+ PostGeneratorPlatformConfig+> = {+ linkedin: {+ id: "linkedin",+ name: "LinkedIn",+ displayName: "LinkedIn Post Generator",+ description:+ "Generate professional LinkedIn posts with AI. Create engaging content that builds your professional brand and drives engagement.",+ simpleIconSlug: "linkedin",+ colorHex: "#0A66C2",+ characterLimit: 3000,+ contextGuidelines:+ "LinkedIn posts should be professional, insightful, and value-driven. Focus on career insights, industry trends, and thought leadership.",+ educationalContent: `LinkedIn is a professional networking platform where quality content builds your personal brand and attracts opportunities. Posts that share insights, lessons learned, and valuable perspectives perform best.++Effective LinkedIn posts are authentic, provide value, and encourage professional discussion. They often include personal stories, data-driven insights, or actionable advice. The best posts strike a balance between professional and personable.`,+ recommendedStyles: [+ "Professional Insight",+ "Thought Leadership",+ "Personal Story",+ "Industry Analysis",+ "Career Advice",+ "How-To Guide",+ "Question/Discussion",+ ],+ },+ x: {+ id: "x",+ name: "X (Twitter)",+ displayName: "X (Twitter) Post Generator",+ description:+ "Generate engaging X (Twitter) posts with AI. Create concise, impactful tweets that capture attention and drive engagement.",+ simpleIconSlug: "x",+ colorHex: "#000000",+ characterLimit: 280,+ contextGuidelines:+ "X/Twitter posts must be concise and impactful. Every word counts. Focus on hooks, clarity, and engagement.",+ educationalContent: `X (Twitter) is a fast-paced platform where brevity and impact are essential. The 280-character limit means every word must earn its place. Great posts capture attention immediately and encourage interaction.++Effective X posts are concise, clear, and compelling. They often use strong hooks, pose questions, or share surprising insights. The best posts are easily quotable and retweetable.`,+ recommendedStyles: [+ "Hot Take",+ "Question",+ "Thread Starter",+ "Quick Tip",+ "Observation",+ "Announcement",+ "Humorous",+ ],+ },+ facebook: {+ id: "facebook",+ name: "Facebook",+ displayName: "Facebook Post Generator",+ description:+ "Generate engaging Facebook posts with AI. Create content that resonates with your community and drives meaningful engagement.",+ simpleIconSlug: "facebook",+ colorHex: "#1877F2",+ characterLimit: 63206,+ contextGuidelines:+ "Facebook posts should be conversational and community-focused. They work well for storytelling, updates, and building relationships.",+ educationalContent: `Facebook is ideal for building community through longer-form, conversational content. Posts can tell stories, share updates, or spark discussions. Visual content and authentic voice perform well.++Effective Facebook posts are warm, genuine, and encourage interaction. They often ask questions, share personal experiences, or provide value to the community. The best posts feel like a conversation with friends.`,+ recommendedStyles: [+ "Conversational",+ "Storytelling",+ "Question",+ "Update/Announcement",+ "Educational",+ "Inspirational",+ "Behind-the-Scenes",+ ],+ },+ instagram: {+ id: "instagram",+ name: "Instagram",+ displayName: "Instagram Caption Generator",+ description:+ "Generate creative Instagram captions with AI. Create engaging captions that complement your visuals and boost engagement.",+ simpleIconSlug: "instagram",+ colorHex: "#E4405F",+ characterLimit: 2200,+ contextGuidelines:+ "Instagram captions should complement visuals and encourage engagement. They can be short and punchy or longer and storytelling-focused.",+ educationalContent: `Instagram is a visual platform where captions enhance your images and videos. Captions can range from brief and witty to longer storytelling. The first line is crucial for grabbing attention.++Effective Instagram captions are authentic, engaging, and often include a call-to-action. They might tell a story, share insights, or ask questions. The best captions encourage saves, shares, and comments.`,+ recommendedStyles: [+ "Storytelling",+ "Motivational",+ "Witty/Humorous",+ "Educational",+ "Behind-the-Scenes",+ "Question/Engagement",+ "Minimalist",+ ],+ },+ threads: {+ id: "threads",+ name: "Threads",+ displayName: "Threads Post Generator",+ description:+ "Generate engaging Threads posts with AI. Create conversational content that sparks discussion on Meta's text platform.",+ simpleIconSlug: "threads",+ colorHex: "#000000",+ characterLimit: 500,+ contextGuidelines:+ "Threads posts should be conversational and encourage dialogue. They work well for thoughts, questions, and timely commentary.",+ educationalContent: `Threads by Meta is designed for text-based conversations and real-time engagement. Posts are more casual than LinkedIn but more substantial than Twitter. The platform encourages back-and-forth dialogue.++Effective Threads posts are conversational, timely, and invite responses. They often share perspectives, ask questions, or comment on trending topics. The best posts feel like the start of a conversation.`,+ recommendedStyles: [+ "Conversational",+ "Hot Take",+ "Question",+ "Commentary",+ "Personal Reflection",+ "Observation",+ "Debate Starter",+ ],+ },+ reddit: {+ id: "reddit",+ name: "Reddit",+ displayName: "Reddit Post Generator",+ description:+ "Generate authentic Reddit posts with AI. Create valuable content that contributes to subreddit discussions and communities.",+ simpleIconSlug: "reddit",+ colorHex: "#FF4500",+ characterLimit: 40000,+ contextGuidelines:+ "Reddit posts should provide genuine value and respect community rules. Avoid self-promotion and focus on authentic contribution.",+ educationalContent: `Reddit values authentic, valuable content that contributes to community discussions. Each subreddit has its own culture and rules. Posts should respect these norms and provide real value to the community.++Effective Reddit posts are detailed, helpful, and genuine. They might ask thoughtful questions, share unique experiences, or provide in-depth information. The best posts spark meaningful discussion and earn upvotes through quality.`,+ recommendedStyles: [+ "Question/Discussion",+ "Story/Experience",+ "Educational/Guide",+ "Analysis",+ "Recommendation Request",+ "Community Discussion",+ "Informative",+ ],+ },+ tiktok: {+ id: "tiktok",+ name: "TikTok",+ displayName: "TikTok Caption Generator",+ description:+ "Generate trendy TikTok captions with AI. Create catchy captions that boost your video's reach and engagement.",+ simpleIconSlug: "tiktok",+ colorHex: "#000000",+ characterLimit: 2200,+ contextGuidelines:+ "TikTok captions should be short, catchy, and trend-aware. They often include hooks, hashtags, and calls-to-action.",+ educationalContent: `TikTok captions complement your video content and help with discoverability. Short, catchy captions with relevant hashtags perform well. The first line should hook viewers scrolling through their feed.++Effective TikTok captions are brief, engaging, and use trending sounds or hashtags strategically. They might pose questions, create curiosity, or add context to the video. The best captions encourage engagement without overshadowing the video.`,+ recommendedStyles: [+ "Hook/Teaser",+ "Trendy",+ "Humorous",+ "Relatable",+ "Story Setup",+ "Challenge/CTA",+ "Educational Hook",+ ],+ },+ youtube: {+ id: "youtube",+ name: "YouTube",+ displayName: "YouTube Description Generator",+ description:+ "Generate optimized YouTube descriptions with AI. Create descriptions that improve SEO and encourage viewers to engage.",+ simpleIconSlug: "youtube",+ colorHex: "#FF0000",+ characterLimit: 5000,+ contextGuidelines:+ "YouTube descriptions should be SEO-optimized with keywords, timestamps, and clear CTAs. The first 2-3 lines are most important.",+ educationalContent: `YouTube descriptions help viewers understand your video and improve search rankings. The first 2-3 lines appear before "Show more" and should capture the video's value. Include keywords, timestamps, and links strategically.++Effective YouTube descriptions are informative, keyword-rich, and include clear calls-to-action. They provide context, list key points, and guide viewers to subscribe or visit links. The best descriptions balance SEO with readability.`,+ recommendedStyles: [+ "SEO-Optimized",+ "Educational/Tutorial",+ "Entertainment",+ "Review/Analysis",+ "Vlog-Style",+ "How-To",+ "Storytelling",+ ],+ },+ pinterest: {+ id: "pinterest",+ name: "Pinterest",+ displayName: "Pinterest Pin Description Generator",+ description:+ "Generate compelling Pinterest pin descriptions with AI. Create SEO-friendly descriptions that drive saves and clicks.",+ simpleIconSlug: "pinterest",+ colorHex: "#E60023",+ characterLimit: 500,+ contextGuidelines:+ "Pinterest descriptions should be keyword-rich, descriptive, and include clear value. Focus on search optimization and inspiration.",+ educationalContent: `Pinterest is a visual search engine where descriptions help users find your pins. SEO-friendly descriptions with relevant keywords improve discoverability. Focus on what users will learn, make, or achieve.++Effective Pinterest descriptions are detailed, keyword-rich, and benefit-focused. They clearly explain what the pin offers and why users should save it. The best descriptions balance search optimization with natural, compelling language.`,+ recommendedStyles: [+ "SEO-Optimized",+ "How-To/Tutorial",+ "Inspirational",+ "Recipe/DIY",+ "Gift Guide",+ "Listicle",+ "Product Description",+ ],+ },+ medium: {+ id: "medium",+ name: "Medium",+ displayName: "Medium Article Intro Generator",+ description:+ "Generate compelling Medium article introductions with AI. Create hooks that capture readers and encourage them to keep reading.",+ simpleIconSlug: "medium",+ colorHex: "#000000",+ characterLimit: undefined,+ contextGuidelines:+ "Medium posts should be thoughtful, well-written, and provide unique insights. Focus on strong hooks and valuable content.",+ educationalContent: `Medium is a platform for long-form, thoughtful writing. Article introductions should hook readers immediately and promise value. The first few paragraphs determine whether readers continue or bounce.++Effective Medium introductions grab attention with a compelling hook, establish credibility, and clearly communicate what readers will gain. They might start with a story, surprising stat, or bold statement. The best intros make readers eager to continue.`,+ recommendedStyles: [+ "Thought Leadership",+ "Personal Essay",+ "How-To Guide",+ "Analysis",+ "Storytelling",+ "Listicle",+ "Opinion/Commentary",+ ],+ },+ substack: {+ id: "substack",+ name: "Substack",+ displayName: "Substack Newsletter Post Generator",+ description:+ "Generate engaging Substack newsletter posts with AI. Create content that keeps subscribers engaged and attracts new readers.",+ simpleIconSlug: "substack",+ colorHex: "#FF6719",+ characterLimit: undefined,+ contextGuidelines:+ "Substack posts should provide unique value to subscribers. Write in your authentic voice and deliver on your newsletter's promise.",+ educationalContent: `Substack is a newsletter platform where consistent, valuable content builds loyal subscribers. Posts should align with your newsletter's theme and provide insights readers can't find elsewhere.++Effective Substack posts are well-researched, thoughtfully written, and respect subscribers' time and attention. They deliver on your newsletter's value proposition while maintaining your unique voice. The best posts make subscribers glad they're subscribed.`,+ recommendedStyles: [+ "Newsletter Essay",+ "Analysis/Commentary",+ "Curation/Roundup",+ "Personal Insight",+ "Deep Dive",+ "Interview/Q&A",+ "Storytelling",+ ],+ },+};++export const postGeneratorPlatformList = Object.values(+ postGeneratorPlatformConfigs+);diff --git a/docs/src/app/(home)/tools/page.tsx b/docs/src/app/(home)/tools/page.tsxindex 69162f876..1d0f7c558 100644--- a/docs/src/app/(home)/tools/page.tsx+++ b/docs/src/app/(home)/tools/page.tsx@@ -25,6 +25,7 @@ import {import { platformList } from "./components/platform-configs";import { commentPlatformList } from "./components/comment-platform-configs";import { pageNamePlatformList } from "./components/page-name-platform-configs";+import { postGeneratorPlatformList } from "./components/post-generator-platform-configs";import {SiDiscord,SiX,@@ -254,7 +255,19 @@ const pageNameGeneratorTools = pageNamePlatformList.map(platform => ({description: `Generate creative ${platform.pageType.toLowerCase()} names for ${platform.name} with AI.`,}));-const socialMediaTools = [...fontGeneratorTools, ...commentGeneratorTools, ...pageNameGeneratorTools];+const postGeneratorTools = postGeneratorPlatformList.map(platform => ({+ href: `/tools/${platform.id}-post-generator`,+ icon: platformIconMap[platform.id],+ title: platform.displayName,+ description: `Generate engaging posts for ${platform.name} with AI-powered content creation.`,+}));++const socialMediaTools = [+ ...fontGeneratorTools,+ ...commentGeneratorTools,+ ...pageNameGeneratorTools,+ ...postGeneratorTools,+];function ToolCard({ tool }: { tool: { href: string; icon: any; title: string; description: string } }) {const Icon = tool.icon;diff --git a/docs/src/app/api/tools/generate-post/route.ts b/docs/src/app/api/tools/generate-post/route.tsnew file mode 100644index 000000000..96be64053--- /dev/null+++ b/docs/src/app/api/tools/generate-post/route.ts@@ -0,0 +1,127 @@+import { callOpenRouter } from "@/lib/openrouter";+import { getClientIP, rateLimit } from "@/lib/rate-limit";+import { NextRequest, NextResponse } from "next/server";+import { z } from "zod";++const requestSchema = z.object({+ topic: z.string().min(3).max(1000),+ style: z.string(),+ additionalContext: z.string().max(500).optional(),+ platform: z.string(),+ characterLimit: z.number().optional(),+});++export async function POST(request: NextRequest) {+ try {+ // Rate limiting - 5 requests per minute+ const ip = getClientIP(request);+ const rateLimitResult = rateLimit(+ `post-generator:${ip}`,+ 5,+ 60 * 1000+ );++ const headers = new Headers({+ "X-RateLimit-Limit": rateLimitResult.limit.toString(),+ "X-RateLimit-Remaining": rateLimitResult.remaining.toString(),+ "X-RateLimit-Reset": new Date(rateLimitResult.reset).toISOString(),+ });++ if (!rateLimitResult.success) {+ return NextResponse.json(+ { error: "Rate limit exceeded. Please try again later." },+ { status: 429, headers }+ );+ }++ // Parse and validate request+ const body = await request.json();+ const validatedData = requestSchema.parse(body);++ const additionalContextText = validatedData.additionalContext+ ? `\n\nAdditional context: ${validatedData.additionalContext}`+ : "";++ const characterLimitText = validatedData.characterLimit+ ? `\nIMPORTANT: Posts MUST be under ${validatedData.characterLimit} characters.`+ : "";++ // Call OpenRouter to generate posts+ const prompt = `You are a social media expert specializing in ${validatedData.platform}. Generate 3 unique, engaging posts for the following topic:++Topic: ${validatedData.topic}+Style: ${validatedData.style}${additionalContextText}++Requirements:${characterLimitText}+- Write in the ${validatedData.style} style+- Make each post unique and approach the topic from different angles+- Ensure posts are platform-appropriate for ${validatedData.platform}+- Make them engaging and likely to drive interaction+- Use natural language that doesn't sound AI-generated+- Include hooks, questions, or calls-to-action where appropriate+- Each post should be complete and ready to publish++Return ONLY a JSON array of post strings in this exact format:+["Post 1 text here", "Post 2 text here", "Post 3 text here"]++Do not include any markdown formatting, explanation, or additional text - just the raw JSON array of strings.`;++ const response = await callOpenRouter([+ {+ role: "user",+ content: prompt,+ },+ ]);++ // Parse JSON response+ let posts;+ try {+ // Extract JSON from response+ const jsonMatch = response.match(/\[[\s\S]*\]/);+ if (!jsonMatch) {+ throw new Error("No JSON array found in response");+ }+ posts = JSON.parse(jsonMatch[0]);++ // Validate it's an array of strings+ if (!Array.isArray(posts) || !posts.every((p) => typeof p === "string")) {+ throw new Error("Invalid post format");+ }++ // Filter out posts that exceed character limit if specified+ if (validatedData.characterLimit) {+ posts = posts.filter(+ (post) => post.length <= validatedData.characterLimit!+ );++ // If we filtered out too many, we might have fewer than 3 posts+ if (posts.length === 0) {+ throw new Error(+ "Generated posts exceeded character limit. Please try again."+ );+ }+ }+ } catch (error) {+ console.error("Parse error:", error);+ return NextResponse.json(+ { error: "Failed to parse generated posts. Please try again." },+ { status: 500, headers }+ );+ }++ return NextResponse.json({ posts }, { headers });+ } catch (error) {+ if (error instanceof z.ZodError) {+ return NextResponse.json(+ { error: "Invalid request data", details: z.treeifyError(error) },+ { status: 400 }+ );+ }++ console.error("Post generation error:", error);+ return NextResponse.json(+ { error: "Failed to generate posts. Please try again." },+ { status: 500 }+ );+ }+}diff --git a/docs/src/components/RelatedTools.tsx b/docs/src/components/RelatedTools.tsxindex aea084333..2a1622274 100644--- a/docs/src/components/RelatedTools.tsx+++ b/docs/src/components/RelatedTools.tsx@@ -453,6 +453,72 @@ const allTools: Tool[] = [href: "/tools/substack-page-name-generator",category: "social-media",},+ {+ name: "LinkedIn Post Generator",+ description: "Generate professional LinkedIn posts with AI",+ href: "/tools/linkedin-post-generator",+ category: "social-media",+ },+ {+ name: "X (Twitter) Post Generator",+ description: "Generate engaging X (Twitter) posts with AI",+ href: "/tools/x-post-generator",+ category: "social-media",+ },+ {+ name: "Facebook Post Generator",+ description: "Generate engaging Facebook posts with AI",+ href: "/tools/facebook-post-generator",+ category: "social-media",+ },+ {+ name: "Instagram Caption Generator",+ description: "Generate creative Instagram captions with AI",+ href: "/tools/instagram-post-generator",+ category: "social-media",+ },+ {+ name: "Threads Post Generator",+ description: "Generate engaging Threads posts with AI",+ href: "/tools/threads-post-generator",+ category: "social-media",+ },+ {+ name: "Reddit Post Generator",+ description: "Generate authentic Reddit posts with AI",+ href: "/tools/reddit-post-generator",+ category: "social-media",+ },+ {+ name: "TikTok Caption Generator",+ description: "Generate trendy TikTok captions with AI",+ href: "/tools/tiktok-post-generator",+ category: "social-media",+ },+ {+ name: "YouTube Description Generator",+ description: "Generate optimized YouTube descriptions with AI",+ href: "/tools/youtube-post-generator",+ category: "social-media",+ },+ {+ name: "Pinterest Pin Description Generator",+ description: "Generate compelling Pinterest descriptions with AI",+ href: "/tools/pinterest-post-generator",+ category: "social-media",+ },+ {+ name: "Medium Article Intro Generator",+ description: "Generate compelling Medium article intros with AI",+ href: "/tools/medium-post-generator",+ category: "social-media",+ },+ {+ name: "Substack Newsletter Post Generator",+ description: "Generate engaging Substack posts with AI",+ href: "/tools/substack-post-generator",+ category: "social-media",+ },];interface RelatedToolsProps {