It depends on what your module is rendering. It boils down to
do not render private, customer specific data server side.
The exception being on completely un-cached pages (for example the customer account dashboad).
In summary, I think it boils down to approaching module creation with a client-side first mindset. It is best to assume that GET and HEAD requests will never reach Magento, and as such relying on plugins or observers or other server side tools only for customizations is not a good approach.
Some details I'd look for to check if a module will work well with Varnish:
If the block isPrivateScope()
method returns true, then it can render private data, but only during the Ajax request and not during the regular page rendering.
Otherwise the private data will end up in the full page cache.
The right way to render private data is using client side rendering with the private content sections customer-data
requirejs module from the Mage_Customer
module.
This can be done using a UI component or a regular custom requirejs module.
How to do this isn't part of the question so I'll won't go into details here.
Implementing the IdentityInterface
is only important so the cache gets flushed at the right time. Depending on what your module is rendering that might not even be necessary.
Another thing I consider important for a module to be Varnish compatible is to not add a block with cacheable="false"
to any existing page. Adding new non-cached pages might be okay, depending on the type of page.