AI-Powered Document Security & Fraud Detection Platform
Advanced document scanning that detects malicious activity line by line. Keep your data safe with intelligent threat detection.
- Overview
- Features
- Architecture
- Tech Stack
- Prerequisites
- Installation
- Configuration
- Running the Application
- Project Structure
- Testing
- API Documentation
- Contributing
- License
- Authors
Fylex is a comprehensive AI-powered document security platform designed to protect users from fraud and malicious content in documents. The platform analyzes PDFs, contracts, emails, and other text-based documents using advanced AI models to detect:
- Phishing attempts
- Lottery scams
- Financial manipulation
- Impersonation
- Other fraudulent activities
The system provides detailed risk assessments with line-by-line analysis, highlighting suspicious content and assigning risk levels (High, Medium, Low) to help users make informed decisions about document safety.
- Line-by-line document analysis - Deep scanning of every sentence and element
- Multi-risk detection - Identifies various types of fraud and threats
- Risk level assessment - Categorizes threats as High, Medium, or Low
- Detailed explanations - Provides context for each detected risk
- Fast processing - Get security reports in seconds
- OAuth authentication - Sign in with Google or GitHub
- User dashboard - Monitor document security and analysis history
- Document management - Upload, view, and manage analyzed documents
- Statistics tracking - View total scans, threats detected, and clean documents
- Profile management - Customize your profile with picture upload
- Real-time analysis - Instant document processing
- Secure file storage - Cloudinary integration for document storage
- JWT authentication - Secure token-based authentication
- WebSocket support - Real-time communication capabilities
- Rate limiting - API protection against abuse
Fylex follows a microservices architecture with three main components:
βββββββββββββββββββ
β Client (UI) β Next.js 15 + React 19 + shadcn/ui + Radix UI
β Port: 3000 β
ββββββββββ¬βββββββββ
β HTTP/REST
β
ββββββββββΌβββββββββ
β Server (API) β Spring Boot 3.5.5 + PostgreSQL
β Port: 8000 β
ββββββββββ¬βββββββββ
β HTTP/REST
β
ββββββββββΌβββββββββ
β Model (AI) β FastAPI + OpenAI/HuggingFace
β Port: 7000 β
βββββββββββββββββββ
- Client: User interface, authentication, document upload, dashboard, and visualization
- Server: Business logic, database management, authentication, file processing, API orchestration
- Model: AI-powered document analysis, fraud detection, risk assessment
- Framework: Next.js 15.5.9
- UI Library: React 19.1.1
- Styling: Tailwind CSS + shadcn/ui
- Language: TypeScript 5.9.3
- Authentication: OAuth (Google, GitHub)
- Testing: Vitest 4.0.15
- Build Tool: Next.js built-in
- Framework: Spring Boot 3.5.5
- Language: Java 17
- Database: PostgreSQL
- Security: Spring Security + JWT
- File Processing: Apache Tika 2.9.2
- Storage: Cloudinary
- Build Tool: Maven
- WebSocket: Spring WebSocket
- Framework: FastAPI 0.116.1
- Language: Python 3.13
- AI Provider: HuggingFace (Llama 3.3 70B)
- Rate Limiting: SlowAPI
- HTTP Client: httpx
- Containerization: Docker & Docker Compose
- Web Server: Nginx (production)
- Version Control: Git
Before you begin, ensure you have the following installed:
- Node.js 20+ and npm
- Java 17+
- Maven 3.6+
- Python 3.13+
- Docker and Docker Compose (recommended)
- PostgreSQL 12+ (if not using Docker)
- HuggingFace API Token (for AI model access)
- Cloudinary Account (for file storage)
- Google OAuth Credentials
- GitHub OAuth Credentials
-
Clone the repository
git clone <repository-url> cd Fylex
-
Set up environment variables
- Create
.envfiles in each service directory (see Configuration)
- Create
-
Build and run with Docker Compose
docker-compose up --build
The application will be available at:
- Client: http://localhost:3000
- Server API: http://localhost:8000
- Model API: http://localhost:7000
cd client
npm install
npm run devcd server
mvn clean install
mvn spring-boot:runcd model
pip install -r requirements.txt
fastapi run app/api.py --port 8000Create client/.env:
SERVER_BASE_URL=http://localhost:8000/api
NEXT_PUBLIC_GOOGLE_CLIENT_ID=your-google-client-id
NEXT_PUBLIC_GITHUB_CLIENT_ID=your-github-client-idCreate server/.env:
# Application
SPRING_APPLICATION_NAME=server
# Database
SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/fylex
SPRING_DATASOURCE_USERNAME=your-db-username
SPRING_DATASOURCE_PASSWORD=your-db-password
# JWT
JWT_SECRET=your-jwt-secret-key
EXPIRATIONMS=86400000
# OAuth
CLIENT_ID_GOOGLE=your-google-client-id
# Cloudinary
CLOUDINARY_CLOUD_NAME=your-cloud-name
CLOUDINARY_API_KEY=your-api-key
CLOUDINARY_API_SECRET=your-api-secret
# CORS
ALLOWED_ORIGINS=http://localhost:3000Create model/.env:
BASE_URL_HUGINGFACE=https://api-inference.huggingface.co/v1
HF_TOKEN=your-huggingface-token
CORS_ALLOWED_ORIGINS=http://localhost:8000Client:
cd client
npm run devServer:
cd server
mvn spring-boot:runModel:
cd model
fastapi run app/api.py --port 8000Client:
cd client
npm run build
npm startServer:
cd server
mvn clean package
java -jar target/server-0.0.1-SNAPSHOT.jarFylex/
βββ client/ # Next.js frontend application
β βββ src/
β β βββ app/ # Next.js app router pages
β β βββ components/ # React components
β β βββ actions/ # Server actions
β β βββ services/ # Business logic services
β β βββ infrastructure/ # External API clients
β β βββ types/ # TypeScript type definitions
β β βββ utils/ # Utility functions
β βββ public/ # Static assets
β βββ tests/ # Test files
β
βββ server/ # Spring Boot backend application
β βββ src/
β β βββ main/
β β βββ java/ # Java source code
β β βββ resources/ # Configuration files
β βββ pom.xml # Maven dependencies
β
βββ model/ # FastAPI AI service
β βββ app/
β β βββ api.py # FastAPI application
β β βββ script.py # AI analysis logic
β β βββ base.py # Data models
β βββ requirements.txt # Python dependencies
β
βββ docker-compose.yml # Docker orchestration
The client includes comprehensive test coverage:
cd client
# Run all tests
npm test
# Run tests with UI
npm run test:ui
# Run tests with coverage
npm run test:coverage
# Run tests once
npm run test:runTest Coverage:
- Unit tests for services, actions, infrastructure, and utilities
- Integration tests for authentication, document upload, and error handling
- Middleware tests
cd server
mvn testPOST /ml/service/analysis
- Analyzes document text for fraud detection
- Rate limit: 5 requests per minute
- Request body:
{ "text": "document content" } - Response: Analysis results with risk levels and explanations
The server provides RESTful endpoints for:
- Authentication (login, register, OAuth)
- Document management (upload, list, view)
- User profile management
- Statistics and analytics
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please ensure your code:
- Follows the existing code style
- Includes tests for new features
- Updates documentation as needed
- Passes all existing tests
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2025 Nefara (Owners Dimitar Anastasov, Martin Velchev)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction...
Nefara
- Dimitar Anastasov
- Martin Velchev
- Built with Next.js
- Powered by Spring Boot
- AI analysis via HuggingFace
- UI components from shadcn/ui and Radix UI
