Which PHP files do the saving of user's details

When a user signs in the first time to NextCloud which PHP files do the saving of user’s details to database?
Also what is the name of the db and table?
My aim is to run another PHP file when that happens.

I suggest to do this with a https://docs.nextcloud.com/server/latest/developer_manual/basics/events.html#listener-classes

I read about listeners as you suggested.
Where do I save a PHP file with a listener so it get loaded when NextCloud is run?
Do I add the name of the PHP in some ini or what?

So if I want get, say a Javascript alert(“a new user:”+$newuser) pop up when a new user added what would my PHP code look like.

A simple example “hello world” would suffice - just to get started.

I would suggest to do the app tutorial once to get a basic understanding of the nextcloud building blocks.