# NearMeOn: MongoDB to MySQL (database-only change)

## Scope lock
The existing FastAPI backend and React frontend remain. Do not port to Laravel, rename endpoints, change HTTP methods, alter request/response keys, or change authentication behavior.

## Current implementation approach
The existing route module still uses its document-style CRUD API. `backend/mysql_document_db.py` provides a MySQL-backed document adapter so route handlers and their JSON response shapes can remain unchanged. Data is stored in `nm_documents` as a collection name, document key, and JSON document. This preserves nested fields and optional/null values during the initial compatibility migration.

## Deployment environment
Set `MYSQL_HOST`, `MYSQL_PORT`, `MYSQL_DATABASE`, `MYSQL_USER`, and `MYSQL_PASSWORD` in the private server environment. Do not upload real credentials to source control or the public web root. Install `backend/requirements.txt`.

## Important validation gate
This is a first-pass compatibility implementation, not a production-ready cutover. Run the existing backend test suite and add contract tests for every endpoint before using it against production. Confirm all aggregation, projection, sorting, atomic update, uniqueness, and concurrency behavior. The adapter's Python-side filtering loads a collection into memory; optimize with native indexed SQL queries before large-scale production use.

## Migration/data import
Do not import the supplied small `test_database` dump as production data. Request a fresh full production MongoDB dump (including the places collection and every live collection), verify document counts, then import and compare. Keep the old database intact and take a restorable backup before cutover.
