Code your Factory
Learn how to properly code a Factory, starting with the model contract (i.e., the contract that the Factory will be able to clone).
Before going deeper you should read the Factory Learn page of introduction and the Create Your Own Factory section.

Overview

A general overview of how to code a Factory
Learn how to code a model contract that can be cloned and initialized with custom parameters by your Factory contract
Learn how to code the Factory contract according to your needs. A Factory can implement a fee-based business model or not. There are developmental differences between the two cases