In Truffle 0.2.x or 0.3.x with the truffle-default-builder, app.js in the ./build folder will include considerable bootstrap code that sets the stage.
This is why the HTML should link to the ./build folder when the source appears to reside in ./app (usually). It's the build output that should be served.
Truffle includes a simple Migrations.sol contract in all projects. It's involved as a sort of name registry when you deploy with
$ truffle migrate or interrogate the contract addresses with
$ truffle networks.
contractName.sol.js. That's where a lot of the ABI and promisifying happens.
When you have an app.js front-end and you use the build pipeline, truffle injects code about your code in the ./build folder. You can see Web3 there and also see Migrations is involved.
They have a config file that describes the files to include in the build process, and the network configuration for the blockchain. Truffle uses this during build and migrate.
For example, I found this in one of my app.js output files.
So, in terms of "I can't understand how - in app.js - they use the deployed contract without a web3 provider"
- They load a web3 provider. They do it for you.
- They know where the contract is deployed. They track it as they do
the deployments for you.
- The app.js you work on is an input to pipeline that outputs a
Hope it helps.