Loading repository data…
Loading repository data…
sjg / repository
My Search Story is a demo application developed for the Data Portability API Workshop and the #AISprint2025 events. The app turns your search history into amzing and fantastical stories #BuildwithAI
Turn your Google search history into unique, AI-generated stories, complete with audio narration and a custom background image! ✨
This project uses the Google Data Portability API to fetch your search activity and then leverages Google's powerful Generative AI (Gemini and Imagen) to create a unique piece of art based on your digital footprint.
#DataPortabilityAPI #BuildWithGemini #AISprint
Note: The Data Portability API is currently only available for end users in the European Economic Area (EEA)
googleapis, @google/generative-ai, @google-cloud/text-to-speech, dotenv, dayjs, uuid, jszip.Follow these steps to get the project running on your local machine.
Clone the repository:
git clone https://github.com/your-username/my-search-story.git
cd my-search-story
Install dependencies:
npm install
Set up Google Cloud:
Set up DPAPI
Create a .env file:
Create a file named .env in the root of the project and add the following, replacing the placeholder values with your own credentials from the previous step.
# Application Port
APP_PORT=3000
# Google OAuth Credentials
GOOGLE_CLIENT_ID=YOUR_GOOGLE_CLIENT_ID
GOOGLE_CLIENT_SECRET=YOUR_GOOGLE_CLIENT_SECRET
GOOGLE_REDIRECT_URL=http://localhost
# Google Cloud Project & API Keys
GCP_PROJECT_ID=YOUR_GCP_PROJECT_ID
GOOGLE_GEN_API_KEY=YOUR_API_KEY_FOR_GEMINI
Note: For Text-to-Speech and Imagen (Vertex AI), this application uses Application Default Credentials (ADC). Make sure you are authenticated by running
gcloud auth application-default loginin your terminal.
Start the server:
npm start
Open your browser:
Navigate to http://localhost:3000 (or the port you specified in your .env file).
Build the Docker image:
docker build -t my-search-story .
Run the Docker container:
docker run --rm -it \
-p 3000:3000 \
--env-file .env \
-v "$(pwd)/data:/usr/src/app/data" \
-v ~/.config/gcloud/application_default_credentials.json:/gcp/adc.json \
-e GOOGLE_APPLICATION_CREDENTIALS=/gcp/adc.json \
--name my-search-story-container \
my-search-story
Open your browser:
Navigate to http://localhost:3000 (or the port you specified in your .env file).
You can deploy this project as a serverless container using Google Cloud Run and set up a CI/CD pipeline with Cloud Build.
Your API keys and client secrets should not be in your repository. Store them securely in Google Cloud's Secret Manager.
My-Search-Story..env file. The cloudbuild.yaml is configured to parse this secret and provide the values to your Cloud Run service.cloudbuild.yamlAdd the cloudbuild.yaml file (provided in the repository) to the root of your project. This file tells Cloud Build how to build and deploy your application.
The Cloud Build service account needs permission to deploy to Cloud Run and access your secrets.
@cloudbuild.gserviceaccount.com.Cloud Run AdminService Account UserSecret Manager Secret Accessor^main$ (or your default branch)/cloudbuild.yamlNow, every time you push to your main branch, Cloud Build will automatically deploy a new version of your service to Cloud Run!
Note on Data Persistence: Cloud Run uses an ephemeral filesystem. This means any files saved to the
/datadirectory will be lost when an instance restarts. For a production setup, you should modify the application to use Google Cloud Storage for saving and retrieving story data.
/
├── data/ # Stores downloaded data archives and generated stories
├── static/ # CSS, client-side JS, and other static assets
├── views/ # EJS template files for the UI
├── main.js # The main Express server file
├── package.json
└── README.md