-
-
Notifications
You must be signed in to change notification settings - Fork 731
Tech Doc: How OFN is organized in Domains using Rails Engines
In OFN we use Rails Engines to organize our application in separate Business domains. The discussion originated in the 2018 Global Gathering in Barcelona and continued here in discourse.
For now, we started by extracting the Cookies feature into the new Web domain (see the PR here). The vision in terms of domains is the following (although we will adapt and change as we go):
- FrontOffice _ Web ___ Content CMS for the ecommerce website (including homepage, landing pages, map, menu and footer)
- FrontOffice _ Shop ______ Product Search and Display features on the ecommerce website
- FrontOffice _ Checkout _ Cart and Checkout flow features (includes User account and User registration)
- BackOffice _ Catalog ___ Product/Inventory management (including Order Cycle management)
- BackOffice _ Orders ____ Order Management System: Orders, packing and delivery management (including Invoicing and Accounting)
- BackOffice _ Entities ___ Entity Management: Enterprises and Customers management (CRM)
Content CMS for the ecommerce website (including homepage, landing pages, map, menu and footer)
Example API endpoints:
- /home - homepage
- /home/consumer - homepage for consumers
- /home/producer - homepage for producers
- /menu - app menu
- /map - map
Product Search and Display features on the ecommerce website
Example API endpoints:
- /shops - list of shops
- /shops/enterprise/1 - shop for enterprise 1
- /shops/enterprise/1/product/10 - product 10 details
- /shops/enterprise/1/product?description=carrot - search for carrots in enterprise 1
Cart and Checkout flow features (includes User account and User registration)
Example API endpoints:
- /cart - add, display and change the cart
- /checkout - collect details and submit purchases
- /user - user account and associated endpoints
- /user/registration - user registration process and data
Product/Inventory management (including Order Cycle management)
Example API endpoints:
- /product - similar to /shop but with more management capabilities, for example, bulk update actions
- /order_cycles/12 - manage Order Cycles details
- /product_import
Order Management System: Orders, packing and delivery management (including Invoicing and Accounting)
Example API endpoints:
- /orders - list orders and bulk actions
- /orders/1 - view and change order details
- /subscriptions
- /reports
Entity Management: Enterprises and Customers management (CRM)
Example API endpoints:
- /users
- /enterprises
- /customers
- /groups
This is a simple diagram showing very simple examples of dependencies between the domains.
Each domain structure will mimic the existing structure on the main app. Each domain has it's own controllers, services, models, views, assets and serialisers.
Rails Engines can be considered miniature applications, for more info see the Rails Guides entry for Rails Engines.
The OFN main application is under /app and each engine's code is under /engines/<engine_name>/app. The migration to engines will consist basically of moving files from /app/<relative_file_path> to /engines/<engine_name>/app/<relative_file_path>.
Each engine and the main app will have different ways of accessing/depending on (other) domains code:
- requiring another domain's modules and classes directly, for example, the main app FooterLinksHelper requires the Web domain CookiesConsent service simply by using
require 'web/cookies_consent'
- the best way to depend on another engine is through its routes (ideally the API routes) - like in Spree, each domain's routes are mounted on the base url with
mount Web::Engine, :at => '/'
Development environment setup
- Pipeline development process
- Bug severity
- Feature template (epic)
- Internationalisation (i18n)
- Dependency updates
Development
- Developer Guidelines
- The process of review, test, merge and deploy
- Making a great commit
- Making a great pull request
- Code Conventions
- Database migrations
- Testing and Rspec Tips
- Automated Testing Gotchas
- Rubocop
- Angular and OFN
- Feature toggles
- Stimulus and Turbo
Testing
- Testing process
- OFN Testing Documentation (Handbooks)
- Continuous Integration
- Parallelized test suite with knapsack
- Karma
Releasing
Specific features
Data and APIs
Instance-specific configuration
External services
Design