This repository contains the complete, production-ready source code for a high-performance Flutter news app api server that powers the entire Flutter News App toolkit. Built with the high-performance Dart Frog framework, it gives you all the server-side features you need, right out of the box. It is the core component of the Flutter News App Full Source Code Toolkit, serving the Flutter mobile app and the web-based content dashboard.
This API server comes packed with all the backend features you need to launch a professional and scalable news application.
Click on any category to explore.
🔐 Identity & Access Management
- Modern Flows: Implements secure, passwordless email + code sign-in and allows users to start with anonymous guest accounts.
- Seamless Account Linking: Intelligently converts guest users to permanent accounts upon sign-up, migrating all their data (preferences, saved items) automatically.
Your Advantage: You get a modern, frictionless, and secure user onboarding experience that reduces user friction and encourages sign-ups.
- JWT-Powered: Uses industry-standard JSON Web Tokens (JWTs) for robust and stateless session management.
- Instant Session Invalidation: A token blacklisting service ensures that when a user signs out, their session is immediately and securely terminated.
Your Advantage: Deliver a highly secure authentication system that protects user data and gives you full control over sessions.
- Permission-Driven: A flexible RBAC system controls what users can do based on their assigned roles (
AppUserRole
,DashboardUserRole
). - Ownership Verification: Built-in middleware automatically checks if a user owns a piece of data before allowing them to modify or delete it.
Your Advantage: Easily enforce complex business rules and security policies, ensuring users can only access and manage the data they are supposed to.
- Smart Rate Limiting: Protects critical endpoints like
request-code
and the main data API from brute-force attacks, spam, and denial-of-service attempts. - IP & User-Based: Applies rate limits based on IP for anonymous users and by user ID for authenticated users, providing fair and effective protection.
Your Advantage: Your API is shielded from common threats, ensuring high availability and stability for your legitimate users.
📦 Dynamic Content & Data API
- Unified Data Gateway: A single, powerful set of RESTful endpoints (
/api/v1/data
) serves as a central gateway for all data operations. It uses a simple?model=
query parameter to dynamically handle CRUD requests for any data type in the system—Headlines, Topics, User Preferences, and more. - Metadata-Driven Engine: Instead of hardcoding routes for each data type, the API uses a central registry. This registry defines everything about a model—its permissions, validation rules, and how it connects to the database—in one place.
Your Advantage: This architecture is incredibly clean and scalable. Adding a completely new data type to your application, with its own unique permissions and logic, doesn't require writing new boilerplate API routes. You simply define its metadata in the central registry, and the generic endpoint handles the rest, dramatically speeding up development and reducing code duplication.
- Rich Filtering: Supports complex, MongoDB-style filtering directly through the API.
- Flexible Sorting & Pagination: Allows for multi-field sorting and efficient cursor-based pagination to handle large datasets.
Your Advantage: Enable powerful, high-performance content discovery features in your client applications (like filtering, sorting, and infinite scrolling) with no extra backend work.
🏗️ Architecture & Infrastructure
- Modern & Fast: Built on Dart Frog, a minimalist and extremely fast backend framework from the creators of Very Good Ventures, ensuring excellent performance and low latency.
Your Advantage: Your backend is built on a solid, modern foundation that is both powerful and easy to work with.
- Separation of Concerns: Strictly follows a layered architecture (Data Clients, Repositories, Services) that is clean, maintainable, and scalable.
- Standardized Responses: Consistent JSON response structures for both success and error scenarios make client-side handling predictable and simple.
Your Advantage: You get a codebase that is easy to understand, modify, and extend, saving you significant development and maintenance time.
- Testable & Modular: A centralized dependency injection system makes the entire application highly modular and easy to test.
- Swappable Implementations: Easily swap out core components—like the database (MongoDB), email provider (SendGrid), or storage services—without rewriting your business logic.
Your Advantage: The architecture is not locked into specific services. You have the freedom to adapt and evolve your tech stack as your needs change.
- Secure & Flexible: Manages all sensitive keys, API credentials, and environment-specific settings through a
.env
file, keeping your secrets out of the codebase.
Your Advantage: Deploy your application across different environments (local, staging, production) safely and efficiently.
- PR-Driven Schema Evolution: Implements a robust, versioned database migration system that automatically applies schema changes to MongoDB on application startup.
- Idempotent & Generic: Each migration is idempotent and designed to handle schema evolution for any model in the database, ensuring data consistency across deployments.
- Traceable Versioning: Migrations are identified by their Pull Request merge date (
prDate
inYYYYMMDDHHMMSS
format) for chronological execution, a conciseprSummary
, and a directprId
(GitHub PR ID) for full traceability.
Your Advantage: Say goodbye to manual database updates! Your application gracefully handles schema changes, providing a professional and reliable mechanism for evolving your data models without breaking existing data, with clear links to the originating code changes.
This Flutter News App API Server
package is an integral part of the Flutter News App Full Source Code Toolkit. For comprehensive details regarding licensing, including trial and commercial options for the entire toolkit, please refer to the main toolkit organization page.
For a complete guide on setting up your local environment, running the server, and understanding the configuration, please see the Local Setup Guide in our official documentation.
Our documentation provides a detailed, step-by-step walkthrough to get you up and running smoothly.