We introduce SoFiA, a flexible software application for the detection and parameterization of sources in 3D spectral-line datasets. SoFiA combines for the first time in a single piece of software a set of new source-finding and parameterization algorithms developed on the way to future HI surveys with ASKAP (WALLABY, DINGO) and APERTIF. It is designed to enable the general use of these new algorithms by the community on a broad range of datasets. The key advantages of SoFiA are the ability to: search for line emission on multiple scales to detect 3D sources in a complete and reliable way, taking into account noise level variations and the presence of artefacts in a data cube; estimate the reliability of individual detections; look for signal in arbitrarily large data cubes using a catalogue of 3D coordinates as a prior; provide a wide range of source parameters and output products which facilitate further analysis by the user. We highlight the modularity of SoFiA, which makes it a flexible package allowing users to select and apply only the algorithms useful for their data and science questions. This modularity makes it also possible to easily expand SoFiA in order to include additional methods as they become available. The full SoFiA distribution, including a dedicated graphical user interface, is publicly available for download.