Skip to content

Refactor and improve API layer architecture#2040

Merged
hjiangsu merged 1 commit intodevelopfrom
refactor/api-layer
Jan 17, 2026
Merged

Refactor and improve API layer architecture#2040
hjiangsu merged 1 commit intodevelopfrom
refactor/api-layer

Conversation

@hjiangsu
Copy link
Member

Pull Request Description

This PR completely refactors and reworks the current API layer to be more robust and allow for better support for future API versions (e.g., Lemmy API v4). This is a large PR so there may be bugs or issues that I haven't caught yet. I have done some general testing and it seems to be working as expected!

Here's a high level overview of the changes:

  • Implemented ApiClientFactory which creates the appropriate API client based on a given account's platform (e.g., Lemmy/PieFed).
  • Implemented an abstract ThunderApiClient class which defines all the available API functions. These functions will be implemented by the respective API clients.
  • Implemented a BaseApiClient which handles all logic related to requests/responses and error handling that is shared amongst all the respective API clients. Both the Lemmy/PieFed APIs will extend from this class and implement the methods defined in ThunderApiClient.
  • Updated all repositories to use this new architecture, which should significantly simplify the repository logic.

What's left to do now is to implement the changes introduced in Lemmy API V4 and additional testing! I expect there to be some more changes to the architecture as I work on implementing the changes introduced in V4. However, that will be in a different PR and the work will be iterated on.

I'll likely push these changes out to a nightly release first to allow for more time to catch any issues that come up with this refactor.

Issue Being Fixed

Issue Number: N/A

Screenshots / Recordings

Checklist

  • If a new package was added, did you ensure it uses an appropriate license and is actively maintained?
  • Did you use localized strings (and added appropriate descriptions) where applicable?
  • Did you add semanticLabels where applicable for accessibility?

@hjiangsu hjiangsu merged commit d9b0bc4 into develop Jan 17, 2026
1 check passed
@hjiangsu hjiangsu deleted the refactor/api-layer branch January 17, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments