Folder Structure
Complete project organization and file structure
Project Structure
DataXpert/
│
├── assets/ # Project assets
│ ├── logo.png # DataXpert logo
│ └── 2.png # Additional assets
│
├── backend/ # Backend application
│ ├── ai/ # AI and analysis modules
│ │ ├── __init__.py
│ │ ├── analysis_engine.py # Main analysis engine
│ │ ├── nlp_processor.py # NLP processing
│ │ ├── anomaly_detector.py # Anomaly detection
│ │ └── data_processor.py # Data preprocessing
│ │
│ ├── auth/ # Authentication module
│ │ ├── __init__.py
│ │ └── auth_service.py # Auth logic & Google OAuth
│ │
│ ├── database/ # Database module
│ │ ├── __init__.py
│ │ └── supabase_client.py # Supabase operations
│ │
│ ├── app.py # Main Flask application
│ ├── requirements.txt # Python dependencies
│ └── .env.example # Environment variables template
│
├── frontend/ # Frontend application
│ ├── css/ # Stylesheets
│ │ ├── style.css # Main styles with theme system
│ │ ├── dashboard.css # Dashboard styles
│ │ └── analysis.css # Analysis page styles
│ │
│ ├── js/ # JavaScript files
│ │ ├── config.js # Configuration & API endpoints
│ │ ├── auth.js # Authentication logic
│ │ ├── theme.js # Theme toggle functionality
│ │ ├── main.js # Homepage logic
│ │ ├── dashboard.js # Dashboard logic
│ │ ├── analysis.js # AI analysis logic
│ │ └── header-profile.js # User profile header component
│ │
│ ├── docs/ # Documentation website
│ │ ├── css/
│ │ │ └── docs.css # Documentation styles
│ │ ├── js/
│ │ │ └── docs.js # Documentation scripts
│ │ ├── index.html # Documentation home
│ │ ├── setup.html # Setup guide
│ │ ├── workflow.html # Workflow documentation
│ │ ├── system-architecture.html # System architecture
│ │ ├── er-diagram.html # Database schema
│ │ └── folder-structure.html # This file
│ │
│ ├── index.html # Landing page
│ ├── dashboard.html # Dashboard page
│ ├── analysis.html # AI analysis page
│ ├── history.html # Activity history page
│ └── profile.html # User profile page
│
├── database.sql # Complete database setup script
└── README.md # Project documentation
Backend Structure Details
AI Module (backend/ai/)
analysis_engine.py- Core analysis logic, performs statistical analysis, generates insightsnlp_processor.py- Natural language processing, intent extraction, entity recognitionanomaly_detector.py- Anomaly detection using Z-scores and IQR methodsdata_processor.py- Data preprocessing and validation
Auth Module (backend/auth/)
auth_service.py- Handles user authentication, password hashing, Google OAuth
Database Module (backend/database/)
supabase_client.py- All database operations, CRUD for all tables
Main Application (backend/app.py)
- Flask application setup
- API endpoints definition
- Middleware configuration
- CORS setup
Frontend Structure Details
HTML Pages
index.html- Landing page with login/signup modalsdashboard.html- Main dashboard with charts and statsanalysis.html- AI chat interface for data analysishistory.html- Activity history and data managementprofile.html- User profile management
CSS Files
style.css- Global styles, theme system, componentsdashboard.css- Dashboard-specific stylesanalysis.css- AI analysis page styles
JavaScript Files
config.js- API configuration, endpoints, storage keysauth.js- Authentication logic, Google OAuth integrationtheme.js- Dark/light theme toggle functionalitymain.js- Homepage interactivity, modal managementdashboard.js- Dashboard data loading, chart renderinganalysis.js- AI chat functionality, analysis displayheader-profile.js- User profile header component
Documentation Structure
The documentation website is located at frontend/docs/ and provides comprehensive guides:
- Getting Started: Overview, setup guide, workflow
- Architecture: System architecture, database schema, folder structure
- About: Team info, social media links
All documentation pages include dark/light theme support and responsive navigation.
Key Files Explained
backend/app.py
The main Flask application file. Contains all API endpoints:
- Authentication endpoints (
/api/auth/*) - User management (
/api/user/*) - Business data (
/api/business/*,/api/business-data/*) - AI analysis (
/api/ai/*) - Activity history (
/api/history/*) - Dashboard stats (
/api/dashboard/*)
frontend/js/config.js
Central configuration file containing:
- API base URL
- Google Client ID
- All API endpoints
- Helper functions (auth headers, logout, etc.)
backend/ai/analysis_engine.py
Core AI analysis engine that:
- Analyzes sales, profit, expenses
- Detects trends and patterns
- Generates insights and recommendations
- Prepares data for visualizations
Configuration Files
backend/requirements.txt
Python dependencies:
- Flask - Web framework
- Flask-CORS - Cross-origin requests
- PyJWT - JWT token handling
- pandas, numpy - Data analysis
- supabase - Database client
- google-auth - Google OAuth
backend/.env
Environment variables (create from .env.example):
- SECRET_KEY - Flask secret key
- JWT_SECRET_KEY - JWT signing key
- SUPABASE_URL - Supabase project URL
- SUPABASE_KEY - Supabase API key
- GOOGLE_CLIENT_ID - Google OAuth client ID