AI-Assisted Writing Platform with Intelligent Project Indexing and Semantic Search
CoWriteAI is a full-stack web application designed for novelists, scriptwriters, and long-form content creators. The platform provides intelligent project indexing and semantic search capabilities, allowing writers to upload creative projects, automatically extract and index characters, themes, and settings, and perform semantic searches across their content repositories.
- User Authentication: Secure JWT-based authentication with session management
- Project Management: Create and organize writing projects with file uploads
- Intelligent Indexing: Automatic extraction of characters, locations, and themes
- Semantic Search: Natural language search across content using AI embeddings
- Entity Repository: Browse and explore discovered story elements
- Responsive Design: Modern UI with dark/light theme support
- Next.js 15 - React framework with App Router
- TypeScript - Type-safe JavaScript
- Tailwind CSS - Utility-first CSS framework
- Zustand - Lightweight state management
- FastAPI - High-performance Python API framework
- MongoDB Atlas - Document database with GridFS and vector search
- Redis - Caching and session management
- Celery - Background task processing
- spaCy - Natural language processing for entity extraction
- SentenceTransformers - Text embeddings for semantic search
- HuggingFace - Pre-trained transformer models
- Node.js 18+ and npm
- Python 3.11+
- Docker and Docker Compose
- MongoDB Atlas account (or local MongoDB)
- Redis instance
-
Clone the repository
git clone <repository-url> cd cowrite-ai-platform
-
Set up environment variables
cp .env.example .env.local # Edit .env.local with your configuration -
Start development services
# Start MongoDB and Redis docker-compose -f docker-compose.dev.yml up -d mongo redis # Install frontend dependencies npm install # Install backend dependencies cd backend pip install -r requirements.txt python -m spacy download en_core_web_sm
-
Run the application
# Terminal 1: Start backend cd backend uvicorn app.main:app --reload --host 0.0.0.0 --port 8000 # Terminal 2: Start frontend npm run dev
-
Access the application
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
# Start all services
docker-compose -f docker-compose.dev.yml up
# View logs
docker-compose -f docker-compose.dev.yml logs -f
# Stop services
docker-compose -f docker-compose.dev.yml downcowrite-ai-platform/
├── src/ # Frontend source code
│ ├── app/ # Next.js App Router pages
│ ├── components/ # React components
│ ├── lib/ # Utility functions
│ ├── hooks/ # Custom React hooks
│ ├── store/ # Zustand stores
│ └── types/ # TypeScript type definitions
├── backend/ # Backend source code
│ ├── app/ # FastAPI application
│ │ ├── api/ # API routes
│ │ ├── core/ # Core functionality
│ │ ├── models/ # Data models
│ │ ├── services/ # Business logic
│ │ └── utils/ # Utility functions
│ └── requirements.txt # Python dependencies
├── docker/ # Docker configuration
├── .env.example # Environment variables template
└── docker-compose.yml # Production Docker setup
NEXT_PUBLIC_API_URL=http://localhost:8000
NEXT_PUBLIC_APP_NAME=CoWriteAIDATABASE_URL=mongodb+srv://username:password@cluster.mongodb.net/cowrite_ai
REDIS_URL=redis://localhost:6379
SECRET_KEY=your-super-secret-jwt-keySee .env.example for complete configuration options.
The FastAPI backend automatically generates interactive API documentation:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
We provide a comprehensive test suite that validates all semantic search and indexing functionality in a single test file.
Quick Test:
cd backend
# Linux/Mac
./run_test.sh
# Windows
run_test.bat
# Or run directly with Python
python test_comprehensive_search_indexing.pyWhat It Tests:
- ✅ Database connectivity
- ✅ Project and file management
- ✅ Text extraction and chunking
- ✅ Entity extraction (characters, locations, themes)
- ✅ Embedding generation with sentence-transformers
- ✅ Semantic search with vector similarity
- ✅ Relationship discovery between entities
- ✅ Search analytics and performance metrics
- ✅ Similar content discovery
- ✅ ChromaDB vector search (works locally without MongoDB Atlas!) 🆕
Test Duration: ~60 seconds (first run may take longer due to model downloads)
Documentation:
backend/TEST_INSTRUCTIONS.md- Setup and troubleshootingbackend/TEST_SUMMARY.md- Quick referencebackend/CHROMADB_INTEGRATION.md- ChromaDB vector search integration 🆕
# Test embedding service only
python backend/test_embedding_integration.py
# Test async indexing
python backend/test_async_indexing.py
# Test relationship discovery
python backend/test_relationship_discovery.py- Requirements: Define feature requirements in EARS format
- Design: Create technical design documents
- Implementation: Follow task-based development approach
- Testing: Unit, integration, and end-to-end tests
- Deployment: Docker-based deployment pipeline
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For questions and support, please open an issue in the GitHub repository.