How eliasdfranco/cinema_culture_app works
1. This is a Flutter client application named cinema_culture, built to run on Android, iOS, web, Linux, macOS, and Windows from a single Dart codebase. The native folders are mostly platform shells and bootstrapping code; the real application architecture lives under lib/.
2. The repo is organized with a clear layered boundary:
- domain/ defines the app’s core movie abstractions and contracts.
- infraestructure/ implements those contracts against The Movie Database.
- presentation/ contains UI, state management, and screens.
- config/ holds app-wide routing, theme, constants, and helpers.
3. The domain layer is the stable center of the app. It contains:
- domain/entities/movie.dart for the app’s canonical movie object.
- domain/datasources/movie_datasource.dart as the abstract data source contract.
- domain/repositories/movie_repository.dart as the repository contract.
This layer is intentionally isolated from TMDb-specific response shapes and UI concerns.
4. The infrastructure layer adapts external API data into domain objects. It includes:
- infraestructure/datasources/moviedb_datasource.dart for TMDb access.
- infraestructure/models/moviesdb/* for API response DTOs.
- infraestructure/mappers/movie_mapper.dart to transform API models into Movie.
- infraestructure/repositories/movie_repository_impl.dart as the concrete repository.
This is the main boundary where network-oriented, API-specific details are kept out of the rest of the app.
5. The primary data flow is:
UI screen → Riverpod provider → repository provider → repository implementation → TMDb data source → API response model → mapper → domain entity → back to UI.
That flow is what an architecture diagram should emphasize, because it shows where the app fetches, transforms, and displays movie data.
6. State management is handled in presentation/providers/movies/ using Riverpod-style providers. Notable files include:
- movies_repository_provider.dart for dependency wiring.
- movies_providers.dart, movies_slideshow_provider.dart, and initial_loading_provider.dart for feature state.
This indicates the UI does not talk directly to the infrastructure layer; dependencies are injected through providers.
7. The presentation layer is feature-oriented around movies. The main screen appears to be presentation/screens/movies/home_screen.dart, supported by:
- movie_horizonal_listview.dart
- movies_slideshow.dart
- shared widgets like custom_appbar.dart, custom_bottom_navigation.dart, and full_screen_loader.dart
This suggests a home feed with hero/slideshow content, horizontal lists, and loading states.
8. App-level configuration is centralized in lib/config/:
- routes/app_router.dart defines navigation.
- theme/app_theme.dart defines visual styling.
- constants/enviroment.dart stores environment-driven configuration.
- helpers/human_formats.dart formats values for display.
These are cross-cutting concerns used by multiple features rather than business logic.
9. External integration is centered on The Movie Database. The README explicitly says to copy .env.template to .env and fill in TMDb variables, so the app depends on runtime-provided API credentials/configuration. That makes the environment file part of the deployment boundary rather than hardcoded source.
10. The platform folders (android, ios, macos, linux, windows, web) are standard Flutter host projects. They are important for packaging and launch, but they do not define application business logic. Native entrypoints like MainActivity.kt and AppDelegate.swift are minimal bootstrap layers.
11. Asset handling is present but not heavily exposed in the tree. The assets/ folder likely contains static resources used by the UI, while platform-specific splash and icon assets live in each host project. This means visual branding and static content are separated from the Dart feature code.
12. For a diagram, the key boundaries are:
- Presentation/UI boundary at presentation/
- Dependency injection/state boundary at providers
- Domain contract boundary at domain/
- External API boundary at infraestructure/datasources/
- Platform shell boundary at the native folders
The important arrows are the ones crossing from UI into providers, from providers into repository/data source implementations, and from the data source out to TMDb.
Main entry points: main.dart main.dart · home_screen.dart Home · movies_providers.dart Movie state · movie_repository_impl.dart Repo impl
Components 25
App Shell
Flutter entrypoint and host wrappers
- main.dart · App entrypoint wiring config and UI
lib/main.dart
Config
Cross-cutting app setup
Presentation
UI and Riverpod state
- Home · Primary movies feed screen
lib/presentation/screens/movies/home_screen.dart - Movie state · Feature state and selectors
lib/presentation/providers/movies/movies_providers.dart - Repo provider · Wires repository implementation into UI state
lib/presentation/providers/movies/movies_repository_provider.dart - Slideshow state · Hero slideshow state
lib/presentation/providers/movies/movies_slideshow_provider.dart - Loading state · Initial loading control
lib/presentation/providers/movies/initial_loading_provider.dart - List view · Horizontal movie list UI
lib/presentation/widgets/movies/movie_horizonal_listview.dart - Slideshow · Featured movies carousel
lib/presentation/widgets/movies/movies_slideshow.dart - Shared UI · Common app bar, nav, and loader widgets
lib/presentation/widgets/shared/custom_appbar.dart
Domain
Core movie contracts and entities
- Movie · Canonical movie model
lib/domain/entities/movie.dart - Data source · Abstract movie data access contract
lib/domain/datasources/movie_datasource.dart - Repository · Abstract movie repository contract
lib/domain/repositories/movie_repository.dart
Infrastructure
TMDb integration and data adaptation
- Repo impl · Concrete repository backed by TMDb
lib/infraestructure/repositories/movie_repository_impl.dart - TMDb source · Movie Database API access
lib/infraestructure/datasources/moviedb_datasource.dart - Mapper · Maps API models into domain movies
lib/infraestructure/mappers/movie_mapper.dart - TMDb response · API response envelope model
lib/infraestructure/models/moviesdb/moviedb_response.dart - TMDb movie · API movie item model
lib/infraestructure/models/moviesdb/movies_moviedb.dart
Connections 25
- main.dart → Router: routes · Bootstraps navigation
- main.dart → Theme: theme · Applies shared styling
- main.dart → Home: starts · Launches the primary UI
- Home → Movie state: reads · Consumes feature state
- Movie state → Repo provider: depends on · Resolves repository wiring
- Repo provider → Repo impl: creates · Provides concrete repository
- Repo impl → Repository: implements · Satisfies repository contract
- Repo impl → TMDb source: uses · Fetches data from TMDb
- Repo impl → Mapper: maps with · Transforms API models to domain
- TMDb source → Env: reads · Uses runtime API configuration
- TMDb source → TMDb response: returns · Decodes response envelopes
- TMDb response → TMDb movie: contains · Holds API movie items
- Mapper → Movie: produces · Builds canonical domain movies
- Data source → Movie: serves · Contract centers on domain movies
- Repository → Movie: serves · Repository contract exposes domain movies
- Home → List view: renders · Shows horizontal lists
- Home → Slideshow: renders · Shows featured slideshow
- Home → Shared UI: uses · Reuses common UI pieces
- Movie state → Slideshow state: includes · Feature slideshow state
- Movie state → Loading state: includes · Feature loading state
- Home → Formats: formats · Formats user-facing values
- Android → main.dart: boots · Launches Flutter app on Android
- iOS → main.dart: boots · Launches Flutter app on iOS
- Desktop → main.dart: boots · Launches Flutter app on desktop
- Web → main.dart: boots · Launches Flutter app on web