Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Document Search Engine

A full-stack web application that allows users to upload documents and search through them with intelligent keyword highlighting and relevance ranking.

Features

  • Multi-format Support: Upload PDF, DOCX, PPTX, and TXT files
  • Full-text Search: Search across all uploaded documents instantly
  • Keyword Highlighting: See highlighted search terms in results
  • Relevance Ranking: Results ranked by relevance score
  • Document Management: View, download, and delete documents
  • Responsive Design: Works on desktop and mobile devices
  • Real-time Search: Debounced search with instant results

Technology Stack

Backend

  • FastAPI: Modern Python web framework
  • Python 3.9+: Core language
  • Uvicorn: ASGI server

Frontend

  • React 18: Frontend framework
  • Tailwind CSS: Utility-first CSS framework
  • Axios: HTTP client
  • React Dropzone: File upload component

Quick Start

Option 1: Start Both Services with One Command (Recommended)

On Windows: Double-click start.bat or run:

start.bat

On macOS / Linux:

chmod +x start.sh
./start.sh

Option 2: Run Services in Separate Terminals

1. Start Backend (Terminal 1)

# From the project root
python backend/app/main.py
  • Backend API: http://localhost:8002
  • Interactive Swagger Docs: http://localhost:8002/docs

2. Start Frontend (Terminal 2)

cd frontend
npm start
  • Frontend App: http://localhost:3000

API Endpoints

Upload Document

POST /api/v1/upload
Content-Type: multipart/form-data

Search Documents

GET /api/v1/search?q={query}&page={page}&size={size}&file_type={type}

Get Document Details

GET /api/v1/documents/{id}

Download Document

GET /api/v1/documents/{id}/download

Delete Document

DELETE /api/v1/documents/{id}

List All Documents

GET /api/v1/documents?page={page}&size={size}&sort={field}

Get Statistics

GET /api/v1/stats

Usage

  1. Upload Documents: Drag and drop files or click to select files on the home page
  2. Search: Use the search bar to find documents containing specific keywords
  3. View Results: Click on search results to see highlighted keywords and download files
  4. Manage Documents: View all documents, sort them, and delete unwanted files

File Support

  • PDF: Portable Document Format
  • DOCX: Microsoft Word documents
  • PPTX: Microsoft PowerPoint presentations
  • TXT: Plain text files

Features in Detail

Search Functionality

  • Fuzzy Search: Handles typos and similar words
  • Multi-word Search: Search for multiple keywords
  • File Type Filtering: Filter results by document type
  • Pagination: Navigate through large result sets

Document Management

  • Metadata Tracking: File size, upload date, word count
  • Status Tracking: Processing status of each document
  • Bulk Operations: Select and manage multiple documents

User Interface

  • Responsive Design: Works on all screen sizes
  • Dark/Light Theme: Automatic theme detection
  • Accessibility: WCAG compliant interface
  • Progressive Web App: Can be installed as a desktop app

Development

Project Structure

document-search-engine/
├── backend/
│   ├── app/
│   │   └── main.py          # FastAPI application
│   ├── uploads/             # Uploaded files storage
│   └── requirements.txt     # Python dependencies
├── frontend/
│   ├── public/
│   ├── src/
│   │   ├── components/      # React components
│   │   ├── pages/          # Page components
│   │   ├── services/       # API services
│   │   └── App.jsx         # Main app component
│   └── package.json        # Node.js dependencies
└── README.md

Adding New File Types

To add support for new file types:

  1. Update ALLOWED_EXTENSIONS in backend/app/main.py
  2. Add text extraction logic in the extract_text function
  3. Update the frontend file type filters

Customization

  • Styling: Modify Tailwind CSS classes in components
  • Search Algorithm: Enhance the search logic in the backend
  • File Processing: Add more sophisticated text extraction
  • Database: Replace in-memory storage with PostgreSQL or MongoDB

Deployment

Docker Deployment

Create a docker-compose.yml file:

version: '3.8'
services:
  backend:
    build: ./backend
    ports:
      - "8000:8000"
    volumes:
      - ./uploads:/app/uploads
  
  frontend:
    build: ./frontend
    ports:
      - "3000:3000"
    depends_on:
      - backend

Cloud Deployment

  • Frontend: Deploy to Vercel, Netlify, or AWS S3
  • Backend: Deploy to Heroku, AWS ECS, or Google Cloud Run
  • Storage: Use AWS S3 or Google Cloud Storage for file storage

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For support and questions:

  • Create an issue on GitHub
  • Check the documentation
  • Review the API endpoints

Roadmap

  • OCR support for scanned documents
  • Multi-language support
  • Document preview
  • Advanced search filters
  • User authentication
  • Document sharing
  • API rate limiting
  • Elasticsearch integration
  • Machine learning-based search
  • Document categorization

About

Full-stack file management & document search system with React and Python FastAPI

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages