Enterprise-grade browser diagnostics and device fingerprinting platform
Features β’ Installation β’ Documentation β’ API Reference β’ Contributing
- Overview
- Features
- Architecture
- Tech Stack
- Installation
- Configuration
- Usage
- API Reference
- Data Model
- Admin Dashboard
- Security
- Deployment
- Screenshots
- Contributing
- License
Scan Browser is a production-ready diagnostics platform that captures comprehensive browser and device telemetry including engine identification, hardware specifications, network characteristics, battery status, and geolocation data. Built with enterprise-grade security and scalability in mind, it features compressed storage, real-time analytics, and an intuitive admin dashboard.
- Real-time Diagnostics: Instant browser and device profiling with sub-second response times
- Geospatial Visualization: Interactive mapping with Leaflet.js for location-based insights
- Compressed Storage: Gzip-compressed MongoDB storage reducing data footprint by 70%+
- Dual Persistence: MongoDB primary storage with flat-file JSON mirroring for redundancy
- Analytics Dashboard: Comprehensive admin interface with geo-hotspots and distribution metrics
- Production Hardened: Rate limiting, CORS protection, and health monitoring built-in
- π Deep Scan Engine - One-click comprehensive device profiling
- πΊοΈ Geolocation Mapping - Real-time coordinate visualization with Leaflet
- πΎ Smart Caching - Local persistence with 20-minute session retention
- π Analytics Suite - Geo-hotspots, IP distribution, and browser analytics
- π Security Hardened - Rate limiting, CORS controls, and input validation
- π Scalable Storage - Gzip compression with MongoDB + JSON file mirroring
- β‘ Zero Build Frontend - CDN-based dependencies for instant deployment
- π₯ Health Monitoring - Built-in health checks for production monitoring
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β β β β β β
β Static HTML/ ββββββββββΊβ Express API ββββββββββΊβ MongoDB β
β CSS/JS Client β HTTP β (Node.js) β Async β (Primary) β
β + Leaflet.js β β - Rate Limiting β β β
β β β - CORS β βββββββββββββββββββ
βββββββββββββββββββ β - Compression β β
β β β
ββββββββββββββββββββ β
β β
βΌ β
ββββββββββββββββββββ β
β logs.json ββββββββββββββββββββ
β (Mirror) β Sync Write
ββββββββββββββββββββ
- Client initiates scan via browser API calls
- Express middleware validates and rate-limits requests
- Payload compressed with gzip (70%+ size reduction)
- Dual-write to MongoDB and local JSON file
- Real-time analytics aggregation
- Admin dashboard queries aggregated statistics
- HTML5/CSS3/ES6+ - Modern web standards
- Leaflet.js - Interactive mapping library
- Font Awesome - Icon library via CDN
- Vanilla JavaScript - Zero framework dependencies
- Node.js 18+ - JavaScript runtime
- Express 4.x - Web application framework
- Mongoose - MongoDB ODM with schema validation
- express-rate-limit - Request throttling
- cors - Cross-origin resource sharing
- zlib - Native compression
- dotenv - Environment configuration
- MongoDB 5.0+ - Primary document store
- JSON Files - Redundant flat-file storage
- Node.js 18.x or higher
- MongoDB 5.0+ (local or Atlas)
- npm or yarn package manager
# Clone repository
git clone https://github.com/yourusername/scan-browser.git
cd scan-browser
# Backend setup
cd backend
npm install
cp .env.example .env
# Edit .env with your MongoDB credentials
npm run dev
# Frontend setup (new terminal)
cd ../frontend
npx serve
# Or use Python: python -m http.server 8001-
Clone the repository
git clone https://github.com/yourusername/scan-browser.git cd scan-browser -
Install backend dependencies
cd backend npm install -
Configure environment variables
cp .env.example .env
See Configuration section for details.
-
Start the backend server
# Development mode (with hot reload) npm run dev # Production mode npm start
-
Serve the frontend
# Option 1: Using npx cd ../frontend npx serve # Option 2: Using Python python -m http.server 8001 # Option 3: Using any static file server
-
Access the application
- Main app:
http://localhost:8001 - Admin dashboard:
http://localhost:8001/Admin.html - API health:
http://localhost:4000/health
- Main app:
Create a .env file in the backend/ directory:
# Database Configuration
MONGODB_URI=mongodb+srv://<username>:<password>@<cluster>.mongodb.net/<database>?retryWrites=true&w=majority
DB_NAME=browser_scan
# Server Configuration
PORT=4000
NODE_ENV=development
# CORS Configuration (optional)
ALLOWED_ORIGINS=http://localhost:8001,http://localhost:3000
# Rate Limiting (optional)
RATE_LIMIT_WINDOW_MS=600000
RATE_LIMIT_MAX_REQUESTS=100Update the API endpoints in your frontend files:
frontend/script.js
const BACKEND_URL = 'http://localhost:4000/receive';frontend/Admin.html
const API_BASE = 'http://localhost:4000/api/admin';| Variable | Description | Default | Required |
|---|---|---|---|
MONGODB_URI |
MongoDB connection string | - | Yes |
DB_NAME |
Database name | browser_scan |
Yes |
PORT |
Server port | 4000 |
No |
NODE_ENV |
Environment mode | development |
No |
ALLOWED_ORIGINS |
CORS allowed origins | * (dev) |
No |
- Open the application in your browser
- Click the "Start Scan" button
- Grant geolocation permission (optional)
- View real-time results including:
- Browser and engine details
- Hardware specifications
- Network information
- Battery status
- Geolocation coordinates (if permitted)
- Interactive map visualization
- Navigate to
/Admin.html - View comprehensive analytics:
- Total request counts
- Browser distribution charts
- Geographic hotspots
- IP address distribution
- Recent scan logs
Scan results are automatically cached for 20 minutes, allowing quick access to recent scans without re-running diagnostics.
Base URL: http://localhost:4000
Capture and store scan payload.
Request Body:
{
"browser": "Chrome 120.0.0",
"cores": 8,
"memory": "16 GB",
"latitude": "28.6139",
"longitude": "77.2090",
"battery": "87%",
"connection": "4g",
"timestamp": "2025-12-30T12:34:56.000Z"
}Success Response (200):
{
"status": "captured",
"message": "Logged to DB and local storage."
}Error Response (429):
{
"error": "Too many requests, please try again later."
}Retrieve aggregate statistics.
Success Response (200):
{
"totalRequests": 1523,
"browsers": [
{ "_id": "Chrome", "count": 890 },
{ "_id": "Firefox", "count": 423 },
{ "_id": "Safari", "count": 210 }
]
}Get detailed analytics data.
Success Response (200):
{
"geoHotspots": [
{
"_id": { "lat": "28.61", "lng": "77.20" },
"count": 145
}
],
"ipDistribution": [
{ "_id": "203.0.113.42", "count": 67 },
{ "_id": "198.51.100.23", "count": 45 }
]
}Fetch all stored logs with decompressed payloads.
Success Response (200):
[
{
"_id": "65a1b2c3d4e5f6789",
"payload": {
"browser": "Chrome",
"cores": 8,
"memory": "16 GB"
},
"ip": "203.0.113.42",
"browser": "Chrome",
"receivedAt": "2025-12-30T12:34:56.000Z"
}
]Health check endpoint for monitoring.
Success Response (200):
{
"status": "healthy",
"timestamp": "2025-12-30T12:34:56.000Z"
}All endpoints are rate-limited to 100 requests per 10 minutes per IP address. Exceeding this limit returns a 429 Too Many Requests response.
{
payload: Buffer, // gzip-compressed JSON (required)
ip: String, // Client IP address
browser: String, // Browser identifier
isCompressed: Boolean, // Compression flag (default: true)
receivedAt: Date, // Timestamp (default: Date.now)
createdAt: Date, // Auto-generated by Mongoose
updatedAt: Date // Auto-generated by Mongoose
}- Algorithm: gzip (zlib)
- Compression Ratio: Typically 70-85% size reduction
- Decompression: Transparent on retrieval via
/api/admin/logs
receivedAt: Descending (optimizes recent log queries)browser: Ascending (optimizes aggregation queries)ip: Ascending (optimizes IP-based analytics)
The admin dashboard provides comprehensive analytics and monitoring capabilities.
- Real-time Statistics: Total requests and browser distribution
- Geographic Heatmap: Visual representation of scan locations
- IP Distribution: Top IP addresses by request count
- Recent Logs: Paginated view of latest scans
- Responsive Design: Mobile-friendly interface
Navigate to /Admin.html or http://localhost:8001/Admin.html
Update the API base URL in Admin.html:
const API_BASE = 'http://localhost:4000/api/admin';- Window: 10 minutes (600,000ms)
- Max Requests: 100 per IP
- Strategy: Rolling window with IP-based tracking
- Development: Permissive (
*) for local testing - Production: Strict allowlist (e.g.,
https://scan-browser.vercel.app) - Methods: GET, POST
- Headers: Content-Type, Authorization
- Schema validation via Mongoose
- Type checking on all endpoints
- Sanitization of user inputs
- Compression prevents payload tampering visibility
- IP logging for audit trails
- No sensitive data stored in plaintext
- Always set
NODE_ENV=productionin production environments - Use environment variables for sensitive configuration
- Enable MongoDB authentication and use strong credentials
- Regularly update dependencies to patch vulnerabilities
- Monitor rate limit hits for potential abuse patterns
- Implement SSL/TLS for production deployments
- MongoDB credentials secured in environment variables
- Production CORS origins configured
- Rate limiting enabled
- SSL certificate installed (production)
- Regular dependency audits (
npm audit) - Logs monitored for suspicious activity
-
Set production environment variables
NODE_ENV=production MONGODB_URI=<your-production-mongodb-uri> PORT=4000
-
Update frontend API URLs
- Set
BACKEND_URLinscript.jsto your production API - Set
API_BASEinAdmin.htmlto your production API
- Set
-
Configure CORS
- Update allowlist in
server.jsto match your frontend domain
- Update allowlist in
# Install Vercel CLI
npm i -g vercel
# Deploy from frontend directory
cd frontend
vercel --prod- Create new Web Service
- Connect your GitHub repository
- Configure:
- Build Command:
cd backend && npm install - Start Command:
cd backend && npm start
- Build Command:
- Add environment variables in Render dashboard
- Create cluster at mongodb.com/atlas
- Configure network access (allow your server IPs)
- Create database user
- Copy connection string to
MONGODB_URI
- Environment variables configured
- Frontend API URLs updated
- CORS origins configured for production domain
- MongoDB connection tested
- Health endpoint accessible
- Rate limiting verified
- SSL/TLS certificate installed
- Monitoring and logging configured
Use the /health endpoint for uptime monitoring:
curl https://your-api-domain.com/healthExpected response:
{
"status": "healthy",
"timestamp": "2025-12-30T12:34:56.000Z"
}Contributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch
git checkout -b feature/amazing-feature
- Make your changes
- Test thoroughly
- Commit with conventional commits
git commit -m "feat: add amazing feature" - Push to your fork
git push origin feature/amazing-feature
- Open a Pull Request
feat:New featurefix:Bug fixdocs:Documentation changesstyle:Code style changes (formatting, etc.)refactor:Code refactoringtest:Adding or updating testschore:Maintenance tasks
- Follow existing code formatting
- Use meaningful variable names
- Comment complex logic
- Write descriptive commit messages
- Update documentation for new features


