This project is a NestJS application designed to process CSV uploads with multiple levels of validation and checks. It's using MinIO for storage and PostgreSQL for data management.
- CSV file upload and processing
- Multi-level validation of CSV data
- Integration with MinIO for file storage
- PostgreSQL for data persistence
-
Clone the repository:
git clone https://github.com/yourusername/nestjs-csv-processor.git cd nestjs-csv-processor
-
Install dependencies:
npm install
-
Set up environment variables:
- Create a
.env
file in the root directory and configure your environment variables.
- Create a
To start the application, run:
npm run start
To run the tests, use:
npm run test
To run the application using Docker, execute:
docker-compose up
Purpose: Validate file integrity and basic structure.
Key Verifications:
- File Extension Validation (e.g.,
.csv
only) - File Size Check (Reject excessively large files)
- Non-Empty File Verification
- Encoding Detection (e.g., UTF-8, ASCII)
Purpose: Ensure data format and schema compliance.
Key Verifications:
- Header/Column Validation
- Expected column names
- Column count matching
- Data Type Checks
- Numbers, dates, emails, etc.
- Required Fields (Non-empty critical columns)
- Delimiter Consistency (Commas, semicolons)
- Row Length Uniformity (All rows have same columns)
Purpose: Enforce security and business rules.
Key Verifications:
- Security Scans
- Malicious scripts/HTML tags
- SQL/code injection patterns
- Business Logic Validation
- Value ranges (e.g., "Price > 0")
- Cross-field dependencies (e.g., "End date > Start date")
- Data Consistency
- Foreign key references (e.g., "User ID exists in database")
- Duplicate entry detection
- Compliance Checks
- PII masking (e.g., GDPR-compliant emails)
- Regulatory formatting (e.g., ISO date standards)
Level | Focus Area | Example Checks |
---|---|---|
Basic | File Integrity | Extension, size, non-empty |
Moderate | Data Structure | Headers, data types, required fields |
Advanced | Security & Business | Injection scans, business rules, compliance |
This project is licensed under the MIT License. See the LICENSE file for details.