Execute a function when a entry is saved or new created

Hey there,

I want to make a plugin that executes some code based in the new entry made in starpi dashboard. For example. You have a restaurants content type. Then when a new restaurant is added, execute some code with the data form that restaurant, for example the name and location. After that, save some new stuff the that restaurant inside a custom field or something else. (Just save it inside the database)

Does anyone know or can help me get there?