top of page
Writer's pictureAdam Ginsburg

Building the AI Strategy App with Buzzy, OpenAI, and MongoDB: A Behind-the-Scenes Look (Part 2)

Updated: Jul 25

In a previous article, we explored how we built the AI Strategy Plan application using Buzzy. This app aims to simplify AI adoption by generating customized AI strategies for organizations, documenting them in a shareable and trackable format, and recommending relevant AI tools. Now, let’s dive into the technical details and components that power this solution.



Screenshots of the AI strategy app with Buzzy, OpenAI and MongoDB logos


Background


The AI Strategy Plan application addresses a common challenge: many people are aware of AI but struggle to understand how to use it effectively. Utilizing tools like ChatGPT can be time-consuming, and prompting can be complex. Our app aims to overcome these obstacles by:


  1. Generating a customized AI strategy for the user or organization.

  2. Documenting the strategy in a format that can be shared and tracked by the team.

  3. Recommending AI tools relevant to the tasks at hand.


In this article, we’ll explore the underlying architecture and technologies used to build this SaaS application. Here's the app in action:




SaaS Architecture Overview


Our application enables users to sign up and subscribe to generate AI strategies tailored to their business needs. Here’s how it works:


  1. User Input: Users provide details about their organization’s challenges and time-consuming tasks.

  2. OpenAI Integration: We call OpenAI’s API via an AWS Lambda function to process the input. This could also be achieved using no-code tools like Zapier, Make, or Respell.

  3. Data Storage: The response is stored in Buzzy using the Buzzy REST API, creating a structured set of strategies. These strategies are further broken down into projects and tasks, allowing documentation and tracking.



Implementation Details


We leveraged Buzzy’s security model to manage data access. Each new organization gets a Buzzy Team set up. Membership control, such as adding users to teams, is handled through Buzzy API calls, facilitated by middleware (e.g., AWS Lambda).


Here’s a simplified overview of the application’s data structure:


  • User: Represents an individual user who can belong to multiple organizations.

    • Fields: Name, Email, Paid Status, etc.

  • Organization: Represents an organization.

    • Fields: Name, Members (linking to users), Strategies (linking to strategies)

  • Strategies: Contain projects.

    • Fields: Name, Description, etc.

  • Projects: Contain tasks.

    • Fields: Name, Description, etc.

  • Tasks: Contain task details.

    • Fields: Name, Status, etc.

  • Notes: Attached to various entities.

    • Fields: Note Content, Date, Submitted By, etc.


Using Buzzy’s inheritance settings, new “child” records automatically inherit the access permissions from their parent records, simplifying access control.


For more details on Buzzy’s security model, watch this video: Buzzy Security Model Video.



AWS Lambda Integration


We use two main Lambda functions:

  1. Generate_strategy: Handles the initial generation of strategies and their sub-tables, and recommends tools using embeddings and MongoDB Vector Search.

  2. Add_user_to_organization: Manages adding users to organizations.


Before users can create organizations, they must sign up for the AI Strategy Plan. A Stripe webhook triggers a Lambda function that updates the user’s status to “Paid,” granting access. For a similar pattern, see the Buzzy T-shirt app example: Buzzy T-shirt App Case Study.



Vector Search Implementation


Vector Search and Embeddings:

Vector search utilizes embeddings—numerical representations of data points in high-dimensional space—to enhance search accuracy and efficiency. Unlike traditional keyword search, which matches exact words, vector search understands context and semantics, making it ideal for complex queries and finding similar data across text, images, and audio.


Applications of Vector Search:

Vector search and embeddings are used in NLP, recommendation systems, and image recognition, among other areas. They enable tasks like sentiment analysis, personalized recommendations, and visual pattern recognition.


In our application, we implemented vector search to recommend tools, experts, courses, and events based on strategy, project, and task data. Using MongoDB’s built-in vector search capabilities, we:


  1. Aggregate Data: Created a field that combines multiple attributes into a vector string.

  2. Embeddings: Used OpenAI’s embedding API to generate vectors for marketplace items.

  3. Search Queries: Generated vector queries from user data to fetch recommendations.


We have a implemented a simple Marketplace listing tools, experts, courses & events. When each of these are added to the we call OpenAI's embedding API and save the embedding in each row, so it can be searched later.



The marketplace screen


To enable a Vector search, we first need to set up a field in the Marketplace datatable that aggregates the multiple fields we need to be turned into an embedding / vector search. We use a Formula (JSONATA) field for this:


The jsonata field showing the vector search concatenation

Note that our vectorSearchField concatenates other fields together like the name, description etc that will be searchable. Then we just label it as the Embedding field in the Results settings tab:


The jsonata field named vectorSearchField is set as the Embedding Sort Field in the datatable results settings

That’s it! Now when each field is added or edited Buzzy will handle updating its embedding field.


See the generateRecommendations function which takes a query and then finds relevant marketplace entries. In this example, each of these are cached on their respective Strategies, Projects and Tasks.



Screenshot ofAWS Lambda function

View the gist here:


And here's an example result showing an example strategy "AI Driven Delivery Optimization", as part of a strategy for a logistics company, and then listing an expert who can help, Ned, followed by some AI tools that have been searched for using the "vector" query



An example of the marketplace recommendations on a project

Conclusion


In summary, we built the AI Strategy Plan app by:


  1. Generating initial app designs with AI (see Part 1)

  2. Refining the design with Figma.

  3. Integrating AI (OpenAI) to generate strategies, projects, and tasks based on user input.

  4. Recommending relevant products using vector search.

  5. Delivering the entire solution as a multi-tenant SaaS application.


This combination of Buzzy, OpenAI, and MongoDB allowed us to create a powerful tool for organizations to seamlessly integrate AI into their operations and build awesome applications.



 

PREVIOUS:


 


About Buzzy

Buzzy is an AI-powered no-code platform that simplifies and accelerates application development. Our experience with the AI Strategy App is a testament to how Buzzy enables rapid prototyping and iteration, allowing us to gather real user feedback early in the development process. Try Buzzy yourself!

bottom of page