How betocattani/nfl-rushing works
• Client/Consumer: Represent users accessing either the GraphiQL Playground (via browser at localhost:4000/graphiql) or other external client applications that issue GraphQL queries and mutations.
• Web Server / Phoenix Endpoint: Include the Phoenix endpoint (lib/the_score_web/endpoint.ex) which receives HTTP requests and manages WebSocket connections (user_socket defined in channels).
• Router: Represent the Phoenix router (lib/the_score_web/router.ex) that dispatches incoming requests to the appropriate controllers or GraphQL schema.
• GraphQL API Layer:
• Schema: Illustrate the GraphQL schema (lib/the_score_web/schema.ex and submodules within lib/the_score_web/schema) where types, queries, and mutations are defined.
• Resolvers: Include the GraphQL resolvers (for example, lib/the_score_web/resolvers/players.ex) that contain the business logic to service GraphQL queries/mutations.
• Middleware: Represent the use of any middleware (lib/the_score_web/schema/middleware), such as changeset error handling.
• Business Logic / Domain Layer: Show the core application logic within the “the_score” context (from files in lib/the_score and lib/the_score/players) that encapsulates player profiles and related operations.
• Data Persistence / Repository Layer: Mark the “Repo” (lib/the_score/repo.ex) which is built with Ecto, and point out the existence of migrations (priv/repo/migrations) that define the PostgreSQL database schema.
• Database: Indicate PostgreSQL as the persistent storage layer.
Relationships and Data Flow
• From the Endpoint, indicate request routing through the Router to the GraphQL API layer.
• From the Resolver, show the connection to the Business Logic / Domain components (for instance, modules within lib/the_score and its players subdirectory).
• Development utilities (for example, dev/support/import_data.ex) as auxiliary components used for data seeding and import operations.
Architectural Patterns and Design Principles
• Separation of concerns: the presentation layer (Phoenix Web/Endpoint), the API layer (GraphQL schema and resolvers), the business logic (core domain modules), and the persistence layer (Ecto Repo and PostgreSQL).
• That the GraphQL API encapsulates the application’s external interface and provides flexible querying and mutation capabilities.