The Cherenkov Telescope Array (CTA) Observatory, with dozens of telescopes located in both the Northern and Southern Hemispheres, will be the largest ground-based gamma-ray observatory and will provide broad energy coverage from 20 GeV to 300 TeV. The large effective area and field-of-view, coupled with the fast slewing capability and unprecedented sensitivity, make CTA a crucial instrument for the future of ground-based gamma-ray astronomy. To maximise the scientific return, the array will send alerts on transients and variable phenomena (e.g. gamma-ray burst, active galactic nuclei, gamma-ray binaries, serendipitous sources). Rapid and effective communication to the community requires a reliable and automated system to detect and issue candidate science alerts. This automation will be accomplished by the Science Alert Generation (SAG) pipeline, a key system of the CTA Observatory. SAG is part of the Array Control and Data Acquisition (ACADA) working group. The SAG working group develops the pipelines to perform data reconstruction, data quality monitoring, science monitoring and real-time alert issuing during observations to the Transients Handler functionality of ACADA. SAG is the system that performs the first real-time scientific analysis after the data acquisition. The system performs analysis on multiple time scales (from seconds to hours). abrb{SAG must issue candidate science alerts within} 20 seconds from the data taking and with sensitivity at least half of the CTA nominal sensitivity. These challenging requirements must be fulfilled by managing trigger rates of tens of kHz from the arrays. Dedicated and highly optimised software and hardware architecture must thus be designed and tested. In this work, we present the general architecture of the ACADA-SAG system.