Nested URL with categories, sub categories and pages in between

I’m a bit new to wordpress and would like to know how to achieve the following structure. Essentially I’m creating a website for a store that carries multiple products. For example:

site.com/brand/<brand1>/products/<product1>
site.com/brand/<brand1>/products/<product2>
site.com/brand/<brand2>/products/<product3>

also as part of the requirement:

site.com/brand loads a page that will display all available brands
site.com/brand/<brand1>/products loads a page that will display all available products for brand 1

Is there a way for me to achieve this without using any plugin? I prefer to create a custom code instead.