Skip to content

Latest commit

 

History

166 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Perplexity Clone

This repository contains a vertical slice of a Perplexity-inspired AI answer engine. It is designed to take user questions, perform web searches for context, and generate comprehensive answers with citations, just like Perplexity.

The project is structured as a full-stack monorepo, consisting of a NestJS backend and a Next.js frontend.

V2 Scope

V2 is intended for local, single-user use. It does not include authentication, user-scoped data access, rate limits, billing limits, or public multi-tenant deployment guardrails yet. Those concerns are tracked as later productization work in the roadmap.

Architecture Overview

  • Backend (/backend): A modular monolith built with NestJS, TypeScript, and PostgreSQL. It handles API requests, database persistence via Prisma, web search integration (Tavily), and AI answer generation (provider-agnostic, supporting OpenAI and Groq).
  • Frontend (/frontend): A modern web application built with Next.js, React, and Tailwind CSS. It features a responsive layout, a two-column UI (sidebar and main thread view), and custom markdown parsing for citation badges.

Quick Start

For a production-shaped local stack, use Docker Compose:

cp .env.example .env
# Replace every placeholder in .env, then:
docker compose up -d --build
docker compose ps -a

Open http://localhost:3001. See the Deployment Guide for configuration, migrations, independent service deployment, secret management, networking, and end-to-end verification.

Run services directly

To run the application locally, you will need to start both the backend and frontend servers.

1. Start the Backend

  1. Navigate to the backend directory:
    cd backend
  2. Ensure your .env file is configured with the necessary API keys (OpenAI/Groq, Tavily, Database URL). You can start from the example file:
    cp .env.example .env
  3. Install dependencies and start the development server:
    npm install
    npm run dev
    The backend runs on http://localhost:8080.

2. Start the Frontend

  1. Navigate to the frontend directory:
    cd frontend
  2. Install dependencies and start the development server:
    npm install
    npm run dev
    The frontend dev script runs on http://localhost:3001 and proxies API calls to the backend at http://localhost:8080 by default.

3. Usage

Open your browser to http://localhost:3001. You can enter a question in the prompt input, and the frontend will communicate with the backend to retrieve context and generate an AI-powered response.

Documentation

Comprehensive project documentation has been consolidated into the root _docs/ directory:

  • System Architecture: Frontend and backend system design, tech stack choices, and data flow.
  • Tech Stack: Detailed list of frontend and backend technologies and rationale.
  • API Contracts: Detailed request and response payloads for all backend endpoints.
  • Product Roadmap: Current development phase and future planned features.
  • Deployment Guide: Production preparation, containers, database migrations, deployment, and verification.

About

A minimal AI search app that takes a query, fetches web results, extracts useful snippets/content, generates a cited answer, and lets the user continue the thread.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages