feat: Refactor server to hexagonal architecture and implement in-memory and PostgreSQL adapters#212
Open
Ngha-Boris wants to merge 6 commits into
Open
feat: Refactor server to hexagonal architecture and implement in-memory and PostgreSQL adapters#212Ngha-Boris wants to merge 6 commits into
Ngha-Boris wants to merge 6 commits into
Conversation
…ry and PostgreSQL adapters
Open
11 tasks
Hermann-Core
requested changes
Jul 15, 2026
Hermann-Core
left a comment
Collaborator
There was a problem hiding this comment.
@Ngha-Boris I have reviewed the PR and posted comments for your attention.
…in application layer
Collaborator
Author
|
Hello @Hermann-Core please check again |
Collaborator
|
this pr should not be merge till Friday thanks |
Collaborator
Author
What is the reason for that @martcpp? |
Collaborator
it structural revamp there are other ticket that should be cloud to avoid serious conflict |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR refactors the codebase to follow a hexagonal (ports-and-adapters) architecture, clearly separating domain logic from infrastructure and enabling easier testing, multiple backend support, and future extensibility.
Directory Structure Changes
Key Implementation Details
1. Domain Layer (No Infrastructure Dependencies)
StatusList,StatusEntry,Status,Issuer,Credentialentities2. Ports as Boundaries
All outbound dependencies are now expressed through traits in
src/ports/:StatusListRepository/CredentialRepositoryStatusListCacheCertificateProviderSecretStoreDnsProviderMetricsCollector3. Dependency Injection
AppStatenow holds trait objects:Adapters are constructed in
build_state()and injected, not built inline in handlers.4. Compile-Time Feature Flags
memory-onlypostgresredisawscache-mokacertificate-acmemetrics-prometheusTesting Strategy
Unit Tests with In-Memory Adapters
The
MemoryStatusLists,MemoryStatusListCache,MemoryCredentials,MemorySecretStore,MemoryDnsProvider, andMemoryMetricsCollectoradapters enable pure unit testing without infrastructure:Integration Tests
Existing integration tests continue to work with the default Postgres/Redis/AWS stack.
Documentation
docs/hexagonal-architecture.mdexplaining the architecture layers and dependency ruleREADME.mdwith link to architecture documentationsrc/domain/,src/application/, andsrc/ports/Verification
Build Memory-Only Composition
Compiles without Postgres, Redis, or AWS dependencies.
Run All Tests
cargo test cargo nextest run --workspace --all-targets --all-featuresChecklist (Ticket Deliverables)
src/domain) with core entities and value objectssrc/application)src/ports)src/adapters/*)AppState/startup.rsfor dependency injectiondocs/hexagonal-architecture.md)Related Issues
Migration Notes for Developers
utils/state.rs- add new services there