Rapidly build intelligent interactive experiences with a robust AI chat API backend and a comprehensive modern UI component library.
CorePat is a foundational project designed to accelerate the development of conversational AI applications. It combines a powerful, plug-and-play AI chat API backend built with Express and TypeScript with a comprehensive suite of modern UI components, providing everything you need to quickly launch sophisticated interactive experiences.
Whether you're building custom AI assistants, customer service bots, or internal knowledge platforms, CorePat offers a modular and scalable solution to drastically cut down your development time.
- CorePat: Conversational AI Backend & UI Toolkit
- Rapidly build intelligent interactive experiences with a robust AI chat API backend and a comprehensive modern UI component library.
- Table of Contents
- 1. Key Features
- 2. Getting Started
- 3. API Reference (
artifacts/api-server) - 4. Using the UI Components (
artifacts/mockup-sandbox) - 5. Project Structure
- 6. Roadmap & Future Enhancements
- 7. Contributing
- 8. License
CorePat is divided into two primary artifacts, each offering distinct functionalities:
A robust Express.js and TypeScript API designed to handle core conversational AI logic.
- TypeScript-first Development: Ensures type safety and improves maintainability.
- Express.js Framework: Provides a fast, unopinionated, and minimalist web framework for Node.js.
- Dedicated
/chatEndpoint: A streamlined API endpoint for sending user messages and receiving AI-generated responses. - Integrated AI Client: Designed for seamless integration with various AI models (e.g., OpenAI, Anthropic, etc.) via a flexible client abstraction (
src/lib/aiClient.ts). - Configurable System Prompt Logic: Easily define and manage AI persona, context, and instructions using
src/lib/systemPrompt.ts. - Modular Architecture: Organized codebase facilitating easy extension and maintenance.
A comprehensive and modern UI component library, likely built with React, providing a rich toolkit for building sophisticated frontend applications that consume the AI chat service.
- Extensive Component Library: Includes a wide array of UI components (e.g.,
Button,Card,Dialog,Form,Input,Carousel,Chart, and many more) designed for modern web applications. - Reusable & Customizable: Components are built to be highly reusable and easily themeable or customizable to fit your brand.
- Designed for Interactivity: Provides the necessary building blocks to create engaging and dynamic user interfaces for conversational AI.
- Modern Development Workflow: Supports a typical frontend development workflow for rapid prototyping and application building.
Follow these instructions to set up and run CorePat on your local machine.
Make sure you have the following installed:
git clone https://github.com/AIandu/CorePat.git
cd CorePat-
Navigate to the backend directory:
cd artifacts/api-server -
Install dependencies:
npm install
-
Create a
.envfile for environment variables. You'll need to configure your AI provider API key and potentially the server port. A.env.examplemight be helpful if one exists, otherwise create it manually:# Example .env file content (replace with your actual values) PORT=3000 AI_API_KEY=your_ai_provider_api_key_here # Add other environment variables as needed, e.g., AI_MODEL_NAME
Note: The specific AI provider (e.g., OpenAI, Google Gemini, Anthropic) and related environment variables will depend on the implementation within
src/lib/aiClient.ts. -
Start the API server:
npm run build # if using `build.mjs` and need to compile first npm start # or npm run dev for development with hot-reloading if configured
The API server will typically run on
http://localhost:3000(or your configuredPORT).
-
Navigate to the frontend directory from the root of the cloned repository:
cd ../mockup-sandbox -
Install dependencies:
npm install
-
Start the development server:
npm run dev # or npm start depending on the project configurationThe UI component sandbox will typically open in your browser at
http://localhost:5173(or the address indicated in your terminal).
The primary endpoint for AI chat interactions is /chat.
Handles incoming user messages and returns AI-generated responses.
-
URL:
http://localhost:3000/chat(replace port if different) -
Method:
POST -
Request Body (JSON):
{ "message": "What is the capital of France?" }message(string, required): The user's input message to the AI.
-
Success Response (JSON):
- Code:
200 OK - Body:
{ "reply": "The capital of France is Paris." }reply(string): The AI's generated response.
- Code:
-
Error Response (JSON):
- Code:
500 Internal Server Error(or400 Bad Requestfor validation errors) - Body:
{ "error": "An error occurred while processing your request." }
- Code:
The artifacts/mockup-sandbox directory contains a rich set of modern UI components. These components are designed to be imported and used within a React application (as indicated by .tsx files). You can explore them by running the mockup-sandbox locally.
To use a component, you would typically import it from src/components/ui/ within your React application.
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/ui/card';
function MyChatApp() {
return (
<Card>
<CardHeader>
<CardTitle>AI Chat</CardTitle>
<CardDescription>Start a conversation with our AI assistant.</CardDescription>
</CardHeader>
<CardContent>
{/* Example: Display chat messages */}
<p>User: Hello!</p>
<p>AI: Hi there! How can I help you today?</p>
</CardContent>
<CardFooter>
<input type="text" placeholder="Type your message..." />
<Button>Send</Button>
</CardFooter>
</Card>
);
}
export default MyChatApp;Refer to the mockup-sandbox/src/App.tsx and the mockup-sandbox/src/components/ui/ directory for a full list and usage examples of the available components.
The repository is organized into artifacts containing the primary sub-projects:
CorePat/
├── artifacts/
│ ├── api-server/ # The Express.js TypeScript backend for AI chat functionality
│ │ ├── src/ # Source code for the API server
│ │ │ ├── lib/ # AI client, system prompt logic, utilities
│ │ │ └── routes/ # API endpoints (e.g., chat, health)
│ │ └── package.json # Backend dependencies and scripts
│ │
│ └── mockup-sandbox/ # The comprehensive modern UI component library
│ ├── src/ # Source code for the UI sandbox and components
│ │ ├── App.tsx # Main application for demonstrating UI components
│ │ └── components/ # UI components library
│ │ └── ui/ # Individual reusable UI components
│ └── package.json # Frontend dependencies and scripts
├── .gitignore
├── .replit # Replit environment configuration
└── README.md
CorePat is designed for continuous improvement. Key areas for future development include:
- Database Integration: Implementing a schema for chat history, user profiles, and AI configurations (see Issue #1).
- Demo Integration: Providing a concrete example of
mockup-sandboxcomponents interacting with the/chatAPI (see Issue #2). - Enhanced AI Modularity: Expanding
aiClient.tsto support more AI providers out-of-the-box. - Authentication & Authorization: Adding secure user management to the API.
- Streaming Responses: Implementing server-sent events or WebSockets for real-time AI responses.
- Comprehensive Documentation: Detailed API documentation (e.g., OpenAPI/Swagger) and component usage guides.
We welcome contributions to CorePat! If you have suggestions, bug reports, or want to contribute code, please open an issue or submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details. (Note: A LICENSE file does not currently exist in the provided context, but it's good practice to include one.)