A modern, AI-powered knowledge management system specifically built for KCA University students. Get instant answers about admission requirements, library services, APA formatting, and everything related to KCA University life. Built with Next.js 15, Groq AI, PostgreSQL, and RAG (Retrieval Augmented Generation).
Hey KCA Students! This app is currently in preview and we're working hard to upload all KCA University documents. Soon, it will know everything about KCA University. The developer is quite busy, but if you're willing to contribute documents or help improve the system, you're very welcome!
- π± WhatsApp: +254715558014
- π» GitHub: 888Greys/RAG-AI
- π€ Open Source: Contributions welcome!
To create the most comprehensive, AI-powered knowledge base for KCA University students. A single place where any student can get instant, accurate answers about university life, academics, services, and procedures. Together, we can make studying at KCA easier for everyone!
- Groq-powered responses with Llama 4 Scout (1-3 second responses)
- RAG (Retrieval Augmented Generation) for accurate, context-aware answers
- HyDE (Hypothetical Document Embeddings) for improved document retrieval
- Smart classification - determines when to use knowledge base vs general chat
- Admission Information - Requirements, deadlines, and processes
- Library & E-Library Help - Access guides and research resources
- APA Formatting Assistant - APA 7th edition citations and guidelines
- Student Services - Information about university services and procedures
- Academic Resources - Course information and academic support
- NextAuth.js integration with secure user sessions
- PostgreSQL user management with encrypted passwords
- Protected routes and personalized chat history
- Session persistence across devices
- Responsive interface - Perfect for smartphones and tablets
- Modern UI/UX with gradients and smooth animations
- Dark/Light mode support
- Optimized for students on the go
- Ultra-fast responses with Groq's inference engine
- Efficient vector search in PostgreSQL
- Edge deployment on Vercel for global access
- Optimized for mobile networks
Try it now: KCA University AI Assistant
- "How do I access the KCA University e-library?"
- "What are the admission requirements for KCA University?"
- "How do I format citations in APA 7th edition?"
- "What student services are available at KCA University?"
- "How do I apply for accommodation at KCA?"
- "What are the library opening hours?"
| Technology | Purpose | Category |
|---|---|---|
| Next.js 15 | React Framework | Frontend |
| React 19 | UI Library | Frontend |
| TypeScript | Type Safety | Language |
| Tailwind CSS | Styling | Styling |
| Framer Motion | Animations | UI/UX |
| Technology | Purpose | Category |
|---|---|---|
| Groq AI | Ultra-fast LLM | AI |
| Google AI | Embeddings | AI |
| OpenAI | GPT Models | AI |
| Vercel AI SDK | AI Integration | AI |
| Technology | Purpose | Category |
|---|---|---|
| PostgreSQL | Database | Backend |
| Drizzle ORM | Database ORM | Backend |
| NextAuth.js | Authentication | Auth |
| bcrypt-ts | Password Hashing | Security |
| Technology | Purpose | Category |
|---|---|---|
| Vercel | Deployment | Infrastructure |
| Vercel Blob | File Storage | Storage |
| Vercel KV | Redis Cache | Cache |
| Technology | Purpose | Category |
|---|---|---|
| PDF Parse | Document Processing | Processing |
| Langchain | Text Splitting | Processing |
| React Markdown | Markdown Rendering | UI |
| Sonner | Toast Notifications | UI |
| Zod | Schema Validation | Validation |
| SWR | Data Fetching | Data |
| D3 Scale | Data Visualization | Visualization |
| Technology | Purpose | Category |
|---|---|---|
| ESLint | Code Linting | DevTools |
- RAG (Retrieval Augmented Generation) for accurate, context-aware responses
- HyDE (Hypothetical Document Embeddings) for improved document retrieval
- Vector embeddings with Google AI for semantic search
- Edge runtime deployment for global low-latency access
- Server-side rendering with dynamic authentication
- Mobile-first responsive design optimized for all devices
Before you begin, ensure you have:
- Node.js 18+ installed
- npm/yarn/pnpm package manager
- Groq API key (get from console.groq.com)
- Google AI API key (get from aistudio.google.com)
- PostgreSQL database (Supabase recommended)
git clone https://github.com/888Greys/RAG-AI.git
cd RAG-AInpm install
# or
yarn install
# or
pnpm installCreate a .env file in the root directory:
# Groq API key for fast AI inference
GROQ_API_KEY=your-groq-api-key
# Google AI API key for embeddings
GOOGLE_GENERATIVE_AI_API_KEY=your-google-api-key
# NextAuth secret (generate with: openssl rand -base64 32)
AUTH_SECRET=your-auth-secret
# PostgreSQL connection string
POSTGRES_URL=your-postgres-url
# Optional: Vercel Blob for file uploads
BLOB_READ_WRITE_TOKEN=your-vercel-blob-token
# Optional: Vercel KV for caching
KV_REST_API_URL=your-kv-url
KV_REST_API_TOKEN=your-kv-tokenThe application uses PostgreSQL with the following schema:
-- Users table
CREATE TABLE "User" (
email VARCHAR(64) PRIMARY KEY NOT NULL,
password VARCHAR(64)
);
-- Chat history
CREATE TABLE "Chat" (
id TEXT PRIMARY KEY NOT NULL,
"createdAt" TIMESTAMP NOT NULL,
messages JSON NOT NULL,
author VARCHAR(64) NOT NULL REFERENCES "User"(email)
);
-- Document chunks with vector embeddings
CREATE TABLE "Chunk" (
id TEXT PRIMARY KEY NOT NULL,
"filePath" TEXT NOT NULL,
content TEXT NOT NULL,
embedding REAL[] NOT NULL
);Run the document upload script to populate your knowledge base:
# Upload general documents
npx tsx upload-documents.ts
# Upload KCA-specific documents
npx tsx upload-kca-documents.ts
# Upload PDF documents
npx tsx upload-pdfs.tsnpm run devVisit http://localhost:3000 to see your KCA University AI Assistant!
- Document Processing: KCA University documents are split into chunks and embedded using Google's text-embedding-004
- Storage: Chunks and embeddings are stored in PostgreSQL with vector search capabilities
- Query Processing: Student questions are classified and processed through HyDE
- Retrieval: Relevant KCA document chunks are found using cosine similarity
- Generation: Groq's Llama 4 Scout generates responses with KCA-specific context
Student Question β Classification β HyDE β Vector Search β KCA Context β AI Response
- RAG Middleware: Handles retrieval and context injection for KCA documents
- Chat Interface: Mobile-optimized UI for students
- Authentication: Secure student account management
- Vector Database: Efficient search through KCA University documents
- Main Chat:
meta-llama/llama-4-scout-17b-16e-instruct(Groq) - Classification:
llama-3.1-8b-instant(Groq) - Embeddings:
text-embedding-004(Google)
You can customize the knowledge base by:
- Adding KCA Documents: Use upload scripts with official KCA content
- Modifying UI: Update branding in
/componentsfor KCA colors/logos - Changing Models: Update model configurations in
/ai/index.ts - Styling: Modify Tailwind classes for KCA University branding
βββ ai/ # AI configuration and RAG middleware
βββ app/ # Next.js app router
β βββ (auth)/ # Authentication pages (login/register)
β βββ (chat)/ # Chat interface and API routes
β βββ landing/ # Landing page with developer info
β βββ db.ts # Database functions
βββ components/ # React components (chat, forms, etc.)
βββ drizzle/ # Database migrations
βββ utils/ # Utility functions
βββ pdfs/ # KCA University PDF documents
βββ schema.ts # Database schema
βββ upload-documents.ts # General document upload
βββ upload-kca-documents.ts # KCA-specific document upload
βββ upload-pdfs.ts # PDF document upload
-
Fork the Repository:
- Go to github.com/888Greys/RAG-AI
- Click "Fork" to create your own copy
-
Connect to Vercel:
- Go to vercel.com
- Import your forked repository
- Add environment variables
- Deploy!
-
Set Environment Variables in Vercel dashboard:
GROQ_API_KEYGOOGLE_GENERATIVE_AI_API_KEYAUTH_SECRETPOSTGRES_URL
We welcome contributions from KCA University students and developers! Here's how you can help:
- Share Documents: Help us upload official KCA University documents
- Report Issues: Let us know if information is missing or incorrect
- Suggest Features: What would make this more useful for students?
- Test & Feedback: Use the app and share your experience
- Code Contributions: Improve features, fix bugs, add functionality
- Documentation: Help improve this README and other docs
- UI/UX: Make the interface even better for students
- Performance: Optimize for mobile and slow connections
- Fork the repository from github.com/888Greys/RAG-AI
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes
- Test thoroughly:
npm run buildandnpm run dev - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
- π± WhatsApp: +254715558014 - Direct contact with the developer
- π» GitHub Issues: Create an issue for bugs or feature requests
- π¬ GitHub Discussions: Join discussions about the project
- β Basic chat functionality with RAG
- β User authentication and registration
- β Mobile-responsive design
- β Core KCA University documents
- π Uploading comprehensive KCA document library
- π Complete KCA University document coverage
- π Advanced search and filtering
- π± Progressive Web App (PWA) support
- π Offline functionality for key information
- π Usage analytics and popular questions
- π€ Voice interaction support
- π Integration with KCA University systems
- π Personalized student recommendations
- π Study group and collaboration features
- π Gamification for knowledge sharing
This project is licensed under the MIT License - see the LICENSE file for details.
- KCA University for being an amazing institution worth building for
- KCA Students for inspiration and feedback
- Vercel for the AI SDK and hosting platform
- Groq for ultra-fast AI inference
- Google for high-quality embeddings
- Next.js team for the amazing framework
- Open Source Community for all the incredible tools
- π± WhatsApp: +254715558014 - Quick help and support
- π» GitHub: 888Greys/RAG-AI - Technical issues and features
- π§ Issues: Report a problem - Bug reports and suggestions
- π Documentation: Vercel AI SDK Docs
- π¬ Discussions: GitHub Discussions
- π§ Contributing: See the Contributing section above
Built with β€οΈ for KCA University students using the Vercel AI SDK
Making university life easier, one question at a time. πβ¨