VibeBuilders.ai Logo
VibeBuilders.ai
How I Implemented OpenAI's API In My First SaaS! DebateTrend!

How I Implemented OpenAI's API In My First SaaS! DebateTrend!

GerGeto
April 15, 2025
reddit

About Me

I'm a 17 y/o aspiring solopreneur from Bulgaria! I have a passion for 3D printing, coding, video creation, and space!

My Project

https://debatetrend.com is a website where you can debate with AI on different topics! You can have multiple debates with different debate styles for different lengths of time!

The special part is that at the end of each debate, you can have another AI look through the debate! It will give you and the AI you debated with a score from a system I call "debate score" It will also give you recommendations on where you can improve your debating skills!

Quick showcase

How I implemented AI - ChatGPT 4-o mini

It's my first time implementing AI in a project but I think I got the hang of it relatively quickly!

Here's a diagram explaining what I did

Diagram of the process of debate creation.

I used the assistants API from the OpenAI API. Using the threads functionality, I created a different thread operated by an assistant I had already made.

When a user creates a debate my app creates a thread with custom information that was decided by the user. I save parts of the thread object in my MongoDB database which is hosted on Atlas.

After that, I redirect the user to a generated page in which you can chat with the AI. I maintain the connection using Pusher which is what I use for web sockets.

When a user refreshes the page the previous messages are displayed by making a call to the API with the thread id. After that, I retrieve the user messages while still allowing the user to continue the debate.

This is part of what I do on the back end. Of course, I have some security measures in check but I don't know if they are enough.

I chose the 4-o mini because it's still very intelligent, with a good response time, and a lot cheaper than 4-o.

My Tech Stack

  • Language: Javascript
  • Database: MongoDB hosted on Atlas
  • Hosting: Vercel
  • Framework: Express
  • Auth: PassportJs
  • Emails: Resend
  • Payments: Stripe
  • Front End: TailWindCSS, some regular CSS, and DaisyUI
  • WebSockets: Pusher, because Vercel = no sockets integrated into your web app which I found the painful way
  • AI: OpenAI’s API ChatGPT 4-o mini

Do you think I could have done anything better?

I would love to hear your opinions!

Vibe Score

LLM Vibe Score

0

Sentiment

Human Vibe Score

1

Rate this Resource

Join the VibeBuilders.ai Newsletter

The newsletter helps digital entrepreneurs how to harness AI to build your own assets for your funnel & ecosystem without bloating your subscription costs.

Start the free 5-day AI Captain's Command Line Bootcamp when you sign up:

By subscribing, you agree to our Privacy Policy and Terms of Service.