A modern, feature-rich chat interface built with React, TypeScript, and Vite. This application provides a ChatGPT-like experience with conversation management, persistence, and a clean, responsive UI.
- React 19 - Modern React with hooks
- TypeScript - Type-safe development
- Vite - Fast build tool and dev server
- Tailwind CSS - Utility-first styling
- Lucide React - Beautiful icons
- localStorage - Client-side persistence
- Node.js (v18 or higher)
- npm or yarn
-
Clone the repository (if applicable)
cd frontend -
Install dependencies
npm install
Start the development server with hot module replacement:
npm run devThe application will be available at http://localhost:5173
Create an optimized production build:
npm run buildThe built files will be in the dist directory.
Preview the production build locally:
npm run previewRun ESLint to check code quality:
npm run lintThe application connects to a backend API. You can configure the API URL in two ways:
- Via UI: Use the API Address input in the sidebar settings
- Default: The app defaults to
https://ap.sn4s.pp.ua
The API URL is saved to localStorage and persists across sessions.
Your backend API should have a /query endpoint that:
- Accepts POST requests
- Expects JSON body:
{ "question": "user message" } - Returns JSON:
{ "answer": "response", "sources": ["source1", "source2"] }
src/
├── components/ # React components
│ ├── ChatInput.tsx # Message input component
│ ├── MessageBubble.tsx # Message display component
│ ├── Sidebar.tsx # Sidebar with conversations
│ ├── ConversationList.tsx # List of conversations
│ ├── ConversationItem.tsx # Single conversation item
│ ├── EmptyState.tsx # Welcome screen
│ └── LoadingIndicator.tsx # Loading animation
├── hooks/ # Custom React hooks
│ ├── useConversations.ts # Conversation management
│ └── useApiUrl.ts # API URL management
├── services/ # Business logic
│ ├── api.ts # API communication
│ └── storage.ts # localStorage operations
├── App.tsx # Main application component
├── main.tsx # Application entry point
└── index.css # Global styles
- Start a conversation: Type a message and press Enter or click Send
- Create new chat: Click the "New Chat" button in the sidebar
- Switch conversations: Click on any conversation in the sidebar
- Delete conversations: Hover over a conversation and click the trash icon
- Configure API: Update the API Address in the sidebar settings
- Conversations are automatically saved to localStorage
- Each conversation has an auto-generated title from the first message
- Conversations are grouped by date for easy navigation
- Switch between conversations without losing context
- Desktop: Full sidebar with conversation list
- Mobile: Collapsible header with essential controls
- Optimized for all screen sizes
- Messages are saved automatically as you chat
- Conversations persist across browser sessions
- No manual save required
The codebase follows React best practices:
- Custom hooks for business logic
- Reusable components for UI elements
- Clear separation of concerns
- TypeScript for type safety
- Create components in
src/components/ - Add business logic to
src/hooks/orsrc/services/ - Update types in relevant files
- Test thoroughly before committing
If port 5173 is already in use, Vite will automatically try the next available port.
- Check that your backend API is running
- Verify the API URL in the sidebar settings
- Check browser console for error messages
- Clear
node_modulesand reinstall:rm -rf node_modules && npm install - Clear Vite cache:
rm -rf node_modules/.vite
This project is private and proprietary.
For issues or questions, please contact the development team.