relay with openhab

iam doing a simplke project with 1-channel relay controlling a light with it and i wan to operate with openhab through web i need support for doing it and also i need how to create the switch and coding.

Check Sonoff and Tasmota firmware, on the Openhab side you just need the MQTT binding. Here is a wiki from the tasmota firmware.

You can easily replace the Sonoff with custom hardware based on ESP8266 and the tasmota firmware with one you create as long as it’s based on MQTT protocol.