Skip to content

Klark is a micro SaaS app for interacting with PDF documents, built with OpenAI API, LangChain.js, Vercel AI SDK, and tRPC SSE subscriptions. It uses PostgreSQL with Drizzle ORM, ChromaDB for embeddings, MinIO for PDF storage, ShadCN/UI with Tailwind, and Lucia for session management.

Notifications You must be signed in to change notification settings

RajNykDhulapkar/klark

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Klark

Klark is a micro SaaS platform that enables intelligent interaction with PDF documents using advanced AI capabilities. Built with modern technologies, it provides document summarization and an AI-powered chat interface for querying document content.

Features

  • 📑 PDF Document Processing

    • Document uploading and storage
    • Automatic text extraction and analysis
    • Document summarization
  • 💬 Interactive Chat Interface

    • Real-time streaming responses
    • Context-aware document querying
    • Chat history analysis
    • Intelligent question generation
  • 🔒 Security & Authentication

    • Secure user authentication via Lucia
    • Document access control
    • Session management
  • 💳 Payment Integration

    • Stripe payment processing
    • Subscription management
    • Usage tracking

Tech Stack

Frontend

  • Next.js with TypeScript
  • Tailwind CSS for styling
  • ShadCN/UI component library
  • tRPC for type-safe API calls

Backend

  • LangChain.js for AI operations
  • OpenAI API for language processing
  • ChromaDB for vector embeddings
  • PostgreSQL with Drizzle ORM
  • MinIO for PDF storage
  • tRPC SSE for real-time streaming

Infrastructure

  • Docker for containerization
  • Traefik as reverse proxy and load balancer
  • GitHub Actions for CI/CD
  • Watchtower for automated deployments

Getting Started

Prerequisites

  • Node.js 18+
  • Docker and Docker Compose
  • PostgreSQL
  • MinIO
  • ChromaDB
  • OpenAI API key

Environment Setup

  1. Clone the repository:
git clone https://github.com/yourusername/klark.git
cd klark
  1. Install dependencies:
pnpm install
  1. Create a .env file with the following variables:
DATABASE_URL=
OPENAI_API_KEY=
MINIO_ROOT_USER=
MINIO_ROOT_PASSWORD=
MINIO_ENDPOINT=
STRIPE_SECRET_KEY=
STRIPE_WEBHOOK_SECRET=
  1. Initialize the database:
pnpm db:push

Development

  1. Start the development environment:
docker-compose -f docker-compose.local.yml up -d
pnpm dev
  1. Run the setup script:
./scripts/setup.sh

Production Deployment

  1. Build the application:
pnpm build
  1. Deploy using Docker Compose:
docker-compose up -d

Project Structure

.
├── src/
│   ├── app/          # Next.js app router
│   ├── components/   # React components
│   ├── lib/          # Utility functions
│   ├── server/       # Server-side code
│   └── trpc/         # tRPC configurations
├── drizzle/          # Database migrations
├── public/           # Static assets
└── scripts/          # Utility scripts

Features in Detail

Document Processing

  • Automatic text extraction from PDFs
  • Document chunking and embedding generation
  • Vector storage in ChromaDB for efficient retrieval

Chat Interface

  • Real-time streaming responses using tRPC SSE
  • Context-aware document querying
  • Intelligent follow-up question generation
  • Chat history analysis for better context understanding

Authentication & Security

  • User authentication and session management with Lucia
  • Secure document access control
  • Role-based permissions

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

MIT License

Support

For support, please open an issue in the GitHub repository or contact the maintainers.


Built with ❤️ using Next.js.

About

Klark is a micro SaaS app for interacting with PDF documents, built with OpenAI API, LangChain.js, Vercel AI SDK, and tRPC SSE subscriptions. It uses PostgreSQL with Drizzle ORM, ChromaDB for embeddings, MinIO for PDF storage, ShadCN/UI with Tailwind, and Lucia for session management.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published