Skip to content

quangxuan98765/data-processing-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

38 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🏒 DataProcessingAPI - Enterprise Business Management System

Enterprise .NET 8 Web API with JWT Authentication & Power Platform Integration

πŸš€ Overview

DataProcessingAPI is an enterprise-grade .NET 8 Web API built with Clean Architecture principles for comprehensive business data management. Features JWT authentication, reusable authentication library, and dual API architecture for enterprise scalability.

✨ Key Features

  • πŸ” JWT Authentication - Secure token-based authentication with BCrypt password hashing
  • πŸ“š Reusable AuthLibrary - Standalone authentication library for code reuse
  • πŸ—οΈ Enterprise Architecture - Separate Auth & Financial API documentation
  • πŸ’° Financial Management - Secure revenue and expense tracking with authorization
  • πŸ”„ CRUD Operations - Complete data management with proper security
  • πŸ“Š Excel Integration - Bulk import/export with Power Automate
  • βœ… Data Validation - Multi-layer validation with business rules
  • πŸ›‘οΈ Security - JWT tokens, [Authorize] attributes, SQL injection protection
  • πŸ”— Power Platform - Custom Connectors for Power Apps and Power Automate
  • πŸ“ˆ Scalable - Modular design for easy domain extensions

πŸ› οΈ Technology Stack

  • .NET 8 - Latest LTS framework
  • ASP.NET Core - Web API with dual Swagger documentation
  • SQL Server - Database with stored procedures
  • JWT Authentication - Secure token-based auth with BCrypt
  • AuthLibrary - Reusable authentication components
  • Clean Architecture - Domain-driven design pattern
  • Dependency Injection - Built-in .NET Core DI
  • Power Platform - Custom Connectors for enterprise integration

πŸ—οΈ Project Structure

DataProcessingAPI/
β”œβ”€β”€ AuthLibrary/              # Reusable JWT + BCrypt authentication library
β”‚   β”œβ”€β”€ Models/               # User, token models
β”‚   β”œβ”€β”€ DTOs/                 # Request/response DTOs
β”‚   β”œβ”€β”€ Services/             # Auth, password, token services
β”‚   β”œβ”€β”€ Interfaces/           # Service contracts
β”‚   └── SQL/                  # Database stored procedures
β”œβ”€β”€ DataAccess/               # Database service layer
β”œβ”€β”€ DataProcessingAPI/        # Main API project
β”‚   β”œβ”€β”€ Controllers/
β”‚   β”‚   β”œβ”€β”€ Auth/             # Authentication endpoints
β”‚   β”‚   └── Financial/        # Financial management (protected)
β”‚   β”œβ”€β”€ Application/          # Business logic
β”‚   β”œβ”€β”€ Domain/               # Domain entities
β”‚   └── Shared/               # Common utilities
└── publish/                  # IIS deployment artifacts

🎯 API Architecture

πŸ” Authentication API (Auth Group)

  • POST /api/auth/login - User authentication with JWT token
  • POST /api/auth/register - New user registration
  • POST /api/auth/logout - Token revocation
  • POST /api/auth/change-password - Secure password updates
  • GET /api/auth/profile - Get user profile

πŸ’° Financial API (Financial Group) - πŸ”’ JWT Protected

Revenue Management

  • GET /api/revenue - Get all revenue records
  • GET /api/revenue/{id} - Get specific revenue by ID
  • POST /api/revenue - Create new revenue record
  • PUT /api/revenue/{id} - Update existing revenue
  • DELETE /api/revenue/{id} - Delete revenue record
  • POST /api/revenue/bulk-import - Excel bulk import with validation

Expense Management

  • GET /api/expense - Get all expense records
  • GET /api/expense/{id} - Get specific expense by ID
  • POST /api/expense - Create new expense record
  • PUT /api/expense/{id} - Update existing expense
  • DELETE /api/expense/{id} - Delete expense record
  • POST /api/expense/bulk-import - Excel bulk import with validation

πŸš€ Future Extensions

  • HR Management - Employee and payroll systems
  • Inventory - Stock and product management
  • Accounting - Ledger and financial reporting

πŸš€ Quick Start

# Clone repository
git clone https://github.com/quangxuan98765/excel-data-processing-api

# Navigate to project
cd DataProcessingAPI

# Setup database (run SQL scripts)
# 1. Run AuthLibrary/SQL/AuthStoredProcedures.sql
# 2. Configure connection string in appsettings.json

# Configure JWT settings in appsettings.json
{
  "JwtSettings": {
    "SecretKey": "YourSecretKey32CharactersMinimum!",
    "Issuer": "DataProcessingAPI",
    "Audience": "DataProcessingAPI",
    "ExpiryMinutes": 60
  }
}

# Run the API
dotnet run

Swagger Documentation:

  • Auth API: https://localhost:7xxx/swagger-auth
  • Financial API: https://localhost:7xxx/swagger-financial

πŸ” Authentication Flow

  1. Register/Login β†’ Get JWT token
  2. Include token in Authorization header: Bearer <token>
  3. Access protected endpoints (Financial APIs require authentication)
# Login
POST /api/auth/login
{ "username": "admin", "password": "Password123!" }

# Use token for protected endpoints
GET /api/expense
Authorization: Bearer <your-jwt-token>

πŸ“Š Enterprise DTOs & Clean Architecture

Request/Response Pattern

// API Request DTOs (Client β†’ Server)
CreateRevenueRequest    // POST /api/revenue
UpdateRevenueRequest    // PUT /api/revenue/{id}
CreateExpenseRequest    // POST /api/expense  
UpdateExpenseRequest    // PUT /api/expense/{id}

// API Response DTOs (Server β†’ Client)
RevenueResponse        // GET operations
ExpenseResponse        // GET operations

// Import DTOs (Excel β†’ API)
RevenueImportDto       // Bulk import from Excel
ExpenseImportDto       // Bulk import from Excel

Benefits

  • βœ… Security: Request DTOs prevent ID/timestamp manipulation
  • βœ… Validation: Separate validation rules for create vs update
  • βœ… Documentation: Clear API contracts in Swagger
  • βœ… Maintainability: Easy to extend without breaking changes

πŸ“Š API Endpoints

Authentication Endpoints

POST /api/auth/login                        # User login with JWT token
POST /api/auth/register                     # New user registration  
POST /api/auth/logout                       # Token revocation
POST /api/auth/change-password              # Password updates
GET  /api/auth/profile                      # Get user profile

Financial Endpoints (πŸ”’ JWT Required)

# Revenue Management
GET    /api/revenue                         # Get all revenue records
GET    /api/revenue/{id}                    # Get revenue by ID
POST   /api/revenue                         # Create new revenue
PUT    /api/revenue/{id}                    # Update revenue
DELETE /api/revenue/{id}                    # Delete revenue
POST   /api/revenue/bulk-import             # Excel bulk import

# Expense Management  
GET    /api/expense                         # Get all expense records
GET    /api/expense/{id}                    # Get expense by ID
POST   /api/expense                         # Create new expense
PUT    /api/expense/{id}                    # Update expense
DELETE /api/expense/{id}                    # Delete expense
POST   /api/expense/bulk-import             # Excel bulk import

πŸ”— Power Platform Integration

Custom Connectors

  • Financial Data API Connector - Complete CRUD operations with JWT authentication
  • Swagger-based Definition - Auto-generated from API documentation
  • Request/Response DTOs - Clean API contracts for Power Platform

Power Apps Integration

  • JWT Authentication Flow - Secure login with token management
  • Financial Data Management - Full CRUD operations with proper authorization
  • Form Validation - Client-side + server-side validation
  • Data Binding - Clean Response DTOs for easy Power Apps binding

Power Automate Flows

  • Excel Data Import - Bulk processing with validation and error handling
  • Automated Workflows - Scheduled data processing and reporting
  • Error Handling - Comprehensive error logging and retry mechanisms

Integration Benefits

  • βœ… Type Safety - Strongly typed Request/Response DTOs
  • βœ… Error Handling - Structured error responses
  • βœ… Security - JWT authentication for all protected endpoints
  • βœ… Scalability - Enterprise-grade API design patterns

πŸ“„ License

MIT License - see LICENSE file for details.

πŸ“ž Contact

Developer: Quang XuΓ’n
Email: [email protected]
GitHub: @quangxuan98765


⭐ Professional .NET development with Clean Architecture principles

About

ASP.NET Core Web API for Excel Data Processing & Bulk Database Operations

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published