Setting Up the Home SDK
What you'll learn
- Generating the Home SDK with dashboard, profile, and settings pages
- Understanding the dual-GetIt DI pattern for feature-scoped dependencies
- Customizing the generated pages for your app's needs
- Connecting the home feature to your navigation graph
Prerequisites
- An existing Archipelago monorepo (see Monorepo Scaffolding)
- Auth SDK already generated (see Auth SDK Setup)
Step 1: Generate the Home SDK
bash
archipelago generate home_sdkYou will be prompted for:
- appName —
MyApp(must match your monorepo app name) - isForMonorepo —
true(uses workspace path resolution)
Or use a config file:
json
{
"appName": "MyApp",
"isForMonorepo": true
}bash
archipelago generate home_sdk --config home_config.jsonStep 2: Understand the Generated Structure
The Home SDK generates a feature module with three pre-built pages:
features/
└── home_sdk/
└── lib/src/
├── home_sdk.dart # FeatureSDK entry point
├── data/
│ ├── datasources/ # Local/remote data sources
│ ├── models/ # Data models
│ └── repositories/ # Repository implementations
├── di/ # Scoped GetIt registration
├── domain/
│ ├── repositories/ # Repository contracts
│ └── usecases/ # Business logic
├── presentation/
│ └── ui/pages/
│ ├── dashboard_page.dart # Main landing page
│ ├── profile_page.dart # User profile
│ └── settings_page.dart # App settings
└── router/ # Route definitionsStep 3: Register the Home Feature
In your shell app's bootstrap.dart:
dart
import 'package:home_sdk/home_sdk.dart';
FeatureRegistry.register(HomeSdk());The Home SDK uses the dual-GetIt pattern: global GetIt for shared infrastructure (auth state, network client) and a local GetIt instance for feature-scoped dependencies (home repositories, usecases).
Step 4: Customize the Dashboard
The generated dashboard page is a starting point. Add your own widgets:
dart
// home_sdk/lib/src/presentation/ui/pages/dashboard_page.dart
class DashboardPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
// Add your dashboard widgets here
const WelcomeHeader(),
const QuickActions(),
const RecentActivity(),
],
),
);
}
}Common Customizations
| Customization | Where to Change |
|---|---|
| Add dashboard widgets | presentation/ui/pages/dashboard_page.dart |
| Edit profile fields | data/models/ and profile_page.dart |
| Add settings options | presentation/ui/pages/settings_page.dart |
| Change navigation tabs | router/ route definitions |
| Add bottom navigation | home_sdk.dart shell route |
Next Steps
- Set up the UI Kit to theme your home pages
- Configure the Paywall for subscription-gated features