AI-Powered Customer Relationship Management System using FastAPI, PostgreSQL, Neo4j, Qdrant, Gemini AI, and Machine Learning.
SmartCRM is a multi-database CRM demo that combines PostgreSQL, Neo4j, Qdrant, and a churn-prediction machine learning module behind a FastAPI backend. The repository has been reorganized into production-friendly, lowercase snake_case folders so it is easier to understand, maintain, and publish on GitHub.
The system exposes CRM data through a REST API and a browser dashboard. PostgreSQL powers the core customer and order data, Neo4j models social relationships, Qdrant handles vector similarity search, and the machine learning module predicts churn risk from customer behavior.
- REST API built with FastAPI
- Dashboard UI served from the backend
- PostgreSQL customer and order analytics
- Neo4j graph traversal and influence analysis
- Qdrant vector similarity search for customers and products
- Churn prediction model powered by scikit-learn
- Separate setup scripts for each service boundary
flowchart LR
U[User / Browser] --> B[backend / FastAPI]
B --> P[database / PostgreSQL]
B --> G[graph_database / Neo4j]
B --> V[vector_database / Qdrant]
B --> Q[query_router / intent router]
B --> M[machine_learning / churn model]
Q --> P
Q --> G
Q --> V
- Python 3.10+
- FastAPI
- Uvicorn
- PostgreSQL
- Neo4j
- Qdrant
- scikit-learn
- NumPy
- Faker
project-root/
βββ backend/
β βββ app/
β βββ requirements.txt
βββ database/
β βββ schema/
β βββ seed/
β βββ services/
β βββ requirements.txt
β βββ setup_db.py
βββ docs/
β βββ SETUP_GUIDE.md
βββ graph_database/
β βββ schema/
β βββ seed/
β βββ services/
β βββ requirements.txt
βββ machine_learning/
β βββ churn_model.py
β βββ churn_model.pkl
β βββ label_encoder.pkl
βββ query_router/
β βββ query_router.py
βββ vector_database/
β βββ collections/
β βββ seed/
β βββ services/
β βββ requirements.txt
βββ attendance_system_final.ino
βββ run_all_setup.ps1
βββ README.md
- Install Python 3.10 or newer.
- Install PostgreSQL.
- Install Docker Desktop if you will run Qdrant locally.
- Create and activate a virtual environment.
- Install the service dependencies:
pip install -r database\requirements.txt
pip install -r graph_database\requirements.txt
pip install -r vector_database\requirements.txt
pip install -r backend\requirements.txt- Follow the detailed Windows instructions in docs/SETUP_GUIDE.md.
Each service keeps its own local .env file. These files are intentionally excluded from version control.
POSTGRES_URL- PostgreSQL connection string used by the database service and ML moduleNEO4J_URL- Neo4j bolt URLNEO4J_USER- Neo4j usernameNEO4J_PASSWORD- Neo4j passwordQDRANT_HOST- Qdrant host, usuallylocalhostQDRANT_PORT- Qdrant port, usually6333GEMINI_API_KEY- Optional AI router key for intent routing
Start the API from the backend folder:
cd backend
uvicorn app.main:app --reload --port 8000Helpful URLs:
- Dashboard:
http://localhost:8000/ - API docs:
http://localhost:8000/docs - Health check:
http://localhost:8000/health
You can also use run_all_setup.ps1 from the project root to install dependencies and run the setup scripts.
The backend keeps the existing API surface intact. Main route groups include:
/customers- customer browsing and churn-related endpoints/analytics- dashboard metrics and ML predictions/graph- Neo4j graph queries/similarity- Qdrant similarity search/ai- natural-language query router
- database contains the PostgreSQL schema, seed data, and service layer.
- graph_database contains the Neo4j schema, seed script, and service layer.
- vector_database contains the Qdrant collection setup, seed script, and service layer.
Each database keeps its own requirements.txt so service dependencies remain isolated and easy to install.
The machine_learning folder contains the churn model training and inference script plus the generated model artifacts.
churn_model.pytrains and runs churn predictionchurn_model.pklstores the trained modellabel_encoder.pklstores the label encoder used by inference
The main dashboard providing an overview of customer insights, analytics, and AI-powered CRM features.
Natural language interface that enables users to interact with CRM data using AI-powered queries.
Machine learning model that predicts customer churn and provides actionable insights for retention strategies.
Interactive graph visualization powered by Neo4j to explore customer relationships and network connections.
- Add automated tests for the backend and service layers
- Add CI validation for formatting and dependency checks
- Externalize sample credentials into documented template files
- Add a deployment workflow for the FastAPI backend
- Split the dashboard assets into a dedicated frontend package if the UI grows further
- Original academic project contributors
- Repository maintenance and structure cleanup by Copilot
This project is licensed under the MIT License. See LICENSE for details.


