- package.json - Dependencies, scripts, project metadata
- tsconfig.json - TypeScript compiler configuration
- jest.config.js - Jest testing framework configuration
- .prettierrc - Code formatting rules
- .eslintrc.json - Linting rules and code quality
- .npmrc - NPM configuration
- .nodemonrc.json - Nodemon configuration for development
- Dockerfile - Docker container configuration (multi-stage build)
- docker-compose.yml - Docker Compose for containerized deployment
- .dockerignore - Files to exclude from Docker image
- .env - Local environment variables (not committed)
- .env.example - Template for environment variables
- .gitignore - Git ignore patterns
- README.md - Complete API documentation and setup guide
- QUICKSTART.md - Quick start guide for getting the API running
- DEPLOYMENT.md - Comprehensive deployment guide for multiple platforms
- PROJECT_SUMMARY.md - This file
- index.ts - Server entry point, graceful shutdown handling
- app.ts - Express app configuration, middleware setup, route mounting
- index.ts - Environment variables and app configuration loading
- constants.ts - API constants, risk thresholds, rate limits, security settings
- errorHandler.ts - Global error handling, custom error class, 404 handler
- rateLimiter.ts - Rate limiting middleware (100 req/15min per IP)
- validator.ts - Request validation middleware using Zod schemas
- index.ts - Route aggregation, mounts all endpoints under /api/v1
- health.ts - GET /api/v1/health - Health check endpoint
- urlScanner.ts - POST /api/v1/scan/url - URL security scanning
- domainChecker.ts - POST /api/v1/scan/domain - Domain analysis/phishing detection
- password.ts - POST /api/v1/check/password - Password strength analysis
- breach.ts - POST /api/v1/check/email-breach - Email breach checking
- securityHeaders.ts - HTTP security headers analysis and validation
- sslChecker.ts - SSL/TLS certificate validation and HTTPS checking
- domainAnalysis.ts - Phishing detection, typosquatting analysis
- passwordAnalyzer.ts - Password strength, entropy, crack-time estimation
- breachChecker.ts - HaveIBeenPwned API integration
- scoring.ts - Risk scoring algorithms, risk level determination, password entropy
- validators.ts - Input validation with Zod, URL/domain/email/password validators
- logger.ts - Winston logger setup with console and file transports
- index.ts - Shared TypeScript interfaces (HealthCheck, SSLInfo, RiskAssessment)
- requests.ts - Request body type definitions
- responses.ts - Response type definitions (all API responses are typed)
- setup.ts - Jest configuration and global test setup
- urlScanner.test.ts - URL scanner route tests
- password.test.ts - Password analyzer tests and analysis function tests
Entry Point
↓
index.ts (Server startup)
↓
app.ts (Express configuration)
├→ middleware/ (Error handling, rate limiting, validation)
├→ routes/ (All endpoints)
│ └→ services/ (Business logic)
│ └→ utils/ (Scoring, validation)
│ └→ types/ (Type definitions)
└→ config/ (Configuration)
└→ constants.ts (Settings)
| File | Purpose | Key Exports |
|---|---|---|
| index.ts | Server startup & graceful shutdown | N/A |
| app.ts | Express app setup | createApp() |
| config/index.ts | Load environment variables | config object |
| config/constants.ts | API constants and thresholds | CONSTANTS object |
| middleware/errorHandler.ts | Global error handling | errorHandler, notFoundHandler, AppError |
| middleware/rateLimiter.ts | Rate limiting | apiLimiter |
| middleware/validator.ts | Request validation | validateRequest() |
| routes/index.ts | Route aggregation | Express router |
| routes/health.ts | Health check | Express router |
| routes/urlScanner.ts | URL scanning | Express router |
| routes/domainChecker.ts | Domain analysis | Express router |
| routes/password.ts | Password analysis | Express router |
| routes/breach.ts | Breach checking | Express router |
| services/securityHeaders.ts | Header analysis | fetchSecurityHeaders(), analyzeSecurityHeaders() |
| services/sslChecker.ts | SSL validation | getSSLCertificateInfo(), validateSSLCertificate() |
| services/domainAnalysis.ts | Phishing/domain analysis | checkTyposquatting(), analyzeDomainReputation() |
| services/passwordAnalyzer.ts | Password analysis | analyzePassword(), getPasswordRecommendations() |
| services/breachChecker.ts | Breach checking | checkEmailBreach(), checkPasswordBreach() |
| utils/scoring.ts | Risk scoring | calculateRiskScore(), scorePasswordStrength() |
| utils/validators.ts | Input validation | Zod schemas, validation functions |
| utils/logger.ts | Logging setup | logger instance |
| types/index.ts | Shared types | Interfaces and types |
| types/requests.ts | Request types | Request body interfaces |
| types/responses.ts | Response types | Typed API responses |
- Total Files: 37 (config + src + tests + root)
- TypeScript Files: 27
- Configuration Files: 10
- Test Files: 3
- Documentation Files: 3
- Edit Source Files: Modify files in
src/ - Nodemon Watches: Changes trigger automatic rebuild
- TypeScript Compiles:
src/→dist/ - Server Restarts: Automatically with nodemon
- Test Changes: Run tests with
npm test - Lint & Format:
npm run lint:fixandnpm run format
- TypeScript Compilation:
npm run build- Compiles
src/**/*.ts→dist/**/*.js
- Compiles
- Dependency Installation: Production only
- Environment Setup: Set production environment variables
- Server Start:
npm startrunsdist/index.js
All API responses follow this standardized format:
{
success: boolean;
data?: {
// Endpoint-specific data
};
error?: {
code: string;
message: string;
};
timestamp: string; // ISO 8601 format
}- Test Files: Located in
tests/directory - Pattern:
*.test.tsfiles - Framework: Jest with ts-jest preset
- Coverage: Can be generated with
npm test -- --coverage
For detailed documentation, see README.md and DEPLOYMENT.md.