Search engine with a React frontend, Keycloak authentication, a Node.js backend, and a PostgreSQL database
- Pull and run docker keycloak
docker pull jboss/keycloak
docker run -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin -p 8180:8080 jboss/keycloak
- Set up Realm, client and users.
- Initializes a new Node.js project and install dependencies
npm init -y
npm i express cors jsonwebtoken dotenv pg
-
Set up in .env: keycloak public key and PSQL variables (user, host, db_name, db_password).
-
Run server
node server.js
- Create a new React application and install dependencies.
npx create-react-app .
npm install keycloak-js axios
- Start client
npm start
- Install PostgreSQL
- For this tutorial I created a simple table as an example:
CREATE TABLE biosample (
id SERIAL PRIMARY KEY,
biosample VARCHAR(30),
bioproject VARCHAR(30),
drr VARCHAR(30),
email VARCHAR(100)
);
INSERT INTO biosample (biosample, bioproject, drr, email) VALUES ('BS12345', 'BP12345', 'DRR12345', 'newuser@server.com');