A multi-party political Q&A chat application that provides neutral, side-by-side answers from Norwegian political parties based on their official party programs. Check it out at https://partichat.no/
Parti-Chat allows users to:
- Select multiple parties and ask policy questions
- Get grounded answers based strictly on party programs (PDFs)
- Compare positions with transparent citations and page references
- View source material with direct links to PDF pages
- Save conversation history locally or with optional account sync
All responses are in Norwegian Bokmål and strictly grounded in official party program documents.
- Frontend: Next.js 15, React 19, TailwindCSS, shadcn/ui
- Backend: Next.js API, oRPC for type-safe APIs
- Database: PostgreSQL with pgvector, Drizzle ORM
- AI: OpenRouter (GPT-4o-mini) for RAG-based responses
- Runtime: Bun
- Monorepo: Turborepo
-
Install dependencies:
bun install
-
Set up PostgreSQL database and update environment variables:
# apps/server/.env DATABASE_URL=postgresql://... OPEN_ROUTER_API_KEY=your-key BETTER_AUTH_SECRET=your-secret -
Apply database schema:
bun run db:push
-
Ingest party programs (place PDFs in
/party-program/):bun run ingest:parties
-
Start development servers:
bun dev
- Web app: http://localhost:3000
- API server: http://localhost:3001
parti-chat/
├── apps/
│ ├── web/ # Frontend (Next.js)
│ └── server/ # Backend API (oRPC + RAG)
├── party-program/ # PDF storage for party programs
└── docker-compose.yml # Local development setup
- RAG-powered answers with pgvector similarity search
- Citation tracking with page numbers and chapter references
- Streaming responses for real-time answer generation
- Multi-party comparison summaries on demand
- PDF text extraction with chunking for optimal retrieval
- Conversation persistence with optional authentication
bun dev- Start all apps in developmentbun build- Build for productionbun run db:push- Apply database changesbun run db:studio- Open database GUIbun run ingest:parties- Process party program PDFs
The app is designed for deployment on platforms like Dokploy, Railway, or Vercel with separate services for frontend, backend, and PostgreSQL database.