Projects
The solution is divided by multiple layers
:
- Domain.csproj: Models
- Application.csproj: Interfaces
- Infrastructure.csproj: Implementations
- WebApi.csproj: Controllers and ClientApp (frontend)
- UnitTests.csproj: Application and domain tests
- IntegrationTests.csproj: Infrastructure tests
Domain
It’s the most inner part of the architecture. It contains entities/models, enums…
- Models: User, Tenant...
- Enums: UserType, TenantUserRole...
- Settings: EmailSettings, SubscriptionSettings...
Application
It defines business logic, DTOs, contracts…
- DTOs: UserDto, TenantDto...
- Contracts: User, Tenant...
- Mapper: MappingProfile
- Services: IUserService, ITenantService...
- Repositories: IUserRepository, ITenantRepository...
- Unit of Work: IAppUnitOfWork, IMasterUnitOfWork...
Infrastructure
Acts as the Data Access Layer and implements all application interfaces.
- Database Context: AppDbContext, MasterDbContext...
- Middleware: ITenantResolutionStrategy, TenantMiddleware...
- Services: UserService, TenantService...
- Repositories: UserRepository, TenantRepository...
- Unit of Work: AppUnitOfWork, MasterUnitOfWork...
Web Api
The .NET API server.
- Controllers: UserController, TenantController...
- Migrations: Database migrations (with Entity Framework)
- ClientApp: Frontend application
Unit Tests
Implements Domain tests.
- Domain Unit Tests: UserTests, TenantTests
Integration Tests
Implements Infrastructre tests. It validates your Authentication and Stripe subscriptions/products and payments implementations.
- Users: AuthenticationControllerTests, UserControllerTests
- Tenants: TenantControllerTests, TenantUsersControllerTests, TenantControllerTests
- Subscriptions: SubscriptionProductControllerTests, UpdateSubscriptionTests...
Directory
Explore the directory structure:
|-- .gitignore
|-- NetcoreSaas.sln
|-- package.json
|-- .vscode
| |-- launch.json
| |-- settings.json
| |-- tasks.json
|-- src
| |-- NetcoreSaas.Application
| | |-- NetcoreSaas.Application.csproj
| | |-- Contracts
| | | |-- App
| | | | |-- Contracts
| | | | | |-- AddContractMemberDto.cs
| | | | | |-- ContractStatusFilter.cs
| | | | | |-- CreateContractRequest.cs
| | | | | |-- SendContractRequest.cs
| | | | | |-- UpdateContractRequest.cs
| | | | |-- Employees
| | | | |-- CreateEmployeesRequest.cs
| | | | |-- UpdateEmployeeRequest.cs
| | | |-- Core
| | | |-- Links
| | | | |-- CreateLinkRequest.cs
| | | | |-- UpdateLinkRequest.cs
| | | |-- Subscriptions
| | | | |-- SelectedSubscriptionRequest.cs
| | | | |-- SubscriptionCreateCardTokenRequest.cs
| | | | |-- SubscriptionGetCurrentResponse.cs
| | | | |-- SubscriptionUpdatePriceRequest.cs
| | | | |-- SubscriptionUpdateProductRequest.cs
| | | |-- Tenants
| | | | |-- TenantCreateRequest.cs
| | | | |-- TenantFeaturesDto.cs
| | | | |-- TenantInvitationResponse.cs
| | | | |-- TenantUpdateImageRequest.cs
| | | | |-- TenantUpdateJoinSettingsRequest.cs
| | | | |-- TenantUserUpdateRequest.cs
| | | |-- Users
| | | | |-- UserInviteRequest.cs
| | | | |-- UserLoggedResponse.cs
| | | | |-- UserLoginRequest.cs
| | | | |-- UserRegisterRequest.cs
| | | | |-- UserUpdateAvatarRequest.cs
| | | | |-- UserUpdateLocaleRequest.cs
| | | | |-- UserUpdatePasswordRequest.cs
| | | | |-- UserUpdateRequest.cs
| | | | |-- UserVerifyRequest.cs
| | | |-- Workspaces
| | | |-- CreateWorkspaceCredentialCiecRequest.cs
| | | |-- CreateWorkspaceCredentialEfirmaRequest.cs
| | | |-- CreateWorkspaceRequest.cs
| | | |-- UpdateWorkspaceRequest.cs
| | |-- Dtos
| | | |-- EntityDto.cs
| | | |-- IAuditableEntity.cs
| | | |-- App
| | | | |-- Contracts
| | | | | |-- ContractActivityDto.cs
| | | | | |-- ContractDto.cs
| | | | | |-- ContractEmployeeDto.cs
| | | | | |-- ContractMemberDto.cs
| | | | |-- Employees
| | | | | |-- EmployeeDto.cs
| | | | |-- Usages
| | | | |-- AppUsageSummaryDto.cs
| | | |-- Core
| | | |-- AppEntityDto.cs
| | | |-- AppWorkspaceEntityDto.cs
| | | |-- MasterEntityDto.cs
| | | |-- Emails
| | | | |-- EmailTemplateDto.cs
| | | |-- Examples
| | | | |-- TestForMasterEntityDto.cs
| | | |-- Links
| | | | |-- LinkDto.cs
| | | | |-- LinkInvitationDto.cs
| | | |-- Subscriptions
| | | | |-- SubscriptionCardDto.cs
| | | | |-- SubscriptionCouponDto.cs
| | | | |-- SubscriptionCustomerDto.cs
| | | | |-- SubscriptionFeatureDto.cs
| | | | |-- SubscriptionInvoiceDto.cs
| | | | |-- SubscriptionInvoiceLineDto.cs
| | | | |-- SubscriptionPaymentMethodDto.cs
| | | | |-- SubscriptionPlanDto.cs
| | | | |-- SubscriptionPriceDto.cs
| | | | |-- SubscriptionProductDto.cs
| | | |-- Tenants
| | | | |-- TenantDto.cs
| | | | |-- TenantJoinSettingsDto.cs
| | | | |-- TenantProductDto.cs
| | | | |-- TenantProductSimpleDto.cs
| | | | |-- TenantSimpleDto.cs
| | | | |-- TenantUserDto.cs
| | | |-- Users
| | | | |-- UserDto.cs
| | | | |-- UserSimpleDto.cs
| | | |-- Workspaces
| | | |-- WorkspaceDto.cs
| | | |-- WorkspaceSimpleDto.cs
| | | |-- WorkspaceUserDto.cs
| | |-- Extensions
| | | |-- CollectionExtensions.cs
| | |-- Helpers
| | | |-- DateHelper.cs
| | | |-- EmailHelper.cs
| | | |-- EncriptionHelper.cs
| | | |-- ImageHelper.cs
| | | |-- TailwindColors.cs
| | | |-- XmlHelper.cs
| | |-- Mapper
| | | |-- MappingProfile.cs
| | |-- Repositories
| | | |-- IMasterRepository.cs
| | | |-- IRepository.cs
| | | |-- App
| | | | |-- IContractRepository.cs
| | | | |-- IEmployeeRepository.cs
| | | | |-- IWorkspaceRepository.cs
| | | |-- Core
| | | |-- ILinkRepository.cs
| | | |-- ISubscriptionProductRepository.cs
| | | |-- ITenantRepository.cs
| | | |-- IUserRepository.cs
| | |-- Services
| | | |-- App
| | | | |-- IContractService.cs
| | | |-- Core
| | | | |-- ILinkService.cs
| | | | |-- IWorkspaceService.cs
| | | | |-- Subscriptions
| | | | | |-- ISubscriptionService.cs
| | | | |-- Tenants
| | | | | |-- ITenantService.cs
| | | | |-- Users
| | | | |-- IUserService.cs
| | | |-- Images
| | | | |-- IOpticalCharacterRecognitionService.cs
| | | |-- Messages
| | | |-- IEmailService.cs
| | |-- UnitOfWork
| | |-- IAppUnitOfWork.cs
| | |-- IBaseUnitOfWork.cs
| | |-- IMasterUnitOfWork.cs
| |-- NetcoreSaas.Domain
| | |-- NetcoreSaas.Domain.csproj
| | |-- Enums
| | | |-- App
| | | | |-- Contracts
| | | | | |-- ContractActivityType.cs
| | | | | |-- ContractInvitationStatus.cs
| | | | | |-- ContractMemberRole.cs
| | | | | |-- ContractStatus.cs
| | | | |-- Links
| | | | | |-- LinkStatus.cs
| | | | |-- Usages
| | | | |-- AppUsageType.cs
| | | |-- Core
| | | | |-- Subscriptions
| | | | | |-- SubscriptionBillingPeriod.cs
| | | | | |-- SubscriptionPriceType.cs
| | | | |-- Tenants
| | | | | |-- TenantUserJoined.cs
| | | | | |-- TenantUserRole.cs
| | | | | |-- TenantUserStatus.cs
| | | | | |-- WorkspaceType.cs
| | | | |-- Users
| | | | |-- UserLoginType.cs
| | | | |-- UserType.cs
| | | |-- Shared
| | | |-- Period.cs
| | | |-- Role.cs
| | |-- Extensions
| | | |-- GlobalExtensions.cs
| | |-- Helpers
| | | |-- ApiAppRoutes.cs
| | | |-- ApiCoreRoutes.cs
| | | |-- DateHelper.cs
| | | |-- StringHelper.cs
| | |-- Models
| | | |-- Entity.cs
| | | |-- App
| | | | |-- Contracts
| | | | | |-- Contract.cs
| | | | | |-- ContractActivity.cs
| | | | | |-- ContractEmployee.cs
| | | | | |-- ContractMember.cs
| | | | |-- Employees
| | | | |-- Employee.cs
| | | |-- Core
| | | | |-- AppEntity.cs
| | | | |-- AppWorkspaceEntity.cs
| | | | |-- MasterEntity.cs
| | | | |-- Common
| | | | | |-- AuditLog.cs
| | | | |-- Links
| | | | | |-- Link.cs
| | | | | |-- LinkInvitation.cs
| | | | |-- Subscriptions
| | | | | |-- SubscriptionFeature.cs
| | | | | |-- SubscriptionPrice.cs
| | | | | |-- SubscriptionProduct.cs
| | | | |-- Tenants
| | | | | |-- Tenant.cs
| | | | | |-- TenantJoinSettings.cs
| | | | | |-- TenantProduct.cs
| | | | | |-- TenantUser.cs
| | | | |-- Users
| | | | | |-- User.cs
| | | | |-- Workspaces
| | | | |-- Workspace.cs
| | | | |-- WorkspaceUser.cs
| | | |-- Interfaces
| | | |-- IAppEntity.cs
| | | |-- IAppWorkspaceEntity.cs
| | | |-- IEntity.cs
| | |-- Settings
| | |-- EmailSettings.cs
| | |-- FiscalSettings.cs
| | |-- LandbotSettings.cs
| | |-- OpticalCharacterRecognitionSettings.cs
| | |-- SubscriptionSettings.cs
| |-- NetcoreSaas.Infrastructure
| | |-- NetcoreSaas.Infrastructure.csproj
| | |-- ProjectConfiguration.cs
| | |-- Data
| | | |-- AppDbContext.cs
| | | |-- BaseDbContext.cs
| | | |-- MasterDbContext.cs
| | |-- Extensions
| | | |-- ContextServiceLocator.cs
| | | |-- HttpContextExtensions.cs
| | | |-- ServiceCollectionExtensions.cs
| | |-- Helpers
| | | |-- AuditEntry.cs
| | | |-- MapperBuilder.cs
| | |-- Middleware
| | | |-- Tenancy
| | | |-- DiscriminatorColumnInterceptor.cs
| | | |-- IApplicationBuilderExtensions.cs
| | | |-- ITenantAccessService.cs
| | | |-- ITenantAccessor.cs
| | | |-- TenantAccessService.cs
| | | |-- TenantBuilder.cs
| | | |-- TenantMiddleware.cs
| | | |-- Store
| | | | |-- ClaimsTenantStore.cs
| | | | |-- ITenantStore.cs
| | | | |-- InDatabaseTenantStore.cs
| | | | |-- InMemoryTenantStore.cs
| | | |-- Strategy
| | | |-- HeaderResolutionStrategy.cs
| | | |-- HostResolutionStrategy.cs
| | | |-- ITenantResolutionStrategy.cs
| | | |-- URLResolutionStrategy.cs
| | |-- Repositories
| | | |-- AppRepository.cs
| | | |-- MasterRepository.cs
| | | |-- App
| | | | |-- ContractRepository.cs
| | | | |-- EmployeeRepository.cs
| | | |-- Core
| | | |-- LinkRepository.cs
| | | |-- SubscriptionProductRepository.cs
| | | |-- TenantRepository.cs
| | | |-- UserRepository.cs
| | | |-- WorkspaceRepository.cs
| | |-- Services
| | | |-- DependencyInjection.cs
| | | |-- App
| | | | |-- ContractService.cs
| | | |-- Core
| | | | |-- LinkService.cs
| | | | |-- TenantService.cs
| | | | |-- UserService.cs
| | | | |-- WorkspaceService.cs
| | | |-- Images
| | | | |-- OpticarCharacterRecognitionMicrosoft.cs
| | | |-- Messages
| | | | |-- EmailPostmarkService.cs
| | | |-- Subscription
| | | |-- SubscriptionStripeService.cs
| | |-- UnitOfWork
| | |-- AppUnitOfWork.cs
| | |-- MasterUnitOfWork.cs
| |-- NetcoreSaas.WebApi
| |-- .gitignore
| |-- NetcoreSaas.WebApi.csproj
| |-- Program.cs
| |-- Startup.cs
| |-- appsettings.Development.json
| |-- appsettings.json
| |-- package.json
| |-- tslint.json
| |-- .vscode
| | |-- launch.json
| | |-- settings.json
| | |-- tasks.json
| |-- Controllers
| |-- ClientApp
| | |-- ErrorController.cs
| | |-- App
| | | |-- ContractController.cs
| | | |-- EmployeeController.cs
| | |-- Core
| | |-- Setup
| | | |-- SetupController.cs
| | |-- Subscriptions
| | | |-- SubscriptionManagerController.cs
| | | |-- SubscriptionProductController.cs
| | |-- Tenants
| | | |-- TenantController.cs
| | | |-- TenantUserInvitationController.cs
| | | |-- TenantUsersController.cs
| | |-- Users
| | | |-- AuthenticationController.cs
| | | |-- UserController.cs
| | |-- Workspaces
| | |-- LinkController.cs
| | |-- WorkspaceController.cs
| |-- Emails
| | |-- 00-basic-layout.md
| | |-- 01-welcome.md
| | |-- 02-password-reset.md
| | |-- 03-user-invitation.md
| | |-- 04-request-access.md
| | |-- 05-user-accepted.md
| | |-- 06-invitation-to-link-workspaces.md
| | |-- 07-invite-user-to-link-workspace.md
| | |-- 08-link-invitation-accepted.md
| | |-- 09-link-invitation-rejected.md
| | |-- 10-contract-new.md
| |-- Files
| | |-- ForceFilesFolder.txt
| |-- Middleware
| | |-- SerilogMiddleware.cs
| |-- Migrations
| | |-- 20211215224104_Initial.Designer.cs
| | |-- 20211215224104_Initial.cs
| | |-- MasterDbContextModelSnapshot.cs
| |-- Properties
| | |-- launchSettings.json
| |-- Service
| |-- GlobalHubService.cs
|-- tests
|-- NetcoreSaas.IntegrationTests
| |-- NetcoreSaas.IntegrationTests.csproj
| |-- TestBase.cs
| |-- appsettings.Testing.json
| |-- Core
| | |-- Subscriptions
| | | |-- SubscriptionTestBase.cs
| | | |-- SubscriptionTestProducts.cs
| | | |-- ManagerController
| | | | |-- CancelSubscriptionTests.cs
| | | | |-- ManagerTests.cs
| | | | |-- UpdateSubscriptionTests.cs
| | | |-- ProductController
| | | |-- SubscriptionProductControllerTests.cs
| | |-- Tenants
| | | |-- TenantControllerTests.cs
| | | |-- TenantUserInvitationControllerTests.cs
| | | |-- TenantUsersControllerTests.cs
| | |-- Users
| | |-- AuthenticationControllerTests.cs
| | |-- UserControllerTests.cs
| |-- Properties
| | |-- AssemblyInfo.cs