AI-powered business process analysis REST API | Analyze business processes and get intelligent recommendations for automation and optimization using Claude AI.
- Overview
- Features
- Tech Stack
- Architecture
- Getting Started
- API Documentation
- Testing
- Deployment
- Project Structure
- Contributing
- License
The Process Analyzer API is a production-ready .NET 8 REST API that leverages AI (Claude) to analyze business processes. Users submit process descriptions, and the API returns:
- Bottlenecks: Identified pain points and inefficiencies
- Suggestions: Practical automation solutions
- Priority Score: Urgency rating (1-10)
This project demonstrates enterprise-level .NET development practices including:
- Clean Architecture & SOLID principles
- JWT Authentication & Security
- Comprehensive Testing
- Docker Containerization
- CI/CD Pipeline
- Structured Logging
- API Documentation
- ✅ AI-powered process analysis using Claude API
- ✅ RESTful API with OpenAPI/Swagger documentation
- ✅ SQLite database with Entity Framework Core
- ✅ Data persistence and retrieval
- ✅ JWT Bearer Authentication
- ✅ Rate Limiting (60 requests/minute)
- ✅ CORS Configuration
- ✅ Global Exception Handling
- ✅ Input Validation (FluentValidation)
- ✅ Structured Logging (Serilog)
- ✅ Pagination & Filtering
- ✅ Sorting (by priority, date, ID)
- ✅ Health Check Endpoints
- ✅ Comprehensive Error Responses
- ✅ Docker Support
- ✅ Docker Compose for local development
- ✅ GitHub Actions CI/CD Pipeline
- ✅ Environment-based Configuration
| Category | Technology |
|---|---|
| Framework | .NET 8.0 |
| Language | C# 12 |
| Web Framework | ASP.NET Core Web API |
| ORM | Entity Framework Core 8.0 |
| Database | SQLite |
| Authentication | JWT Bearer Tokens |
| Validation | FluentValidation |
| Logging | Serilog |
| Testing | xUnit, Moq, ASP.NET Core Testing |
| Documentation | Swagger/OpenAPI |
| Containerization | Docker |
┌─────────────┐
│ Client │
│ (Browser/ │
│ Mobile) │
└──────┬──────┘
│ HTTP/REST
▼
┌─────────────────────────────────┐
│ ASP.NET Core API │
│ ┌──────────────────────────┐ │
│ │ Controllers Layer │ │
│ │ - AnalysisController │ │
│ │ - AuthController │ │
│ └───────────┬───────────────┘ │
│ │ │
│ ┌───────────▼───────────────┐ │
│ │ Services Layer │ │
│ │ - AnalysisService │ │
│ │ - LlmService │ │
│ │ - AuthService │ │
│ └───────────┬───────────────┘ │
│ │ │
│ ┌───────────▼───────────────┐ │
│ │ Data Layer │ │
│ │ - AppDbContext │ │
│ │ - ProcessAnalysis Entity │ │
│ └───────────┬───────────────┘ │
└──────────────┼───────────────────┘
│
┌───────▼────────┐
│ SQLite DB │
└────────────────┘
│
┌───────▼────────┐
│ Claude API │
│ (External) │
└────────────────┘
- Client sends HTTP request to API endpoint
- Middleware processes request (authentication, rate limiting, CORS)
- Controller receives request and validates input
- Service handles business logic
- LLM Service calls Claude API for analysis
- Database persists analysis results
- Response returned to client with analysis data
- Repository Pattern: Data access abstraction via DbContext
- Dependency Injection: All services registered in Program.cs
- Middleware Pattern: Global exception handling, rate limiting
- DTO Pattern: Separation of API contracts from domain models
- Strategy Pattern: LLM service abstraction for different providers
- .NET 8.0 SDK
- Docker (optional)
- Claude API Key from Anthropic Console
git clone https://github.com/aymandakir/process-analyzer-api.git
cd process-analyzer-api/ProcessAnalyzerApiEdit appsettings.Development.json:
{
"LlmSettings": {
"ApiKey": "your-claude-api-key-here"
}
}dotnet ef database updatedotnet runThe API will be available at:
- HTTP:
http://localhost:5043 - HTTPS:
https://localhost:7052 - Swagger UI:
http://localhost:5043(root)
docker-compose up -dThe API will be available at http://localhost:8080
docker build -t process-analyzer-api .
docker run -p 8080:8080 \
-e LlmSettings__ApiKey=your-api-key \
process-analyzer-apiPOST /api/auth/login
Content-Type: application/json
{
"username": "admin",
"password": "admin123"
}Response:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresAt": "2024-12-22T12:00:00Z"
}POST /api/analysis/analyze
Authorization: Bearer {token}
Content-Type: application/json
{
"processDescription": "Our employee onboarding process involves HR manually creating accounts in 8 different systems..."
}Response:
{
"id": 1,
"inputDescription": "Our employee onboarding process...",
"bottlenecks": "Manual account creation across multiple systems creates delays...",
"suggestions": "Implement SSO solution, use automation tools like Zapier...",
"priorityScore": 9,
"createdAt": "2024-12-20T12:00:00Z"
}GET /api/analysis/analyses?page=1&pageSize=10&minPriority=5&sortBy=priority&sortDescending=trueQuery Parameters:
page(int): Page number (default: 1)pageSize(int): Items per page (default: 10, max: 100)minPriority(int?): Minimum priority filtermaxPriority(int?): Maximum priority filterfromDate(DateTime?): Filter from datetoDate(DateTime?): Filter to datesortBy(string): Sort field (id, priority, date)sortDescending(bool): Sort direction
Response:
{
"items": [...],
"page": 1,
"pageSize": 10,
"totalCount": 25,
"totalPages": 3,
"hasPreviousPage": false,
"hasNextPage": true
}GET /api/analysis/analyses/{id}GET /healthdotnet testdotnet test /p:CollectCoverage=trueTests/
├── AnalysisServiceTests.cs # Unit tests for AnalysisService
└── (More tests can be added)
| Variable | Description | Required |
|---|---|---|
LlmSettings__ApiKey |
Claude API key | Yes |
JwtSettings__SecretKey |
JWT signing key (min 32 chars) | Yes |
ConnectionStrings__DefaultConnection |
Database connection string | Yes |
ASPNETCORE_ENVIRONMENT |
Environment (Development/Production) | No |
- Connect GitHub repository to Railway
- Set environment variables
- Deploy automatically on push to main
- Create new Web Service
- Connect GitHub repository
- Set build command:
dotnet publish -c Release -o ./publish - Set start command:
dotnet ./publish/ProcessAnalyzerApi.dll - Configure environment variables
ProcessAnalyzerApi/
├── Controllers/ # API endpoints
│ ├── AnalysisController.cs
│ └── AuthController.cs
├── Services/ # Business logic
│ ├── IAnalysisService.cs
│ ├── AnalysisService.cs
│ ├── ILlmService.cs
│ ├── LlmService.cs
│ ├── IAuthService.cs
│ └── AuthService.cs
├── Models/ # Domain entities
│ └── ProcessAnalysis.cs
├── DTOs/ # Data transfer objects
│ ├── AnalyzeRequestDto.cs
│ ├── AnalysisResponseDto.cs
│ ├── LoginRequestDto.cs
│ ├── LoginResponseDto.cs
│ ├── LlmResponseDto.cs
│ └── PagedResultDto.cs
├── Data/ # Data access
│ └── AppDbContext.cs
├── Middleware/ # Custom middleware
│ └── GlobalExceptionHandlerMiddleware.cs
├── Validators/ # FluentValidation rules
│ └── AnalyzeRequestDtoValidator.cs
├── Migrations/ # EF Core migrations
├── Tests/ # Unit & integration tests
│ └── AnalysisServiceTests.cs
├── Program.cs # Application entry point
├── appsettings.json # Configuration
├── Dockerfile # Docker configuration
├── docker-compose.yml # Docker Compose config
└── README.md # This file
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 amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Claude AI for AI capabilities
- .NET Foundation for the amazing framework
- All open-source contributors
Built with ❤️ using .NET 8