Skip to content

This API simulates a real-world background file processing service. CSV files uploaded by authenticated users are queued and processed line by line using a background service. This architecture showcases common backend engineering patterns.

Notifications You must be signed in to change notification settings

Voidcoolis/CvsProcessorAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“„ CSV Processor API

A background file processor built with ASP.NET Core Web API. Users can upload CSV files which are then validated and processed asynchronously via a background worker. The system supports multiple file uploads, error handling, logging to file, authentication with JWT, and a summary endpoint for tracking file statistics.

πŸš€ Features

  • βœ… Upload single or multiple CSV files
  • βœ… JWT Authentication for secure endpoints
  • πŸ”„ Background processing via BackgroundService
  • βœ… CSV validation
  • 🚨 Error tracking for invalid lines
  • πŸ“Š /api/stats endpoint for summary
  • πŸ“ File-based logging using Serilog
  • πŸ” JWT Authentication for all endpoints
  • 🧹 Auto-cleanup every 6 hours for files older than 24h

πŸ“¦ Tech Stack

  • C# (.NET 8)
  • ASP.NET Core Web API
  • Background Services
  • Swagger / Swashbuckle
  • In-Memory Queues
  • Serilog File Logging
  • JWT Authentication

πŸ” Authentication

This API uses JWT bearer authentication for simplicity.

πŸ§ͺ Testing With Postman or Swagger

  • Username : admin
  • Password: password123
  1. Use any JWT generator
  2. Use this secret key: super-secret-token-key
  3. Add token to Authorization header:

πŸ§ͺ API Endpoints

Upload

  • POST /api/fileupload
    Upload a single CSV

  • POST /api/fileupload/multiple
    Upload multiple files

Stats

  • GET /api/stats
    Returns:
{
 "FilesProcessed": 2,
 "ErrorLines": [
   "[File: C:\\Temp\\file.csv] Name,,35"
 ]
}

About

This API simulates a real-world background file processing service. CSV files uploaded by authenticated users are queued and processed line by line using a background service. This architecture showcases common backend engineering patterns.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages