I am trying to understand how sidekiq works.
Does sidekiq load all the dependencies via the rails initializer by loading all the gems or does it use some sort of an applications server while spawning its workers?
Bundler loads the gems that Sidekiq depends on. Rails and/or your initializer load your application code. Sidekiq will automatically boot Rails so it can load the app code if it detects Rails, otherwise you have to use
-r to tell Sidekiq the file to require to boot your app.
See the code in sidekiq/cli.rb for the exact details.