Is it possible to compile and upload code witout the IDE?
Yes, I haven't used it but on the official page it is mentioned, called Arduino CLI (command line interface), available for Mac and Linux.
https://www.arduino.cc/pro/cli
Excerpt:

Arduino CLI is a command line tool that contains all you need to
easily build applications around the Arduino ecosystem. Parse the JSON
output of the CLI or implement it as an always-on service that accepts
commands via a gRPC interface using your language of choice.
Arduino CLI is the backbone of the Arduino Create Web Editor serving
over a million users.

Also, it's open source and can be found on GitHub at https://github.com/arduino/arduino-cli/releases