How to keep Ecto out of web layer

I definitely agree. If the validations and changesets were usable without pulling in the SQL bits then it would go a long way. One of the benefits is it would let you analyze and ensure properties of your application just by looking at the application and dependency level, without even needing to look at the code (i.e. if the application doesn’t depend on ecto_sql then it cannot do any database access).