Topview Logo
  • Create viral videos with
    GPT-4o + Ads library
    Use GPT-4o to edit video empowered by Youtube & Tiktok & Facebook ads library. Turns your links or media assets into viral videos in one click.
    Try it free
    gpt video

    Build & Deploy Full Stack Nextjs AI Kids Story generator App Using React, NextUI, Typescript

    blog thumbnail

    Introduction

    In this article, we'll walk you through the process of building a full-stack application, specifically an AI Kids Story Generator app, using various modern technologies such as React, Next.js, NextUI, and TypeScript. The application will allow users to create their own kids' stories with the assistance of AI, and we will also cover how to deploy the application to a cloud platform.

    Application Overview

    We'll build an application with a user-friendly interface that includes:

    • A clean and simple landing page for user authentication using Clerk.
    • A dashboard where users can manage their accounts and view generated stories.
    • An option to create new stories by providing a subject, type, age group, and image style.
    • Integration of AI to generate the stories and corresponding images.
    • A credit system to limit how many stories users can create.
    • A way for users to purchase additional credits.

    Table of Contents

    • Prerequisites
    • Setting Up the Project
    • Designing the Application
    • Integrating AI Features
    • Implementing User Authentication
    • Building the Dashboard
    • Story Creation Workflow
    • Deploying the Application

    Prerequisites

    • Basic knowledge of JavaScript and React.
    • Node.js and npm installed on your machine.
    • Familiarity with TypeScript is a plus.
    • A GitHub account for version control.

    Setting Up the Project

    1. Start by creating a new Next.js project using the command:
      npx create-next-app@latest --typescript
      
    2. Navigate to the project directory and install NextUI:
      npm install @nextui-org/react
      
    3. Initialize Clerk authentication by following its documentation.

    Designing the Application

    The application will have several components:

    • Landing Page: A simple page to allow users to log in or sign up.
    • Dashboard: Where users can manage their stories and view their credits.
    • Story Creation: A form where users can input the necessary details to generate a story.
    • Story Viewer: A preview of the story with pages that can be flipped.

    Use NextUI components for a modern user interface.

    Integrating AI Features

    1. Using the Gini AI API: To generate stories, integrate the Gini AI API for text and image generation. You can request prompts to create kids’ stories based on user inputs.
    2. Image Generation: Use the Replicate API to generate corresponding images for the stories, ensuring the user gets a complete storytelling experience.

    Implementing User Authentication

    Utilize Clerk for user authentication:

    • Allow users to sign in using email or social media accounts.
    • Use Clerk's hooks in your components to check if a user is authenticated.

    Building the Dashboard

    • Display user story statistics, including remaining credits.
    • List down all the stories created by the user.
    • Implement pagination to fetch and display additional stories as needed.

    Story Creation Workflow

    1. Allow users to input story details such as subject, type, age group, and image style.
    2. Use credits to determine if a user can generate a new story.
    3. On successful generation, save the story details in the database and deduct the respective credits.

    Deploying the Application

    1. Push your code to GitHub.
    2. Utilize Vercel for deployment by connecting your GitHub repo to Vercel.
    3. Add the necessary environment variables in Vercel for smooth functioning.
    4. After deployment, you can share your application with others.

    Conclusion

    With this guide, you should be able to build a full-stack AI Kids Story Generator app using Next.js, React, and TypeScript, integrating AI for story generation. You'll also learn how to deploy your application on a cloud platform, making it accessible to users.


    Keyword

    Next.js, React, AI, Kids Story Generator, NextUI, TypeScript, Deployment, Cloud, Authentication, Story Creation, Vercel.


    FAQ

    Q1: What technologies are used in this project?

    A1: The project utilizes Next.js, React, NextUI, TypeScript, Clerk for authentication, and Gini AI for story generation.

    Q2: How do I deploy the application?

    A2: You can deploy the application using Vercel by connecting your GitHub repository and adding any necessary environment variables.

    Q3: Can I integrate payment options in this app?

    A3: Yes, you can integrate payment options such as PayPal to allow users to purchase additional credits.

    Q4: How do credits work in this application?

    A4: Users have a limited number of credits that control how many stories they can create. They can purchase more credits if needed.

    Q5: Is there a backend service used?

    A5: Yes, the application uses a PostgreSQL database via Drizzle ORM to store users and story details.

    One more thing

    In addition to the incredible tools mentioned above, for those looking to elevate their video creation process even further, Topview.ai stands out as a revolutionary online AI video editor.

    TopView.ai provides two powerful tools to help you make ads video in one click.

    Materials to Video: you can upload your raw footage or pictures, TopView.ai will edit video based on media you uploaded for you.

    Link to Video: you can paste an E-Commerce product link, TopView.ai will generate a video for you.

    You may also like