This repository is used to implement an event-based fraud detection system using Infrastructure as Code. The infrastructure is fully serverless and includes the following GCP services:
- BigQuery
- Cloud Build
- Cloud Functions
- Cloud Pub/Sub
- Cloud Run
- Cloud Storage
- Firestore
To run the demo, you need to have a Google Cloud project (that has the APIs listed above enabled), and also have Terraform installed on your device. Please stick to the steps below to set up ever
- Install the gcloud CLI
- Install the Terraform CLI
- Set
$GCP_CREDENTIALS
and$GCP_PROJECT_ID
as GitHub Actions secrets - Authenticate with your GCP project using
gcloud auth application-default login
- Push the image to your Artifact Repository
gcloud builds submit --tag <YOUR_GCP_REGION>-docker.pkg.dev/<YOUR_GCP_PROJECT_ID>/fraud-detection/event-producer`
export TF_VAR_region=<YOUR_GCP_REGION>
export TF_VAR_project_id=<YOUR_GCP_PROJECT_ID>
cd infrastructure
terraform init
terraform apply
- Populate the BigQuery dataset with data (most importantly the venues and users tables)
- Go to the Cloud Run console and use the generated URL to access the producer service
- Use the Streamlit UI to produce events
- After a certain number of events have been generated, you can check the fraud table to see which checkins have been deemed as fraudulent and need further investigation. Furthermore, you may choose to implement an analytics tool such as Looker Studio to produce dashboards and visualize your findings.
terraform destroy