This template is designed for building chatbot applications that can:
- Enable users to chat with document collections stored in vector databases
- Provide keyword search capabilities for document retrieval
- Support streaming responses for better user experience
template/
├── frontend/ # Next.js frontend application
│ ├── public/ # Static assets
│ └── src/ # Source code
│ ├── app/ # Next.js app directory
│ ├── components/ # Reusable UI components
│ └── lib/ # Utility functions and hooks
├── backend/ # FastAPI backend application
│ ├── api/ # API endpoints
│ │ └── routers/ # API route handlers
│ ├── core/ # Core functionality and configurations
│ ├── models/ # Data models and schemas
│ └── service/ # Business logic services
└── docs/ # Documentation files
- Copy the entire template directory to your new project location
- Rename the project in the following files:
frontend/package.json
(update "name" field)backend/pyproject.toml
(update project metadata)- Update environment configuration files
- Navigate to the frontend directory
- Install dependencies:
npm install
- Create a
.env.local
file based on.env.example
- Start the development server:
npm run dev
- Navigate to the backend directory
- Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Create a
.env
file based on.env.example
- Start the development server:
python -m api.main
-
Theme and Styling:
- Modify
src/app/globals.css
for global styles - Update Tailwind configuration in
tailwind.config.js
- Modify
-
Pages and Components:
- Customize page content in
src/app/page.tsx
- Modify or extend components in
src/components/
- Customize page content in
-
API Integration:
- Update API endpoint URLs in
.env
files - Customize API client functions in
src/lib/
- Update API endpoint URLs in
-
API Endpoints:
- Modify existing routes in
api/routers/
- Add new routes by creating new files in the routers directory
- Modify existing routes in
-
Database Configuration:
- Configure database connections in
.env
file - Update database models in the
models
directory
- Configure database connections in
-
Vector Database Integration:
- Configure vector database settings in
.env
file - Update vector store configuration in the appropriate service files
- Configure vector database settings in
- Keep code readable and well-commented
- Follow the established directory structure for better organization
- Use environment variables for configuration
- Document any major changes or extensions to the template
Common issues and their solutions:
- API Connection Issues: Ensure backend server is running and CORS is properly configured
- Environment Variables: Make sure all required environment variables are set
- Dependencies: Verify all dependencies are installed correctly
[Specify your license here]