How klubjagiellonski/pola-web works
Project Context and Purpose
• The project is a React-based web interface built with Gatsby (as seen in the gatsby-config.js, gatsby-node.js, and use of Gatsby plugins). It serves as the frontend for the “Pola. Zabierz ją na zakupy” application.
• Its main purpose is to let users scan product barcodes to retrieve information about whether a product is produced by a local Polish company. It works in close cooperation with a separate backend (hosted on Heroku) that supplies Pola API data.
High-Level Architecture Components
• “Presentation Layer”: This includes all the UI components built using React and organized under src/pages, src/components, and other module-specific directories (e.g., src/business, src/friends, src/newsletter, src/search, src/posts, etc.). These represent various parts of the user interface such as business profiles, article pages, search functionality, and partner information.
• “Data / Content Layer”: The content folder (with markdown files, JSON, YAML, and images) holds the static content served by Gatsby. In addition, Gatsby’s built-in GraphQL layer acts as a bridge to query this content during build and at run-time through the GraphQL explorer.
• “State Management and Business Logic”: The use of Redux (or a similar flux pattern) is evident in the state directories (e.g., src/app/state, src/business/state, src/friends/state, etc.). This layer handles global state, API errors, and other business logic.
• “Integration with Backend Services”: Although the primary logic and rendering occur on the frontend, the application makes API calls to the Pola backend server. This is represented by services files in various modules (e.g., src/newsletter/services, src/search/services, src/posts/services) that encapsulate external API communication.
• “Deployment/CI/CD Infrastructure”: The existence of Dockerfile, docker-compose.yaml, and GitHub workflow configuration files (.github/workflows/ci.yaml) suggest that deployment and continuous integration are configured. This pipeline automatically deploys changes (e.g., to GitHub Pages for the frontend and uses Heroku for the Pola API).
• “Testing Infrastructure”: Directories like __mocks__, src/test, and Jest configuration files are responsible for unit and integration testing.
Key Architectural Patterns and Technologies
• Use of Gatsby as a static site generator, which implies a build-time data-fetch paradigm using GraphQL.
• React component-based design and a Redux-like state management pattern for handling UI state and business logic.
• Modular organization: The project is split into folders that represent specific features (e.g., business, posts, newsletter, materials, suppliers) demonstrating a layered and domain-driven design.
• CI/CD integration with GitHub Actions and deployment through Docker and GitHub Pages.
• Testing infrastructure using Jest and React Testing Library for component verification.