LavanyaBansod/bond-engine-mvp
Distributed identity resolution engine with retroactive data stitching.
π¦ The Bond Engine: Real-Time Identity Resolution
The Bond Engine is a data pipeline built to bridge the gap between anonymous web visitors and identified user profiles. This project features a Retroactive Identity Stitching system that connects a user's past browsing history to their identity the moment they sign up or check out.
π The Main Feature: "Retroactive Stitching"
Most tracking tools only start recording data after a user logs in. The Bond Engine starts tracking anonymously from the very first click. Once a user identifies themselves (like entering an email at checkout), the system goes back in time and "stitches" their entire anonymous history to their new profile, so no data is lost.
π οΈ How it's Built
The project is split into three separate parts that work together:
-
The Storefront (Django): - A full e-commerce website where users browse products.
- Attribution: The base store template and logic were provided by Dennis Ivy.
- My Addition: Custom JavaScript "listeners" that watch for user behavior and handle the identity bonding.
-
The Processing Brain (FastAPI):
- A standalone server that handles incoming data.
- It manages the database and runs the logic that connects anonymous IDs to real emails.
-
The Live Dashboard (Streamlit):
- A monitoring tool that shows the database in real-time.
- It triggers Discord alerts to notify sales teams when a high-value user is identified.
π§ How the Logic Evolved
- Phase 1: A "Brain-First" Approach: I started by building the logic in FastAPI first. I wanted to create a central hub that could process tracking data independently. Instead of building a whole website from scratch, I found a solid e-commerce "Body" in Django and connected the two. This shows the system is flexibleβthe Brain could technically work with any frontend.
- Phase 2: Finding the Data Gap: I realized that if someone browses 10 products and then enters their email, those 10 views would stay "anonymous" and be wasted.
- Phase 3: The "Stitch" Solution: I used
localStorageto give every browser a unique "Butterfly ID." When an email is captured, the system runs a search through the database and updates all old records that have that ID with the new email. - Phase 4: Real-Time Notifications: I added Discord alerts to act like a "Sales Sniper" tool, so a team knows exactly when a specific person returns to the site.
π Tech Stack
- Languages: Python, JavaScript, SQL
- Frameworks: Django, FastAPI, Streamlit
- Database: SQLite3
- Integrations: Discord Webhooks
βοΈ Setup and Usage
To run this project locally, you will need to open three separate terminals and run these commands:
-
Start the FastAPI Brain:
uvicorn server:app --port 8001 --reload
-
Start the Django Store:
cd django_ecommerce_mod5 python manage.py runserver -
Start the Streamlit Dashboard:
streamlit run app.py
π‘ The Big Picture (Future Scaling)
If this were expanded for a massive company, the tools would grow into:
- Kafka: To handle millions of clicks at once without crashing.
- Redis: For instant, split-second user recognition.
- Snowflake:: For storing years of historical data for deep analysis.
