-$basedir = BasePath::create(__DIR__, $_SERVER);
-$configLoader = new Cache\ConfigCacheLoader($basedir);
-$configCache = Factory\ConfigFactory::createCache($configLoader);
-Factory\DBFactory::init($configCache, $_SERVER);
-$config = Factory\ConfigFactory::createConfig($configCache);
-// needed to call PConfig::init()
-Factory\ConfigFactory::createPConfig($configCache);
-$logger = Factory\LoggerFactory::create('index', $config);
-$profiler = Factory\ProfilerFactory::create($logger, $config);
-
-// We assume that the index.php is called by a frontend process
-// The value is set to "true" by default in App
-$a = new App($config, $logger, $profiler, false);
-
-$a->runFrontend();
+$dice = (new Dice())->addRules(include __DIR__ . '/static/dependencies.config.php');
+$dice = $dice->addRule(Friendica\App\Mode::class, ['call' => [['determineRunMode', [false, $_SERVER], Dice::CHAIN_CALL]]]);
+
+\Friendica\DI::init($dice);
+
+$a = \Friendica\DI::app();
+
+\Friendica\DI::mode()->setExecutor(\Friendica\App\Mode::INDEX);
+
+$a->runFrontend(
+ $dice->create(\Friendica\App\Module::class),
+ $dice->create(\Friendica\App\Router::class),
+ $dice->create(\Friendica\Core\PConfig\IPConfig::class),
+ $dice->create(\Friendica\Security\Authentication::class),
+ $dice->create(\Friendica\App\Page::class),
+ $start_time
+);