The problem

Students know what they built but struggle to write LinkedIn posts that are clear and engaging. Plain LLM prompts give generic posts that all sound the same.

The solution

A full-stack app that grounds generation in real writing patterns retrieved from a knowledge base, validates the output, and scores it, with auth, plans and an admin panel around it.

How it works

Architecture & flow

  1. 1

    Next.js frontend calls a FastAPI REST API (/api/v1) with JWT auth

  2. 2

    The request is analysed for topic, category and keywords, then embedded

  3. 3

    Hybrid retrieval: pgvector similarity re-ranked with keyword overlap and metadata matches, top K kept

  4. 4

    Top results become "content intelligence" (common hooks, structure, CTA style) inside a structured prompt

  5. 5

    The LLM output is validated (length, spam, repetition, made-up numbers, prompt leakage), retried once if bad, then scored and saved

Problems I hit

Challenges and how I solved them

Challenge 1

Pure vector search on a small dataset returned noisy matches.

How I fixed it

Added hybrid re-ranking that combines vector score, keyword overlap and metadata with configurable weights.

Challenge 2

Storing other people's posts raises privacy concerns.

How I fixed it

The ingestion pipeline cleans text, redacts PII, removes duplicates and keeps only embeddings and derived metadata.

Challenge 3

User input and retrieved text could be used for prompt injection.

How I fixed it

Both are treated as untrusted and kept in separate prompt sections, and the output is checked for prompt leakage.

Challenge 4

Development and tests should not need paid API keys.

How I fixed it

Put every provider behind an interface, with a mock LLM and local hashing embeddings, so the full app runs offline.

Results

  • 118 automated tests (95 backend with Pytest, 23 frontend with Vitest)
  • Precision@5 of about 0.87 on the synthetic RAG evaluation set
  • OpenAI and Anthropic support with automatic fallback

What I learned

  • How retrieval, prompt design and output validation fit together
  • Hybrid search with pgvector
  • Privacy-aware data ingestion
  • Testing a full-stack AI app end to end

Project Overview

Linkdine AI helps students and professionals write better LinkedIn posts. You either describe something you did (a project, an internship, a certification) and it writes the post, or you paste a draft and it explains what is weak and rewrites it.

Under the hood it is a RAG pipeline: before calling the LLM, it retrieves writing patterns (hook styles, structures, keywords, CTAs) from a knowledge base and uses them to guide generation.

Key features

  • Generate a post from a form: what you did, tools used, tone, audience and length.
  • Enhance a draft: hook, readability, keyword and structure analysis, suggestions and a rewrite.
  • Quality score for every post (hook, keywords, readability, structure).
  • Post history with edit, copy and delete.
  • Free and Premium plans with daily usage limits.
  • Admin panel to upload CSV/JSON datasets into the knowledge base.
  • Pluggable providers: mock, OpenAI or Anthropic, with an optional fallback provider.

What's next

  • Curate a larger, real and licensed dataset
  • Add a cross-encoder reranker and better semantic embeddings
  • Move tokens to httpOnly cookies and add real payments
Related

More ai workflow projects

AI Workflow Completed

ShopMind AI - Agentic Commerce Assistant

A shopping assistant agent built at the Razorpay hackathon. It looks up real products through tool calls instead of guessing, asks the shopper before touching the cart or payment, and records every step so the store owner can see why it acted.

PythonFastAPIGemini APIPostgreSQLRazorpay +6