Skip to content

refactor: isolate FastAPI and MySQL database implementation into fastapi_backend](url) folder#211

Merged
Userunknown84 merged 1 commit into
Userunknown84:mainfrom
vedant-kawale-27:main
Jun 23, 2026
Merged

refactor: isolate FastAPI and MySQL database implementation into fastapi_backend](url) folder#211
Userunknown84 merged 1 commit into
Userunknown84:mainfrom
vedant-kawale-27:main

Conversation

@vedant-kawale-27

@vedant-kawale-27 vedant-kawale-27 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR reorganizes the repository by isolating the unused FastAPI implementation and its MySQL database dependencies into a dedicated top-level directory (fastapi_backend/).

While the production/docker-compose environments run the Flask-based ML API (api.py), this keeps the FastAPI code intact in a separate module so it can still be run and tested independently without cluttering the main backend directory.

Changes

  • Module Reorganization: Moved the following FastAPI and MySQL files out of backend/ and into the new fastapi_backend/ folder:
    • main.py (FastAPI Server Entrypoint)
    • database.py (MySQL Database Client Helpers)
    • emails.py (FastAPI router for email operations)
    • export.py (FastAPI router for exporting reports)
    • middleware/logging_middleware.py (FastAPI logging middleware)
    • schema.sql (MySQL setup script)
  • Local Dependency Setup: Created a standalone requirements.txt in the new fastapi_backend/ directory to document and isolate dependencies specific to this service (fastapi, uvicorn, mysql-connector-python, fpdf2, etc.).
  • Relative Path & XAI Load Fix: Modified fastapi_backend/main.py to defer the initialization of XAIService until the models are loaded. This fixes path resolution issues and avoids double-loading pickles when running the application via uvicorn from the workspace root.
  • Import Adjustments: Updated absolute imports inside fastapi_backend files to reference the new folder module prefix.
  • Documentation: Updated the "Email Classification Database (FastAPI)" setup instructions in README.md to reference the new paths.

Verification

  1. Verified that the module successfully loads:
    .\venv\Scripts\python.exe -c "import fastapi_backend.main"
    

closes #177

Copilot AI review requested due to automatic review settings June 22, 2026 18:06
@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

@vedant-kawale-27 is attempting to deploy a commit to the Aditya Sharma's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Userunknown84 Userunknown84 merged commit 62590ea into Userunknown84:main Jun 23, 2026
5 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unused FastAPI dead code in backend/main.py

3 participants