Bile salts are steroid acids derived from cholesterol in the liver, are released into the gastrointestinal tract to aid in digestion and are thoroughly modified by the resident gut microbiota. Bile acids act as versatile signaling molecules with a variety of endocrine functions and are linked to several diseases. In particular, serum and urinary bile salts represent biomarkers for early diagnostics of liver dysfunction, yet their current detection methods are impractical and hard to scale. Here the inventors engineered engineered synthetic bile salt receptors using VtrA as sensing domains connected to E. coli CadC system which activates transcription upon dimerization. The performance of the system was assayed for various selection of promoters and they can show that fine tunable response that may be reached by changing expression levels of the bile salt receptor. By performing multiple rounds of directed evolution of the VtrA sensor the inventors obtained a collection of variants with a lower limit of detection and a higher sensitivity. Finally, they show that their bactosensor can detect pathological bile-salt concentrations in samples from patients with liver dysfunction. The present invention thus relates to bile salts bactosensor and use thereof for diagnostic and therapeutic purposes.