DEV Community

Noureddine AMMAR
Noureddine AMMAR

Posted on

How can I connect to a database directly without apis from an react app ?

I need to connect to an existing database directly from my react application without using apis.
I try typeorm, mariadb connector but always i have problems.

Top comments (2)

Collapse
 
vishalraj82 profile image
Vishal Raj

@noureddineammar You must understand that a front-end cannot connect directly to Database services. Reason ? Simple. For each service side programming languages you have to install drivers which let you connect with the actual database. These drivers interact with the server OS to manage the connections. There is no way all this can ever be done in frontend. So no direct db connection from frontend. YOU NEED A SERVER API.

Collapse
 
edshav profile image
Eduard

You can use Next.js