Skip to content

Refactor rename the package and the private deps #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Jul 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
a1f4903
chore: update MongoDB database name example
fulleni Jul 23, 2025
cb2bd23
build(deps): update dependency repository locations and names
fulleni Jul 23, 2025
90b7c45
chore: update repository links and rename project
fulleni Jul 23, 2025
75ab180
chore(dependabot): add specific package ignores in dependabot config
fulleni Jul 23, 2025
45c8ae4
refactor(api): update dependencies and imports
fulleni Jul 23, 2025
993b263
refactor:flutter_news_app_api_server_full_source_code: update imports…
fulleni Jul 23, 2025
33fc121
refactor(api): update imports and exceptions handling
fulleni Jul 23, 2025
ff00dd9
docs(countries_client_provider): update outdated commentary
fulleni Jul 23, 2025
fef92b9
refactor(rbac): update imports in permission_service and role_permiss…
fulleni Jul 23, 2025
66ce087
refactor(registry): update imports and package references
fulleni Jul 23, 2025
d67c9eb
refactor(api): rename package and update dependencies
fulleni Jul 23, 2025
ddfd42e
refactor(dependencies): update import paths and package names
fulleni Jul 23, 2025
4aca107
build: update import path for authentication middleware
fulleni Jul 23, 2025
2432d4a
refactor(auth): update imports and exceptions in auth routes
fulleni Jul 23, 2025
d8bebdf
refactor(api): update package imports and repository references
fulleni Jul 23, 2025
033fb77
build(dependencies): move core package to dependencies and adjust dotenv
fulleni Jul 23, 2025
8dc33bf
docs(README): overhaul content and structure for clarity & impact
fulleni Jul 23, 2025
3536bb3
docs(README): update toolkit name and formatting
fulleni Jul 23, 2025
af6c78b
docs(pubspec): update package description
fulleni Jul 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# REQUIRED: The full connection string for your MongoDB instance.
# The application cannot start without a database connection.
# DATABASE_URL="mongodb://user:password@localhost:27017/ht_api_db"
# DATABASE_URL="mongodb://user:password@localhost:27017/flutter_news_app_api_server_full_source_code_db"

# REQUIRED: A secure, randomly generated secret for signing JWTs.
# The application cannot start without this.
Expand Down
9 changes: 8 additions & 1 deletion .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,11 @@ updates:
schedule:
interval: "daily"
ignore:
- dependency-name: 'ht_*'
- dependency-name: 'core'
- dependency-name: 'data_client'
- dependency-name: 'data_mongodb'
- dependency-name: 'data_repository'
- dependency-name: 'email_client'
- dependency-name: 'email_repository'
- dependency-name: 'email_sendgrid'
- dependency-name: 'http_client'
146 changes: 64 additions & 82 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,126 +1,108 @@
# ht_api
<div align="center">
<img src="https://avatars.githubusercontent.com/u/202675624?s=400&u=2daf23e8872a3b666bcd4f792a21fe2633097e79&v=4" alt="Flutter News App Toolkit Logo" width="220">

![coverage: percentage](https://img.shields.io/badge/coverage-xx-green)
[![style: very good analysis](https://img.shields.io/badge/style-very_good_analysis-B22C89.svg)](https://pub.dev/packages/very_good_analysis)
[![License: PolyForm Free Trial](https://img.shields.io/badge/License-PolyForm%20Free%20Trial-blue)](https://polyformproject.org/licenses/free-trial/1.0.0)
# Flutter News App - API Server Full Source Code

πŸš€ Accelerate the development of your news application backend with **ht_api**, the
dedicated API service for the Headlines Toolkit. Built on the high-performance
Dart Frog framework, `ht_api` provides the essential server-side infrastructure
specifically designed to power robust and feature-rich news applications.
<p>
<img src="https://img.shields.io/badge/coverage-XX-green?style=for-the-badge" alt="coverage: percentage">
<a href="https://github.com/sponsors/flutter-news-app-full-source-code"><img src="https://img.shields.io/badge/DOCS-READ-purple?style=for-the-badge" alt="DOCS READ"></a>
<a href="https://github.com/sponsors/flutter-news-app-full-source-code"><img src="https://img.shields.io/badge/LICENSE-BUY-pink?style=for-the-badge" alt="License: Buy"></a>
</p>
</div>
Comment on lines 3 to +10

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider using a consistent style for badges. The original README used shields.io badges, while the updated version uses a mix of shields.io and for-the-badge styles. Standardizing on one style would improve visual consistency.


`ht_api` is a core component of the **Headlines Toolkit**, a comprehensive,
source-available ecosystem designed for building feature-rich news
applications, which also includes a Flutter [mobile app](https://github.com/headlines-toolkit/ht-main) and a web-based [content
management dashboard](https://github.com/headlines-toolkit/ht-dashboard).
This is the complete and fully-functional backend API server for the Flutter News App Toolkit. Built with the high-performance Dart Frog framework, it gives you all the server-side features you need to power your news app, right out of the box. It is a key component of the [**Flutter News App Toolkit**](https://github.com/flutter-news-app-full-source-code), an ecosystem that also includes a flutter [mobile app](https://github.com/flutter-news-app-full-source-code/flutter-news-app-mobile-client-full-source-code) and a web-based [content dashboard](https://github.com/flutter-news-app-full-source-code/flutter-news-app-web-dashboard-full-source-code).

## ✨ Key Capabilities
## ⭐ Everything You Get, Ready to Go

* πŸ”’ **Flexible & Secure Authentication:** Provide seamless user access with
a unified system supporting passwordless email sign-in and anonymous guest
accounts. The API intelligently handles the conversion from a guest to a
permanent user, preserving all settings and preferences. It also includes
a secure, role-aware login flow for privileged dashboard users.
This API server comes packed with all the features you need to launch a professional, scalable news application.

* ⚑️ **Granular Role-Based Access Control (RBAC):** Implement precise
permissions with a dual-role system (`appRole` for application features,
`dashboardRole` for admin functions) to control access to API features
and data management capabilities.
#### πŸ” **Robust & Flexible Authentication**
* Provides secure, modern authentication flows, including passwordless email sign-in and anonymous guest accounts.
* Intelligently handles converting guest users to permanent accounts, preserving all their settings and saved content.
* Includes a separate, role-aware login flow for privileged dashboard users.
> **Your Advantage:** You get a complete, secure authentication system without the complexity. All the user management logic is done for you. βœ…

* βš™οΈ **Synchronized App Settings:** Ensure a consistent and personalized user
experience across devices by effortlessly syncing application preferences
like theme, language, font styles, and more.
#### ⚑️ **Granular Role-Based Access Control (RBAC)**
* Implement precise permissions with a dual-role system: `appRole` for mobile app features and `dashboardRole` for admin functions.
* Securely control access to API features and data management capabilities based on user roles.
> **Your Advantage:** A powerful, built-in security model that protects your data and ensures users only access what they're supposed to. πŸ›‘οΈ

* πŸ‘€ **Personalized User Preferences:** Enable richer user interactions by
managing and syncing user-specific data such as saved headlines, followed
sources, and followed topics tailored to individual users.
#### βš™οΈ **Centralized App & User Settings**
* Effortlessly sync user-specific settings like theme, language, and font styles across devices.
* Manage personalized content preferences, including saved headlines and followed topics/sources.
> **Your Advantage:** Deliver a seamless, personalized experience that keeps users' settings in sync, boosting engagement and retention. ❀️

* πŸ’Ύ **Robust Data Management:** Securely manage core news data (headlines,
topics, sources) through a well-structured API that supports flexible
querying and sorting for dynamic content presentation.
#### πŸ’Ύ **Robust Data Management API**
* Securely manage all your core news data, including headlines, topics, sources, and countries.
* The API supports flexible querying, filtering, and sorting, allowing your app to display dynamic content feeds.
> **Your Advantage:** A powerful and secure data backend that's ready to scale with your content needs. πŸ“ˆ

* 🌐 **Dynamic Remote Configuration:** Centrally manage application
behaviorβ€”including ad frequency, feature flags, and maintenance statusβ€”without
requiring a client-side update.
#### 🌐 **Dynamic Remote Configuration**
* Centrally manage your app's behavior without shipping an update.
* Control ad frequency, feature flags, force-update prompts, and maintenance status directly from the server.
> **Your Advantage:** Adapt your app on the fly, run experiments, and respond to issues instantly, giving you maximum operational control. πŸ•ΉοΈ

* πŸ“Š **Dynamic Dashboard Summary:** Access real-time, aggregated metrics on
key data points like total headlines, topics, and sources, providing
an at-a-glance overview for administrative dashboards.
#### πŸ“Š **Real-Time Dashboard Analytics**
* Access real-time, aggregated metrics on key data points like total headlines, topics, and sources.
* Provides an at-a-glance overview perfect for administrative dashboards.
> **Your Advantage:** Instantly feed your content dashboard with the data it needs to provide valuable insights. 🎯

* πŸ”§ **Solid Technical Foundation:** Built with Dart and the high-performance
Dart Frog framework, offering a maintainable codebase, standardized API
responses, and built-in access control for developers.
#### πŸ—οΈ **Clean & Modern Architecture**
* Built with Dart and the high-performance Dart Frog framework.
* Features a clean, layered architecture with standardized API responses and built-in dependency injection.
> **Your Advantage:** A solid, maintainable codebase that's easy to understand, extend, and build upon. πŸ”§

## πŸ”Œ API Endpoints
---

`ht_api` provides a clear and organized API surface under the `/api/v1/` path.
Key endpoint groups cover authentication, data access, and user settings.
## πŸ”‘ License: Source-Available with a Free Trial

For complete API specifications, detailed endpoint documentation,
request/response schemas, and error codes, please refer to the dedicated
documentation website [todo:Link to the docs website].
Get started for free and purchase when you're ready to launch!

## πŸ”‘ Access and Licensing
* **TRY IT:** Download and explore the full source code under the PolyForm Free Trial [license](LICENSE). Perfect for evaluation.
* **BUY IT:** Get an unlimited commercial lifetime license with a **one-time payment**. No subscriptions!
* **GET YOURS:** [**Purchase via GitHub Sponsors**](https://github.com/sponsors/flutter-news-app-full-source-code).

`ht_api` is source-available as part of the Headlines Toolkit ecosystem.
> *<p style="color:grey">Note: The single purchase provides a comprehensive commercial license covering every repository within the [Flutter News App Toolkit](https://github.com/flutter-news-app-full-source-code) organization. No separate purchases are needed for the mobile app or dashboard.</p>*

To acquire a commercial license for building unlimited news applications, please visit
the [Headlines Toolkit GitHub organization page](https://github.com/headlines-toolkit)
for more details.
---

## πŸ’» Setup & Running
## πŸš€ Getting Started & Running Locally

1. **Prerequisites:**
* Dart SDK (`>=3.0.0`)
* MongoDB (`>=5.0` recommended)
* Dart Frog CLI (`dart pub global activate dart_frog_cli`)

2. **Configuration:**
Before running the server, you must configure the necessary environment
variables.
2. **Clone the repository:**
```bash
git clone https://github.com/flutter-news-app-full-source-code/flutter-news-app-api-server-full-source-code.git
cd flutter-news-app-api-server-full-source-code
```

3. **Configure your environment:**
Copy the `.env.example` file to a new file named `.env`:
```bash
cp .env.example .env
```
Then, open the new `.env` file and update the variables with your actual
configuration values, such as the `DATABASE_URL`.
Then, open the new `.env` file and update the variables with your actual configuration values (e.g., `DATABASE_URL`).

3. **Clone the repository:**
```bash
git clone https://github.com/headlines-toolkit/ht-api.git
cd ht-api
```
4. **Get dependencies:**
```bash
dart pub get
```

5. **Run the development server:**
```bash
dart_frog dev
```
The API will typically be available at `http://localhost:8080`. On startup,
the server will connect to your MongoDB database and seed it with initial
fixture data. This seeding process is idempotent (using `upsert`
operations), so it can be run multiple times without creating duplicates.
The API will be available at `http://localhost:8080`. On startup, the server will connect to your MongoDB database and seed it with initial data. This process is idempotent, so it can be run multiple times without creating duplicates.


**Note on Web Client Integration (CORS):** To allow web applications (like
the HT Dashboard) to connect to this API in production, the
`CORS_ALLOWED_ORIGIN` environment variable must be set to the specific
origin of your web application (e.g., `https://your-dashboard.com`).

For local development, the API automatically allows any request
originating from `localhost` on any port, so you do not need to set this
variable.
---

## βœ… Testing

Ensure the API is robust and meets quality standards by running the test suite:
This project aims for high test coverage to ensure quality and reliability.

```bash
# Ensure very_good_cli is activated: dart pub global activate very_good_cli
very_good test --min-coverage 90
```

Aim for a minimum of 90% line coverage.
* Run tests with:
```bash
very_good test --min-coverage 90
Loading
Loading