How crystallizeapi/furniture-remix works
Project Type and Purpose
• This is a full-stack web application built using Remix Run as a framework.
• It is intended to serve as a boilerplate for Crystallize-powered stores. The application handles storefront operations, order management, payment integrations (with providers like Adyen, Stripe, Vipps, etc.), and supports multilingual and multi-tenant features.
• The README also indicates support for a local development workflow with Docker, local HTTPS via a Caddy proxy, and integrations like Mailcatcher and Redis.
File Structure
• The top-level “application” folder contains all the core parts of the Remix Run app:
• Source code in the “src” directory is organized into sub-folders for “ui” (React components, pages, and state management), “core” (server-specific logic like authentication and cookies), “routes” (defining both page routes and API endpoints), and “use-cases” (business logic, payment handling, data fetchers, mappers, etc.).
• The “provisioning” directory includes infrastructure-related files such as Docker Compose configurations and files for reverse-proxy (Caddy) and local development (e.g., tenant and clone setups).
• The “.github” folder holds continuous integration workflows and templates that ensure development quality.
• The presence of numerous directories under “use-cases” (e.g., payments, crystallize read/write, contracts, mapper, etc.) shows that there is a strong emphasis on separating domain logic and integration code for external services.
Key Architectural Components
a. Frontend (Client-side UI):
• Represented by React components, pages, and UI libraries located under “application/src/ui” and "application/src/routes".
• Components such as product listings, shopping cart, checkout forms, and payment components.
b. Backend (Server-side / API Endpoints):
• Represented by the Remix routes in “application/src/routes” that handle web requests both for user-facing pages and API calls (order placement, payment processing, magicklink authentication, etc.).
• Server logic in “application/src/core” for cookies, authentication, and server-rendering aspects.
c. Business Logic & Use-Cases:
• The “application/src/use-cases” directory encapsulates core business logic such as checkout handling, payments processing with different providers (Adyen, Stripe, Vipps, etc.), data mapping, and service API integrations.
d. External and Infrastructure Services:
• Docker-managed services such as Mailcatcher (for email testing), Redis (for caching or session storage), and the Caddy proxy that provides HTTPS termination.
• You may also highlight integration with third-party payment gateways and Crystallize’s API endpoints for content and storefront data.
e. Development & Deployment Tools:
• Use of provisioning files (docker-compose.yaml, Caddyfile) that aid in local development and deployment.
• Mention the Makefile commands (e.g., “make serve” and “make stop”) that help orchestrate these services.
Architectural Patterns & Principles
• The system is designed following a layered architecture: separation of concerns between presentation (UI), business logic (use-cases), and system integration (external APIs and infrastructure).
• There is a clear separation between frontend and backend, with remix routes handling server-side logic and React components providing dynamic client-side interactions.
• Modularity is further highlighted through the “use-cases” and “mapper” folders, enforcing SRP (Single Responsibility Principle) and reusability across the code.
Final Suggestions
• Be as detailed as possible—don’t shy away from separating out the use-case components and API endpoints if they represent distinct functionality.
• Elements unique to this project, like the integration with Crystallize, the provisioning for local development using Docker, and how the Remix framework organizes routes and business logic.