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 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.
- 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.
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 -aOpen http://localhost:3001. See the
Deployment Guide for configuration, migrations,
independent service deployment, secret management, networking, and end-to-end
verification.
To run the application locally, you will need to start both the backend and frontend servers.
- Navigate to the backend directory:
cd backend - Ensure your
.envfile is configured with the necessary API keys (OpenAI/Groq, Tavily, Database URL). You can start from the example file:cp .env.example .env
- Install dependencies and start the development server:
The backend runs on
npm install npm run dev
http://localhost:8080.
- Navigate to the frontend directory:
cd frontend - Install dependencies and start the development server:
The frontend dev script runs on
npm install npm run dev
http://localhost:3001and proxies API calls to the backend athttp://localhost:8080by default.
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.
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.