🧐 Inspiration
Everyday, thousands of people feel down and have a bad day. You could be in this position right now. Laying on your bed, staring at the ceiling, not knowing what to do. Everyone's been there. One of the best cures for this is to just laugh. From a 2008 study, it was found out that just the anticipation of laughter reduced Cortisol levels by 39% (the hormone that causes stress). But to get this laughter, you may have to talk to someone, search up comedy specials, or try and find something funny. But what if that laughter was a single click away?
What it does
Meet LaughRX, a piece of software designed to make laughing as easy as possible. With the click of a button, you'll get either a random dad joke from a selection of thousands or a completely unique, AI-generated joke on the spot. Save your favorite jokes to view again at a later time on your profile and share the best ones with friends and family through a quick link.
How we built it
LaughRX is entirely built on Firebase, a BaaS provided by Google. The frontend is built with nothing but HTML, CSS, and vanilla JavaScript. All authentication is handled with the Firebase Auth API and users have the ability for 2 authentication options (Email/Password and Google). All data is stored through FireStore and all the jokes are from 2 separate API's. All dad jokes come from the 'icanhazdadjoke' API and any AI-generated jokes are from the OpenAI API using GPT 3.5-Turbo as the LLM model. Any UI animations are built with pure CSS and the 'Share a joke' feature is built using Query Strings and the URLSearchParams browser API.
The joke generation works by randomly selecting either OpenAI or the dad joke API and calling it to get a joke. If the selection is the OpenAI API, a pre-fed prompt and assistant messages are sent to GPT 3.5-Turbo to get the best joke possible.
The 'Favorite a joke' feature works by saving the joke's content, the time, and the UID of the user who made it to FireStore and on page load, the /profile page goes through the 'Jokes' collection in FireStore to check which ones are generated by the currently signed in user and displays them.
Challenges we ran into
The most difficult part of building LaughRX was connecting the app to both API's (OpenAI and icanhazdadjoke) to source all the jokes. It was difficult to get GPT 3.5-Turbo to produce an adequate joke. At first, it would list out tons of jokes in one API call or list out a joke that wasn't very funny, but after providing it proper assistance in an array of messages, the jokes started turning out really good!
Accomplishments that we're proud of
I am very proud of getting this entire application working in a super short time frame as it is still a rather complex piece of software for my personal skill level. I always struggle to get projects done in a timely fashion, so for this entire app to get done in under 36 hours, it's a great feeling!
What we learned
I learned many different technologies like new ways to use FireStore, how to connect to external APIs through fetch() calls, and Query Strings to make URLs dynamic and show different content for different users. Plus, mobile responsiveness has always been a struggle for me, and with this app, it is fully responsive which is something I learned how to do in a short amount of time.
What's next for LaughRX
In the future, I plan to expand LaughRX into video and audio comedy with either a Node.js or Python web-scraping API to pull video clips from the internet or connect to the Spotify API and pull clips of comedy podcasts. Plus, I would like to add ease-of-use features and just generally make the app feel nicer to use.
Built With
- ai
- api
- chatgpt
- css
- firebase
- google-auth
- html
- icanhazdadjokes-api
- javascript
- machine-learning
- openai
- query-strings
- vite
Log in or sign up for Devpost to join the conversation.