MyceliumCore (also referred as MycCore): The core part of the Mycelium project
Here you can find business logic and domain types that are shared across the workspace.
See the Global README for more information.
Directory Structure
This crate is organized into the following main directories:
domain/
Contains the core domain models, data transfer objects (DTOs), entities, and utilities that represent the business domain of Mycelium.
-
actors/: Defines system actors and roles used for authorization and access control (e.g.,SystemActorenum with roles likeBeginner,SubscriptionsManager,AccountManager, etc.) -
dtos/: Data Transfer Objects (DTOs) used for API communication and data serialization. Includes the following DTOs:account/: Account-related DTOs includingAccount,AccountMetaKey,VerboseStatus, andFlagResponseaccount_type.rs: Account type definitionsemail.rs: Email DTO for email validation and handlingerror_code.rs: Error code DTOsguest_role.rs: Guest role DTOs with permissionsguest_user.rs: Guest user DTOshealth_check_info.rs: Health check information DTOshttp.rs: HTTP method and related DTOshttp_secret.rs: HTTP secret DTOs for secure communicationmessage.rs: Message DTOsnative_error_codes.rs: Native error code definitionsprofile/: Profile-related DTOs including:Profile: Main profile DTO with owners, accounts, and permissionsLicensedResourceandLicensedResources: Licensed resource DTOsOwner: Owner DTOTenantOwnershipandTenantsOwnership: Tenant ownership DTOs
related_accounts.rs: Related accounts DTOsroute.rs: Route configuration DTOssecurity_group.rs: Security group DTOsservice.rs: Service DTOstag.rs: Tag DTOs for categorizationtenant/: Tenant-related DTOs includingTenant,TenantMetaKey, andTenantStatustoken/: Token-related DTOs organized in sub-modules:connection_string/: Connection string DTOs includingConnectionStringBeans,PublicConnectionStringInfo, andUserAccountConnectionStringmeta/: Token metadata DTOs includingAccountRelatedMetaandUserRelatedMetatoken/: Token DTOs includingEmailConfirmationTokenandPasswordChangeTokenTokenandMultiTypeMeta: Main token DTOs
user.rs: User DTOswebhook/: Webhook-related DTOs includingWebHook,WebHookTrigger, and webhook response DTOswritten_by.rs: Audit trail DTO for tracking who created/updated resources
-
entities/: Domain entities representing the core business objects. Each entity module contains operations for:- Registration (creation)
- Fetching (reading)
- Updating
- Deletion
- Other domain-specific operations
Entities include:
account,user,tenant,token,guest_role,guest_user,webhook,service,message,profile, and more. -
utils/: Utility functions and helpers used across the domain layer (e.g., UUID derivation, type conversions)
use_cases/
Contains the application use cases organized by functionality and role. These implement the business logic and orchestrate domain operations.
-
gateway/: Use cases for gateway functionalities, including route configuration loading, validation, and request routing/matching -
role_scoped/: Federation use cases organized by user roles:beginner/: Operations for users without assigned roles (account management, user registration, token management, tenant info)account_manager/: Operations for managing a single subscription accountsubscriptions_manager/: Operations for managing subscription accounts, guest users, roles, and tagstenant_manager/: Operations for managing tenant-level resources (accounts, guests, tags, tenant details)tenant_owner/: Operations for tenant owners to manage tenant metadata, tags, and ownershipusers_manager/: Operations for managing user accountsguest_manager/: Operations for managing guest roles and permissionsgateway_manager/: Operations for managing gateway endpoints and configurationssystem_manager/: Operations for managing system-wide resources (error messages, webhooks, etc.)
-
service/: Service-related use cases for automated account creation, guest-to-default account conversion, and service discovery -
super_users/: Use cases for system administrators:managers/: Operations for managing tenants, system accounts, and system rolesstaff/: Operations for staff account management and privilege upgrades/downgrades
-
support/: Support use cases for notifications, webhook dispatching, and event registration
models/
Configuration models and data structures used across the application:
config.rs: Core configuration modelsaccount_life_cycle_config.rs: Configuration for account lifecycle managementwebhook_config.rs: Configuration for webhook dispatching
settings.rs
System-wide settings, constants, and template configuration:
- Default TOTP domain configuration
- Template engine (Tera) initialization
- System constants and environment variable handling