Welcome to the StudyBoard website! This README will guide you through the basic setup process after cloning or unzipping the project.
Before you begin, ensure you have met the following requirements:
- Node.js installed on your machine. You can download it from nodejs.org.
- npm (Node Package Manager) installed with Node.js.
- Clone or unzip the project to your local machine.
git clone https://github.com/ruvin27/studyboard.git
-
Navigate to the project directory.
cd studyboard
-
Navigate to the react frontend directory.
cd frontend -
Install project dependencies using npm.
npm install
-
Change laravel backend url in frontend\src\config.js to the route where your laravel backend will run.
-
You're now ready to start the development server.
npm start
-
Open your browser and visit http://localhost:3000 to see the app in action.
The project structure is organized as follows:
- src/: Contains the source code of the React app.
- src/features/: Reusable React components.
- src/assets/: Static assets containing CSS, JS, and images for the application.
- src/App.js: Top-level components representing different pages/routes.
- src/hooks: Data Management for the frontend
- src/lib: Api Client for calling api
- public/: Static assets and the
index.htmlfile.
To deploy the app to a production environment, follow these steps:
- Build the app using
npm run build.
You will get a dist folder containing the optimized production build of your app.
- Deploy the contents of the
distfolder to your web server or hosting service.
You can use services like Netlify, Vercel, or traditional web hosting to deploy your application.
Before setting up the MySQL database for the StudyBoard app, ensure you have Xampp installed on your machine.
-
Start the Apache and MySQL servers in Xampp.
-
Create a Database:
- Open PhpMyAdmin (usually at http://localhost/phpmyadmin).
- Create a new database named
rrr9569_studyboard.
-
Import SQL Scripts Manually:
-
Open PhpMyAdmin (usually at http://localhost/phpmyadmin).
-
Create the
rrr9569_studyboarddatabase. -
Choose the "SQL" tab.
-
Open the
createScripts.sqlfile in a text editor. -
Copy the contents of
createScripts.sqland paste them into the SQL tab. -
Execute the SQL query to create the necessary tables for the StudyBoard app.
-
Repeat the above steps for the
createData.sqlfile to populate the tables with initial data.
-
By following these steps, you can manually import the SQL scripts into your MySQL database for the StudyBoard app.
-
The
createScripts.sqlfile contains the SQL queries to create tables required for the StudyBoard app. -
The
createData.sqlfile contains the SQL queries to populate the tables with initial data.
Now, the MySQL database for the StudyBoard app is set up and ready to be used.
-
Place Backend Folder:
- Copy the contents of the
backendfolder. - Paste it into the
htdocsfolder within your XAMPP installation directory.
- Copy the contents of the
-
Install Dependencies:
- Open your terminal.
- Change the directory to the Laravel Backend folder:
composer install
-
Configure Connection Details:
- Open the
config.phpfile located in thebackendfolder using a text editor. - Update the file with your database connection details and email smtp details, such as hostname, username, password, and database name.
- Open the
-
Verify API Functionality:
- Ensure that your Apache and MySQL servers are running in XAMPP.
- Open your web browser and navigate to the API endpoint to verify functionality.
- You can run 'http://localhost/backend/api.php' as a test file.
-
Update Frontend API URL:
- Locate the axios configuration in all pages in your frontend.
- Update it with the appropriate URL to match your XAMPP setup.
By following these steps, you should have the PHP backend APIs up and running. Make sure to adjust the configuration based on your specific environment.
-
Navigate to Laravel Backend:
- Open your terminal.
- Change the directory to the Laravel Backend folder:
cd laravelBackend
-
Install Composer Dependencies:
- Run the following command to install the necessary dependencies:
composer install
- Run the following command to install the necessary dependencies:
-
Create and Configure .env File:
- Duplicate the
.env.examplefile in thelaravelBackenddirectory. - Rename the duplicated file to
.env. - Open the
.envfile and update the variables with your database and other configuration details.
- Duplicate the
-
Run Laravel Server:
- Start the Laravel development server with the following command:
php artisan serve
- This will launch the server at
http://localhost:8000by default.
- Start the Laravel development server with the following command:
-
Optional: Optimize Laravel (if needed):
- Run the following command to optimize Laravel (may be necessary when updating or adding APIs):
php artisan optimize
- Run the following command to optimize Laravel (may be necessary when updating or adding APIs):
By following these steps, you should have the Laravel backend connected to the React frontend up and running. Adjust configurations as needed for your environment.
-
Navigate to Chat Nodejs:
cd chat -
Install Node.js Dependencies:
npm install
-
Start the Chat Server:
npm start
Ensure the server is running at
http://localhost:5000. -
Update the AuthContext.jsx File:
- Open
frontend/src/contexts/AuthContext.jsx. - Update the
serverURLtohttp://localhost:5000.
- Open
-
Navigate to TextPredictionApi Nodejs:
cd TextPredictionApi -
Install Node.js Dependencies:
npm i
-
Create .env File:
- Create a file named
.envin theTextPredictionApidirectory. - Paste the following content into the
.envfile:OPENAI_KEY='YOUR_OPENAI_KEY'
- Create a file named
-
Start the Text Prediction API Server:
npm start
Ensure the server is running at
http://localhost:6000. -
Update the sendRecommendations.jsx File:
- Open
frontend/src/features/PC/sendRecommendations.jsx. - Update the
TextPredictionUrltohttp://localhost:6000.
- Open
By following these steps, you should have the Chat Nodejs and TextPredictionApi Nodejs servers set up and configured for the StudyBoard app. Adjust configurations as needed for your environment.
That's it! You should now have the StudyBoard website up and running on your local machine.