Pandeyycodes/phonelens
GitHub: Pandeyycodes/phonelens
Stars: 0 | Forks: 0
# PhoneLens
PhoneLens is an editorial, ultra-minimalist phone validation, threat analysis, and risk scoring dashboard.
## 🖼️ Dashboard Showcase

## Overview
PhoneLens allows users to parse international phone numbers, extract country flags, timezones, carrier information, and compute a comprehensive risk score by aggregating intelligence from NumVerify and AbstractAPI concurrently. The interface is meticulously designed around typography, whitespace, and a high-end, light-theme minimalist aesthetic.
## Tech Stack
- **Backend**: FastAPI (Python 3.11+), Uvicorn, SQLAlchemy 2.0 (with aiosqlite async SQLite driver), Pydantic v2, and phonenumbers library.
- **Frontend**: React 18, Vite, Tailwind CSS, Axios, and Custom CSS cubic-bezier transitions.
- **Containerization**: Docker & Docker Compose.
## Prerequisites
- **Python**: `3.11+`
- **Node.js**: `18+`
- **Poetry**: For python package management
- **Docker & Docker Compose**: Optional for containerized setup
## Obtaining API Keys
PhoneLens queries external APIs in parallel for threat risk aggregation. You can obtain free keys at the following links:
1. **NumVerify Key**: Register at [numverify.com](https://numverify.com/) to receive your free access key.
2. **AbstractAPI Phone Validation Key**: Sign up at [abstractapi.com/api/phone-validation-validation](https://www.abstractapi.com/api/phone-validation-validation) for a free account.
Once obtained, rename `backend/.env.example` to `backend/.env` and paste your credentials:
NUMVERIFY_KEY=your_numverify_key_here
ABSTRACT_KEY=your_abstractapi_key_here
*Note: If keys are left empty, the application falls back gracefully to local threat assessment and returns a safe standard score (0, `unknown`) without crashing.*
## Project Structure
phonelens/
├── backend/
│ ├── app/
│ │ ├── main.py # FastAPI application & endpoints
│ │ ├── lookup.py # Core parsing & country data resolution
│ │ ├── sources.py # Parallel third-party API aggregations
│ │ ├── models.py # SQLAlchemy SQLite models
│ │ └── schemas.py # Pydantic v2 data models
│ ├── tests/
│ │ └── test_lookup.py # Pytest automated testing suite
│ ├── Dockerfile # Backend container instructions
│ ├── pyproject.toml # Poetry dependency manifest
│ └── .env.example # Environment keys template
├── frontend/
│ ├── src/
│ │ ├── components/
│ │ │ ├── SearchBar.jsx # Minimalist search, select & pulse loader
│ │ │ ├── ResultSection.jsx # Staggered reveal data partitions
│ │ │ ├── RiskBar.jsx # Mount-animated color-coded threat bar
│ │ │ └── HistorySection.jsx # Search logs table with lookup quicklinks
│ │ ├── api/
│ │ │ └── lookup.js # Frontend Axios client
│ │ ├── App.jsx # State coordinator & keyframes style
│ │ ├── index.css # Custom global css animations
│ │ └── main.jsx # React main DOM hook
│ ├── Dockerfile # Frontend container instructions
│ ├── index.html # HTML core importing Google Font Inter
│ ├── tailwind.config.js # Editorial typography & theme overrides
│ ├── postcss.config.js # PostCSS configs
│ ├── vite.config.js # Vite proxy configurations
│ └── package.json # Frontend package manifests
├── docker-compose.yml # Orchestrated multi-service local builds
└── README.md # General user documentation
## Setup Instructions
### Path A: Docker Setup (Recommended)
Launch the entire system inside insulated containers in a single command:
1. Ensure your `.env` keys are updated in the `backend/.env` file.
2. Build and start both services:
docker-compose up --build
3. Open your browser and navigate to:
- **Frontend**: [http://localhost:5173](http://localhost:5173)
- **Interactive API Docs**: [http://localhost:8000/docs](http://localhost:8000/docs)
### Path B: Manual Installation
#### 1. Backend Service
1. Navigate to the backend directory:
cd backend
2. Install Python dependencies via Poetry:
poetry install
3. Copy environment configuration and input keys:
cp .env.example .env
4. Spin up the FastAPI server via Uvicorn:
poetry run uvicorn app.main:app --reload
*The backend starts at [http://localhost:8000](http://localhost:8000).*
#### 2. Frontend Application
1. Open a new terminal and navigate to the frontend directory:
cd frontend
2. Install npm packages:
npm install
3. Launch the Vite development server:
npm run dev
*The frontend starts at [http://localhost:5173](http://localhost:5173).*
## Automated Verification Tests
You can run automated pytests in the backend directory to check standard compliance:
cd backend
poetry run pytest -v
## Example API Curl Commands
### 1. Perform a Lookup
curl -X GET "http://localhost:8000/lookup/%2B14155552671" -H "accept: application/json"
### 2. Retrieve Lookup Logs
curl -X GET "http://localhost:8000/history" -H "accept: application/json"
### 3. Clear Lookup Database
curl -X DELETE "http://localhost:8000/history" -H "accept: application/json"
标签:自定义脚本