Egg production of laying hens is influenced by various factors, including temperature, humidity, and the quality of the cage environment. The main problem in this study is the fluctuation of production due to changes in environmental conditions that are not optimal. This study aims to develop and implement a smart farming system based on the internet of things (IoT) that is able to optimize egg production of laying hens through automatic monitoring of cage temperature and humidity. The methods used include needs analysis, design, implementation and testing. The results showed that the accuracy of the system reached 80% which could maintain the cage environmental conditions within the optimal range, so that egg production increased from an average of 383.67 eggs per month to 390.33 eggs per month.