How tybens/sartorial works
Main Components
• Frontend Application: Focus on the React code located in the “src” folder. This includes UI components, pages, hooks, assets, and routing. This portion is responsible for the overall user interface and interaction.
• Static Assets and Hosting: The “public” folder contains HTML files, images, videos, PDFs, and other static content. Firebase Hosting deploys these assets along with the React bundle.
• Backend Services – Firebase Cloud Functions: The “functions” directory contains server-side JavaScript that handles backend logic such as processing donations, handling checkout payments, or sending emails. This is an important microservice component.
• Database – Cloud Firestore: The presence of “firestore.rules” and “firestore.indexes.json” indicates a Firestore database, which stores transactional data, user data, products, orders, etc.
• Email Templates: The “emails” directory provides HTML templates for different email communications (like pickup or receipt notifications).
Relationships and Data Flow
• User Interaction: A user accesses the site via Firebase Hosting. The static files in “public” load the React app from “src.”
• API Calls: As users interact with the site (for example, submitting donation forms or checking out in the shop), the React application makes calls to Firebase Cloud Functions (in “functions”) to execute server-side operations.
• Database Integration: Cloud Functions interact with Firestore for reading and writing data (orders, product details, etc.). Also, the React frontend might query Firestore directly for real-time data, depending on the implementation.
• Email Communication: On events like order confirmation or shipment notifications, a Cloud Function sends emails using the HTML templates from the “emails” folder.
• Hosting Updates: Changes in the code (for instance, updates in “src” or “public”) are deployed via Firebase Hosting as configured by “firebase.json” and related configuration files.
Architectural Patterns and Important Design Principles
• Separation of Concerns: The clear separation between the React frontend (UI), Firebase Cloud Functions (backend logic), and Firestore (data storage) makes the architecture modular.
• Serverless Backend: Using Firebase Cloud Functions provides horizontal scalability and isolates concerns between business logic and the UI layer.
• Declarative UI and Component-Based Structure: The “src/components” and “src/pages” directories follow a component-based design typical of modern React applications.
• Security and Indexing: The Firestore rules and indexes ensure that data is secured and performance-tuned.
• Continuous Integration/Deployment: The presence of GitHub workflows (in .github/workflows) suggests automated CI/CD pipelines, which may be noted in the system deployment overview.
Relevant Technologies and Frameworks
• React for the frontend.
• Firebase Hosting for static content delivery.
• Firebase Cloud Functions (Node.js-based) for backend processing.
• Cloud Firestore for the database.
• GitHub Actions for deployment workflows (firebase-hosting-merge and pull-request workflows).
• Make note of any deployment configuration details, such as Firebase Hosting and GitHub workflows, to provide context on continuous integration/deployment.