Skip to content

Commit b4f7a16

Browse files
committed
docs(architecture): add overview of toolkit architecture
- Explain the multi-repository structure of the Flutter News App Toolkit - Describe the roles of applications and shared packages - Highlight benefits of the decoupled, multi-repository approach - Introduce the concept of 'pubspec.yaml' for package connections
1 parent cd8cd80 commit b4f7a16

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
title: Understanding the Toolkit Architecture
3+
description: An overview of the multi-repository architecture and how the apps and packages work together.
4+
---
5+
import { Card, CardGrid, Aside } from '@astrojs/starlight/components';
6+
7+
Welcome to the architectural overview of the Flutter News App Toolkit. Understanding the structure of the toolkit is the first and most important step to customizing it effectively and making it your own.
8+
9+
This toolkit is not a single, monolithic application. Instead, it is a collection of independent projects—three applications and a suite of shared packages—that work together. This is a deliberate and professional architectural choice that provides significant long-term benefits.
10+
11+
### The Multi-Repository Philosophy
12+
13+
The toolkit is divided into two main categories of repositories:
14+
15+
<CardGrid>
16+
<Card title="Applications" icon="laptop">
17+
These are the user-facing projects that you will build and deploy. Each one is a standalone application in its own repository.
18+
- **Mobile Client:** The Flutter app for iOS and Android.
19+
- **Web Dashboard:** The Flutter web app for administration.
20+
- **API Server:** The Dart Frog backend.
21+
</Card>
22+
<Card title="Shared Packages" icon="puzzle">
23+
These are Dart packages that contain shared code, logic, and UI components. They are consumed by the applications as dependencies.
24+
- **`core`**: Contains all shared data models and exceptions.
25+
- **`data_repository`**: Handles the business logic for data fetching.
26+
- **`ui_kit`**: Provides shared widgets, themes, and constants.
27+
- ...and many others.
28+
</Card>
29+
</CardGrid>
30+
31+
### Why Is It Structured This Way?
32+
33+
This decoupled, multi-repository approach is a best practice for building large, maintainable systems.
34+
35+
- **Code Reusability:** The `core` package ensures that the Mobile Client and the API Server are always using the exact same data models. The `ui_kit` ensures both Flutter apps have a consistent look and feel. This is the essence of **DRY (Don't Repeat Yourself)**.
36+
- **Separation of Concerns:** Each piece of the toolkit has a single, clear responsibility. The `auth_repository` only handles authentication logic. The `http_client` only handles making network requests. This makes the code easier to understand, test, and debug.
37+
- **Maintainability:** When you need to change the theme of your apps, you only need to edit the `ui_kit` package. When you need to add a new field to a data model, you only edit the `core` package. The changes then propagate to the consuming applications when you update the dependency.
38+
39+
### How It All Connects: `pubspec.yaml`
40+
41+
The link between the applications and the shared packages is the `pubspec.yaml` file in each application. When you first get the code, these files point to the original public GitHub repositories for each package.
42+
43+
```yaml title="Example from an app's pubspec.yaml"
44+
dependencies:
45+
# This app depends on the `core` package...
46+
core:
47+
# ...and it fetches it from this Git repository.
48+
git:
49+
url: https://github.com/flutter-news-app-full-source-code/core.git
50+
51+
# It also depends on the `ui_kit` package.
52+
ui_kit:
53+
git:
54+
url: https://github.com/flutter-news-app-full-source-code/ui-kit.git
55+
```
56+
57+
<Aside type="tip">
58+
To truly customize the toolkit, you will need to host these packages in your own private repositories and update this `pubspec.yaml` file to point to your versions. The next guide will walk you through this essential process.
59+
</Aside>

0 commit comments

Comments
 (0)