# University Portal - AI-Enhanced Multi-Tenant Platform A modern, AI-powered university portal built with Next.js 15, React 19, and Prisma. Features advanced AI integration with conversation memory, university-specific knowledge bases, and multi-tenant architecture. ## ๐Ÿš€ Features ### Core Features - **Multi-University Support**: White-label solution for multiple universities - **AI-Powered Chat**: Intelligent chatbot with conversation memory - **Knowledge Base Management**: University-specific Q&A system - **Modern UI/UX**: Beautiful, responsive design with Tailwind CSS - **Multi-Language Support**: English and Arabic support - **Role-Based Access**: Student, Staff, Admin, and Super Admin roles ### AI Integration - **Conversation Memory**: AI remembers entire conversations - **University-Specific Knowledge**: Custom Q&A for each university - **Personalized Responses**: Context-aware based on user role and profile - **Ollama Integration**: Local AI models with fallback to cloud APIs - **Real-time Chat**: Professional chat interface with loading states ### Technical Features - **Next.js 15**: Latest App Router with Turbopack - **React 19**: Latest React features and optimizations - **Prisma ORM**: Type-safe database operations - **SQLite Database**: Lightweight, file-based database - **TypeScript**: Full type safety throughout - **Tailwind CSS**: Utility-first styling - **ESLint**: Code quality and consistency ## ๐Ÿ› ๏ธ Installation ### Prerequisites - Node.js 18+ - npm or yarn - Ollama (for local AI models) ### Setup 1. **Clone the repository** ```bash git clone cd university-portal ``` 2. **Install dependencies** ```bash npm install ``` 3. **Set up the database** ```bash npx prisma generate npx prisma db push ``` 4. **Seed the database** ```bash npm run seed npm run seed:knowledge-base ``` 5. **Start the development server** ```bash npm run dev ``` 6. **Open your browser** Navigate to [http://localhost:3000](http://localhost:3000) ## ๐Ÿ—„๏ธ Database Setup The project uses SQLite with Prisma ORM. Key models include: - **University**: Multi-tenant university configurations - **User**: User accounts with role-based access - **AcademicProgram**: University programs and courses - **AIKnowledgeBase**: University-specific Q&A for AI - **ChatSession/ChatMessage**: Conversation memory system - **DomainConfig**: Multi-domain support for universities ## ๐Ÿค– AI Configuration ### Local AI (Ollama) 1. **Install Ollama**: [https://ollama.ai](https://ollama.ai) 2. **Start Ollama service**: ```bash ollama serve ``` 3. **Pull a model**: ```bash ollama pull llama2 ``` ### Environment Variables Create a `.env.local` file: ```env # Database DATABASE_URL="file:./dev.db" # AI Configuration OLLAMA_HOST="http://localhost:11434" OPENROUTER_API_KEY="your-api-key" # Optional fallback # Authentication NEXTAUTH_SECRET="your-secret-key" NEXTAUTH_URL="http://localhost:3000" ``` ## ๐Ÿ“ Project Structure ``` university-portal/ โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ app/ # Next.js App Router โ”‚ โ”‚ โ”œโ”€โ”€ api/ # API routes โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ chat/ # AI chat endpoints โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ knowledge-base/ # Knowledge base management โ”‚ โ”‚ โ”œโ”€โ”€ admin/ # Admin dashboard โ”‚ โ”‚ โ””โ”€โ”€ ... # Public pages โ”‚ โ”œโ”€โ”€ components/ # React components โ”‚ โ”‚ โ”œโ”€โ”€ Chat/ # AI chat components โ”‚ โ”‚ โ”œโ”€โ”€ Navigation/ # Navigation components โ”‚ โ”‚ โ””โ”€โ”€ ... # Other components โ”‚ โ””โ”€โ”€ lib/ # Utility libraries โ”œโ”€โ”€ prisma/ # Database schema and migrations โ”œโ”€โ”€ public/ # Static assets โ”œโ”€โ”€ docs/ # Documentation โ””โ”€โ”€ scripts/ # Utility scripts ``` ## ๐ŸŽฏ Key Features in Detail ### AI Chat System - **Conversation Memory**: Stores chat history in database - **University Context**: Uses university-specific knowledge base - **User Personalization**: Adapts responses based on user role - **Real-time Interface**: Professional chat UI with typing indicators ### Knowledge Base Management - **Admin Interface**: Full CRUD operations for Q&A items - **Bilingual Support**: English and Arabic content - **Priority System**: Important items appear first in AI responses - **Active/Inactive Toggle**: Control which items are used by AI ### Multi-University Support - **White-Label**: Each university gets its own branded experience - **Domain Management**: Custom domains and subdomains - **Content Isolation**: University-specific content and assets - **Branch Management**: Multiple campuses per university ## ๐Ÿงช Testing ### Manual Testing 1. **AI Chat**: Test conversation memory and knowledge base integration 2. **Knowledge Base**: Add/edit/delete Q&A items in admin panel 3. **Multi-University**: Test different university contexts 4. **Responsive Design**: Test on mobile and desktop ### API Testing ```bash # Test AI chat curl -X POST http://localhost:3000/api/chat/ollama \ -H "Content-Type: application/json" \ -d '{"message": "What are admission requirements?", "universitySlug": "default-university"}' # Test knowledge base curl http://localhost:3000/api/knowledge-base ``` ## ๐Ÿš€ Deployment ### Vercel (Recommended) 1. **Connect repository** to Vercel 2. **Set environment variables** in Vercel dashboard 3. **Deploy automatically** on push to main branch ### Other Platforms - **Netlify**: Compatible with Next.js - **Railway**: Good for full-stack applications - **DigitalOcean App Platform**: Scalable deployment ## ๐Ÿ“š Documentation - [AI Conversation Memory Guide](docs/AI_CONVERSATION_MEMORY_GUIDE.md) - [AI Enhancement Summary](docs/AI_ENHANCEMENT_SUMMARY.md) - [Developer Guide](docs/DEVELOPER_GUIDE.md) - [User Guide](docs/USER_GUIDE.md) ## ๐Ÿค Contributing 1. **Fork the repository** 2. **Create a feature branch**: `git checkout -b feature/amazing-feature` 3. **Commit your changes**: `git commit -m 'Add amazing feature'` 4. **Push to the branch**: `git push origin feature/amazing-feature` 5. **Open a Pull Request** ## ๐Ÿ“„ License This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. ## ๐Ÿ†˜ Support - **Issues**: Create an issue on GitHub - **Documentation**: Check the `/docs` folder - **AI Configuration**: See AI setup guide in documentation ## ๐ŸŽ‰ Acknowledgments - **Next.js Team**: For the amazing framework - **Prisma Team**: For the excellent ORM - **Tailwind CSS**: For the utility-first CSS framework - **Ollama Team**: For local AI model support --- **Built with โค๏ธ for modern university portals**