Build a Full Stack AI App with Python, Fast API, React, and Clerk Authentication

Share

Summary

Learn how to build a full-stack application using Fast API and Python on the back end and JavaScript and React on the front end. Integrates with an AI to generate coding challenges offers authentication using Clerk. This project will enhance your portfolio.

Highlights

Project Demo and Overview
00:00:00

The video introduces a coding challenge generator built with Fast API, Python, React, and JavaScript. Users can select a difficulty level, generate a coding question, and view their question history. The project uses Clerk for authentication, offering various sign-in methods and easy integration. The video is sponsored by Clerk and PyCharm.

Setting Up Backend Dependencies
00:02:26

The video gets into the code, starting with setting up backend dependencies using UV, a tool similar to pip but faster. The presenter creates a backend directory then installs dependencies like Fast API, Uvicorn, SQL Alchemy, Python-dotenv, Clerk SDK, and OpenAI. PyCharm is used for the project.

Backend Directory Structure and Front End Setup
00:06:39

The video sets up the backend directory structure, including src, database, and routes folders. Then shifts to setting up the front end using npm create vite@latest. React Router DOM and Clerk React are installed for routing and authentication purposes.

Clerk Project Configuration
00:10:13

The presenter creates a new project on Clerk, names it 'YT tutorial challenge', selects Google as the sign-in method, and configures the application. The video highlights the importance of backend integration with Clerk and notes that all code can be found on GitHub.

Integrating Clerk with React
00:12:11

The video create a .env file in the front end, copies the publishable key from Clerk, and adds the Clerk provider to the React application. The app.jsx file is cleaned up and a clerk provider with routes component is created to handle authentication and routing in a modular way.

Setting Up React Components and Routes
00:17:04

The video sets up React Router DOM to enable dynamic navigation and creates several components, including challenge generator, MCQ challenge, history panel, layout, and authentication page. The app.jsx file is modified to include these new routes for sign-in, sign-up, and different sections of the application with help from autocompletion.

Authentication Page Setup
00:24:54

The video details setting up the authentication page to display Clerk's sign-in and sign-up forms. The signed-in and signed-out components from Clerk React are used to conditionally render content based on the user's authentication status. The application is then tested to ensure the Clerk authentication flow is working correctly.

Styling The Application And Adding a Navbar
00:28:21

The video builds a basic navbar in the layout for signed-in users. It then implements CSS styling for the components. The CSS is copied from GitHub to maintain a uniform look with code provided. After signing in with Google, the navbar becomes visible.

Configuring Clerk Settings
00:35:13

The demonstration changes to show the UI configuration for Clerk including adding settings for collecting first/last name and setting usernames. There is also documentation shown covering restrictions on who is able to sign-in, subscriptions, components and webhooks.

Coding Challenge Generator
00:38:18

The video transitions into developing the main form: importing React libraries, setting initial states for challenges, loading status, errors, difficulty and user quota. Next functions are created to fetch the quotoa and generate challenges with async functions. A difficulty selector and generate button are set up with default difficulty of easy.

Multiple Choice Challenge Component
00:47:35

The demonstrator creates reusable components to store questions. They import react libraries and take in a challenge (the question). They set up state based on selected options and whether to show the explanation. Finally, they set up formatting to render red or green styling

History Panel Component
00:56:51

A functional history panel component is then created: setting the state for history, using built in utility functions, and a layout for an is loading check, error check, and rendering of a list of generated mcq challenges utilizing conditional statements.

Backend Setup with Fast API
01:02:33

The demonstration begins setting up the backend with Fast API, establishing multiple routes for challenge generation, securing backend and limiting LLM API user access. The video utilizes a client that handles authentication and backend processes.

Utility file and Authenticating Requests
01:10:00

The process involves setting up an authentication and variable files, writing JSON, establishing code for authentication of the backend, utilizing function (authenticate and get user details), and authenticating requests.

Setting up models
01:19:19

The process builds tables using declarative base, imports libraries required for the process, sets up class challenge, handles settings for what happens if values are not passed, and generates the classes in sequel

Database setup (cont.) and web-based interactions
01:27:06

Process to query with session data, handle interactions, commit changes, determine which parameters must be met including specific unique keys and create multiple functions such as get_challenge, create_challenge, reset_check, get_user

Setting up routes
01:35:58

Set up endpoints from routes. The process builds out an API and uses data (set equal to). Then, adds exception handling for each request and connects to user and db

AI component library and implementation
01:46:50

The process involves implementing the AI component library to generate automated questions using openai. Next, a function called generate-challenge with AI is generated.

Connecting front and back end testing, and error handling (cont.)
01:55:41

The tutorial then dives deeper into errors in the code and shows an example of the use API to fetch data and use that data to create different responses and functionality while the page loads

How to set up your webhooks to listen to event and create alerts
02:19:21

The process shows how to work with SVIX and integrate it, enable the env file to function, listen to events such as clerk on a separate api (post)

Recently Summarized Articles

Loading...