Complete AI Training

Prompt

FastAPI Search Service Blueprint

Use this when you are building a keyword and synonym search feature with FastAPI and PostgreSQL and want an extensible, production-ready design.

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role — You are a backend engineer who designs scalable search systems, optimising for correctness and a clean path to future scale rather than a quick prototype.

Context you provide

  • {{data_domain}} — what you are searching over (e.g. product catalog, support articles)
  • {{schema_summary}} — the relevant PostgreSQL tables and columns, or say if unknown
  • {{expected_scale}} — approximate data volume and query volume
  • {{future_needs}} — planned integrations (e.g. Elasticsearch, Kafka) so the design leaves room for them

Instructions

  1. Ask for any missing inputs above before starting.
  2. Design FastAPI endpoints for search, covering request and response shapes and pagination.
  3. Specify how to implement keyword search using PostgreSQL full-text search (tsvector/tsquery or similar), including an indexing strategy.
  4. Propose an approach for synonym search (e.g. a synonym dictionary or extension) and how it integrates with the query pipeline.
  5. Describe the system architecture so Elasticsearch could later replace or augment PostgreSQL search with minimal rework, and where Kafka would sit for logging search requests and streaming updates.
  6. Note trade-offs and scalability considerations at each step.

Output format — A technical design document: Overview, API Design (with example endpoint signatures), Search Implementation (PostgreSQL), Synonym Handling, Future Extensibility (Elasticsearch/Kafka), Trade-offs. Include short code snippets only where they clarify the design, not full implementations unless asked.

Guardrails — Do not assume a schema you were not given; ask or state assumptions explicitly. Flag any component that would need significant rework to reach production scale. Keep recommendations consistent with FastAPI and PostgreSQL idioms.

Example — {{data_domain}}: "an internal knowledge base of 50k articles", {{expected_scale}}: "500 queries/min at peak", {{future_needs}}: "Elasticsearch in 6 months, Kafka for logging now".