Skip to content

prajwal-svm/SmartHomes

Repository files navigation

React + Java Servlets Setup Guide

smart_homes

Apache Tomcat: https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.94/bin/apache-tomcat-9.0.94.zip

To get started with the SmartHomes project, follow these steps:

  1. Place the Source Code: Copy the source code into the webapps folder of your Tomcat installation, specifically under the SmartHomes directory.

    # /usr/local/apache-tomcat-9.0.94/webapps/SmartHomes/.env
    OPENAI_API_KEY=your_openai_key_here
    UPLOAD_DIR=/usr/local/apache-tomcat-9.0.94/webapps/SmartHomes/uploads
    DB_URL=jdbc:mysql://localhost:3306/smartHomes
    DB_USERNAME=your_db_username
    DB_PASSWORD=your_db_password
    ELASTIC_API_KEY=your_elastic_api_key_here

    1.1 Run elastic search migration

    cd seed-elastic-search
    npm install
    npm run migrate
  2. Start the Frontend Server: Navigate to the frontend directory and run the following commands to install dependencies and start the frontend server:

    cd frontend
    npm install
    npm run dev
  3. Deploy the Java Servlets: Make the deployment script executable and run it to deploy the Java servlets:

    chmod +x deploy.sh
    ./deploy.sh
  4. Start MySQL Service: Use Homebrew to start the MySQL service:

    brew services start mysql
    mysql -u root -p
  5. Start MongoDB Service: Similarly, start the MongoDB service:

    brew services start mongodb-community@6.0
    mongosh
  6. Create the Database: In the MySQL shell, create the smarthomes database and import the schema:

    CREATE DATABASE smarthomes;
  7. Verify Services: Ensure that both MySQL and MongoDB services are running properly. You can check their status with:

    brew services list
  8. Create MongoDB Collections: In the MongoDB shell, create the productReviews collection:

use smarthomes
db.createCollection("productReviews")
  1. Import the mongo schema and data: In the MongoDB shell, import the mongoSchema.js file:

    mongo smarthomes mongoSchema.mongo
  2. Access the Application: Open your web browser and navigate to http://localhost:5173 to access the SmartHomes application.

About

Ecommerce Site Built with React and Java Servlets

Resources

Stars

Watchers

Forks

Contributors