-
-
Notifications
You must be signed in to change notification settings - Fork 0
Projects.md
This document describes each project in the OpenCashFlow solution, their responsibilities, and how they interact.
OpenCashFlow.sln
├── src/
│ ├── OpenCashFlow.App/ # Web application (MVC)
│ ├── OpenCashFlow.API/ # REST API
│ ├── OpenCashFlow.Admin/ # Admin panel
│ └── OpenCashFlow.Shared/ # Shared library
└── tests/
└── OpenCashFlow.Test/ # Test project
Type: ASP.NET Core MVC Web Application Port: 7001 (HTTPS) Purpose: User-facing web interface
- Render Razor views with Tabler UI
- Handle user authentication flows (login, register, password reset)
- Serve static assets (CSS, JavaScript, images)
- Make AJAX calls to the API for data operations
- Manage user sessions via cookies
OpenCashFlow.App/
├── Controllers/ # MVC controllers
│ ├── HomeController.cs # Authentication pages
│ ├── PaymentController.cs # Payment views
│ ├── CompanyController.cs # Company management
│ └── BillingController.cs # Subscription UI
├── Views/ # Razor views
│ ├── Shared/
│ │ ├── _Layout.cshtml # Master layout
│ │ └── _LoginLayout.cshtml # Auth pages layout
│ ├── Home/ # Auth views
│ ├── Payment/ # Payment views
│ └── _Partials/ # Reusable components
├── ViewModels/ # View-specific models
├── ViewComponents/ # Reusable view components
├── wwwroot/ # Static files
│ ├── css/ # Custom styles
│ ├── js/ # Custom JavaScript
│ ├── libs/ # Third-party libraries
│ └── vendor/tabler/ # Tabler framework
├── AppStart/ # Startup configuration
└── Program.cs # Application entry point
{
"Account": {
"CookieDomain": ".opencashflow.local",
"API": "https://api.opencashflow.local",
"AppUrl": "https://app.opencashflow.local/"
}
}- References
OpenCashFlow.Shared - Communicates with
OpenCashFlow.APIvia HTTP
Type: ASP.NET Core Web API Port: 7002 (HTTPS) Purpose: RESTful backend services
- Expose REST endpoints for all data operations
- Handle JWT authentication and authorization
- Process Stripe webhooks
- Implement business logic via services
- Validate incoming requests
OpenCashFlow.API/
├── Controllers/ # API controllers
│ ├── v1/
│ │ ├── AuthenticationController.cs
│ │ ├── PaymentController.cs
│ │ ├── CompanyController.cs
│ │ ├── EmployeeController.cs
│ │ └── BillingController.cs
├── AppStart/ # Startup configuration
│ ├── 00_Logging.cs
│ ├── 01_Configuration.cs
│ ├── 02_Services.cs
│ └── 03_Authentication.cs
├── Middlewares/ # Custom middleware
│ └── SubscriptionAuthorizationMiddleware.cs
├── Filters/ # Action filters
└── Program.cs # Application entry point
Routes follow the pattern: v{version:apiVersion}/[controller]
[ApiController]
[ApiVersion("1.0")]
[Route("v{version:apiVersion}/[controller]")]
public class PaymentController : ControllerBase
{
[HttpGet]
public async Task<IActionResult> GetAll() { }
[HttpGet("{id}")]
public async Task<IActionResult> GetById(Guid id) { }
[HttpPost]
public async Task<IActionResult> Create([FromBody] Payment_Create_DTO dto) { }
}- User submits credentials to
/v1/Authentication/login - API validates credentials and generates JWT token
- Token is returned and stored in HTTP-only cookie
- Subsequent requests include the cookie automatically
- API validates token on each request
| Endpoint | Method | Description |
|---|---|---|
/v1/Authentication/login |
POST | User login |
/v1/Authentication/register |
POST | User registration |
/v1/Authentication/refresh-token |
POST | Refresh JWT token |
/v1/Payment |
GET | List payments |
/v1/Payment/{id} |
GET | Get payment by ID |
/v1/Payment |
POST | Create payment |
/v1/Payment/{id} |
PUT | Update payment |
/v1/Payment/{id} |
DELETE | Soft delete payment |
/v1/Company |
GET/POST/PUT | Company CRUD |
/v1/Billing/webhook |
POST | Stripe webhook handler |
Type: ASP.NET Core MVC Web Application Port: 7003 (HTTPS) Purpose: System administration
- Manage system-wide settings
- View audit logs across all tenants
- Monitor system health
- Manage plans and subscriptions
- User administration
- Cross-tenant data access (admin only)
- Audit log viewer
- Subscription management
- System configuration
Admin users require the GIManagers role, which is a hidden system role not assignable through normal UI.
Type: .NET Class Library Purpose: Shared code across all projects
- Define database entities (models)
- Provide DTOs for API contracts
- Implement services and repositories
- Configure Entity Framework Core
- Define enumerations and constants
- Provide AutoMapper profiles
OpenCashFlow.Shared/
├── Data/
│ ├── ApplicationDbContext.cs # EF Core DbContext
│ ├── Migrations/ # Database migrations
│ └── Seeding/ # Seed data
├── Models/ # Entity definitions
│ ├── Payment.cs
│ ├── Company.cs
│ ├── AspNetUser.cs
│ └── ...
├── DTOs/ # Data Transfer Objects
│ ├── Payment_Create_DTO.cs
│ ├── Payment_List_DTO.cs
│ └── ...
├── Services/ # Business logic
│ ├── Interfaces/
│ ├── PaymentService.cs
│ ├── CompanyService.cs
│ └── EmailService.cs
├── Repositories/ # Data access
│ ├── Interfaces/
│ ├── PaymentRepository.cs
│ └── CompanyRepository.cs
├── Enums/ # Enumerations
│ ├── Permissions.cs
│ ├── GenderTypes.cs
│ └── EntryTypes.cs
├── Mappings/ # AutoMapper profiles
│ └── MappingProfile.cs
└── Helpers/ # Utility classes
├── Configuration.cs
└── JwtHelper.cs
public class ApplicationDbContext : DbContext
{
// Identity
public DbSet<AspNetUser> AspNetUser_DS { get; set; }
public DbSet<AspNetRole> AspNetRole_DS { get; set; }
public DbSet<AspNetUserRole> AspNetUserRole_DS { get; set; }
// Business entities
public DbSet<Company> Company_DS { get; set; }
public DbSet<Payment> Payment_DS { get; set; }
public DbSet<Payment_Method_LookUps> Payment_Method_LookUps_DS { get; set; }
// Billing
public DbSet<Plan> Plan_DS { get; set; }
public DbSet<Company_Subscription> Company_Subscription_DS { get; set; }
// Admin
public DbSet<Admin_AuditLog> Admin_AuditLog_DS { get; set; }
}public class Payment
{
public Guid PaymentID { get; set; }
public Guid TenantID { get; set; }
public Guid? RequestId { get; set; } // Idempotency key
public decimal Amount { get; set; }
public string EntryType { get; set; } // Income/Outcome
public string? Description { get; set; }
public int PaymentMethodID { get; set; }
public int DocumentTypeID { get; set; }
public Guid UserID { get; set; }
// Audit fields
public string CreatedBy { get; set; }
public DateTime DateIns { get; set; }
public string? EditedBy { get; set; }
public DateTime? DateEdit { get; set; }
public bool IsDeleted { get; set; }
}public class Payment_Create_DTO
{
[Required]
public decimal Amount { get; set; }
[Required]
public string EntryType { get; set; }
public string? Description { get; set; }
[Required]
public int PaymentMethodID { get; set; }
[Required]
public int DocumentTypeID { get; set; }
}
public class Payment_List_DTO
{
public Guid PaymentID { get; set; }
public decimal Amount { get; set; }
public string EntryType { get; set; }
public string? Description { get; set; }
public string PaymentMethodName { get; set; }
public DateTime CreatedAt { get; set; }
}Type: xUnit Test Project Purpose: Automated testing
- Unit Tests - Test individual services and helpers
- Integration Tests - Test API endpoints with test database
- Repository Tests - Test data access layer
OpenCashFlow.Test/
├── Unit/
│ ├── Services/
│ └── Helpers/
├── Integration/
│ ├── API/
│ └── Repositories/
├── Fixtures/ # Test data and setup
├── Helpers/ # Test utilities
└── appsettings.Test.json # Test configuration
# Run all tests
dotnet test
# Run with coverage
dotnet test --collect:"XPlat Code Coverage"
# Run specific category
dotnet test --filter "Category=Unit"OpenCashFlow.App
└── OpenCashFlow.Shared
└── HTTP → OpenCashFlow.API
OpenCashFlow.API
└── OpenCashFlow.Shared
OpenCashFlow.Admin
└── OpenCashFlow.Shared
OpenCashFlow.Test
└── OpenCashFlow.Shared
└── OpenCashFlow.API (for integration tests)
| Package | Purpose |
|---|---|
Microsoft.EntityFrameworkCore |
ORM |
Npgsql.EntityFrameworkCore.PostgreSQL |
PostgreSQL provider |
AutoMapper |
Object-object mapping |
FluentValidation |
Input validation |
| Package | Purpose |
|---|---|
Microsoft.AspNetCore.Authentication.JwtBearer |
JWT authentication |
Asp.Versioning.Mvc |
API versioning |
Swashbuckle.AspNetCore |
Swagger/OpenAPI |
Stripe.net |
Stripe integration |
| Package | Purpose |
|---|---|
Microsoft.AspNetCore.SignalR |
Real-time communication |
Polly |
Retry policies |
Project status
OpenCashFlow is under active development.
APIs, database schema, and UI may change until the first stable release.
Built with
.NET · ASP.NET Core · Entity Framework Core · PostgreSQL · Tabler
© 2026 OpenCashFlow
- Developer Preview
- Not production-ready
- First-run setup included