How sharetribe/web-template works
Main Components
a. Client/Frontend Application
• Located mainly in the “src” directory and “public” folder.
• Built with React (using create-react-app), including routing, components, containers, and a rich set of UI elements.
• Uses state management (e.g., ducks in “src/ducks”), and includes analytics, translations, and custom CSS.
b. Server/Backend Application
• Found in the “server” directory.
• Provides API endpoints, server-side rendering, middleware (authentication, data loading, etc.), and integration with external services.
• Contains configuration and utility files (e.g., “server/apiRouter.js”, “server/index.js”).
c. Transaction Process Modules
• In the “ext/transaction-processes” directory.
• These modules provide standardized workflows (booking, inquiry, purchase) with templates and configuration files.
d. External Services and Integrations
• Payment processing (Stripe integrations seen in containers like “StripeConnectAccountForm”, “StripePaymentAddress”, etc.)
• Social authentication providers (Facebook, Google, etc. under “server/api/auth”).
• Mapping and geocoding services (Google Maps and Mapbox integration in “src/components/Map” and “src/components/LocationAutocompleteInput”).
• Deployment and CI/CD services (CircleCI configuration, GitHub integration, and Heroku deployment instructions).
Relationships and Interactions
• The backend handles SSR for quicker initial loads and also serves static assets (from “public”).
• The server integrates with external services (authentication providers, payment gateways, maps) and the transaction-process modules.
• The “ext” folder modules can be seen as pluggable components that handle specific business workflows (e.g., booking or inquiry) which are invoked from the backend logic.
• Configuration files and environment setups are central for both development and production, showing a two-way configuration dependency.
Architectural Patterns and Design Principles
• Separation of concerns: clear separation between frontend (React components with client-side routing) and backend (API server with SSR).
• Modular design: lots of reusable components (present in “src/components”) and modular containers (pages, authentication, transaction, listing).
• Extensibility: The “ext” folder allows for custom transaction processes – a plug-in-like approach for adding or replacing business logic.
• Environment-specific configurations: use of multiple .env files, CircleCI, and patches ensures a consistent deployment pipeline.
• Integration with external libraries: payment (Stripe), maps (Google/Mapbox), and social login integrations (Facebook, Google).
Relevant Technologies and Frameworks
• Client: React, Redux (or ducks pattern), Webpack (via create-react-app), custom CSS modules.
• Server: Node.js (Express-like API structure), SSR techniques, custom middleware (for authentication, error handling, CSP).
• Continuous Integration/Deployment: CircleCI, Heroku.
• Third-party APIs: Social login providers, Stripe for payments, Mapbox/Google Maps for geographical data.