You will need to have the following software installed on your machine:
-
Clone the repository:
git clone https://github.com/yourusername/yourproject.git cd yourproject -
Install the dependencies:
npm install
-
Set up environment variables:
- Create a
.envfile in the root of your project directory and add the required environment variables. You can use the.env.examplefile as a template:GOOGLE_API_KEY=your-google-api-key GOOGLE_EMBED_KEY=your-google-embed-key
- Create a
-
Download and place your Google Cloud service account key file:
- Download your service account key file from the Google Cloud Console.
- Rename the file to
sonic-provider-426804-g7-06bcec5576c1.jsonand place it in theconfigdirectory. The directory structure should look like this:project-root/ ├── config/ │ └── sonic-provider-426804-g7-06bcec5576c1.json
-
Set up Google Cloud Storage:
- Make sure your
googleCloudStorage.jsfile is configured correctly. It should look like this:const { Storage } = require('@google-cloud/storage'); const path = require('path'); // Path to your service account key file const serviceKey = path.join(__dirname, './config/sonic-provider-426804-g7-06bcec5576c1.json'); // Create a new instance of the storage client const storage = new Storage({ keyFilename: serviceKey, projectId: 'My First Project', // Replace with your project ID }); const bucketName = 'capestone_20240709'; // Replace with your bucket name const bucket = storage.bucket(bucketName); module.exports = bucket;
- Make sure your
-
Run the backend and frontend:
npm start
Here is an example of what your .env file should look like:
GOOGLE_API_KEY=your-google-api-key
GOOGLE_EMBED_KEY=your-google-embed-key