Backend as an implementation detail
AppKickstarter is designed with a high level of abstraction for core functionalities such as Authentication, Remote Data Storage, and Remote Document Storage. This architectural choice ensures flexibility, allowing for easy substitution of Firebase or any other backend services. This section guides you through customizing the endpoints for Authentication, Storage, and Database services by leveraging the power of dependency injection with Koin.
Create a Koin module
To begin customizing your backend services, create a Koin module that will hold your implementations:
Storage
To customize storage solutions, implement the IRemoteFileSystem
interface:
Then, register your custom storage implementation in the Koin module:
Database
For custom database interactions, implement the IUserRemoteDB
interface:
And add your implementation to the Koin module for dependency injection:
Posts Management
AppKickstarter includes default data manipulation examples, such as creating user posts with text, date, and images, and displaying them in a feed. To integrate a custom solution for posts storage:
Implement the IPostsRemoteDB
interface:
Register your implementation in the Koin module:
Authentication
To customize authentication mechanisms, implement the KickstarterAuth
interface:
Finally, integrate your custom authentication service into the Koin module:
Wrap it up
To finalize the customization of your backend services in AppKickstarter, ensure your customRemoteModule
is defined as follows:
Navigate to shared/commonMain/sharedModule/initKoin
, and make the following adjustments:
Remove the
firebaseModule
: This step is crucial as it disconnects the default Firebase implementations from your app's dependency graph.Add
customRemoteModule
: By adding your custom module, you effectively replace the default services with your tailored implementations.
By completing these steps, you have successfully set up custom endpoints for Authentication, Storage, and Database services in AppKickstarter. This approach ensures that the core functionalities of your app are not tightly coupled with Firebase or any specific backend service.
Last updated