Skip to content

redtomato0129/ai-generation

Repository files navigation

Jarvis AI - A Modern SaaS AI Platform

Complete AI Tools (Chatbot, Image Generation, Music Generation, Video Generation, and Code Generation) SaaS Platform built using Next.js 14, Stripe, OpenAI, ReplicateAI, Crisp, Aiven, and Prisma.

project-thumbnail

View Project 🔥 Live Preview 🚀

Features

  • Tailwind design
  • Tailwind animations and effects
  • Full responsiveness
  • Clerk Authentication (Email, Google, 9+ Social Logins)
  • Client form validation and handling using react-hook-form
  • Server error handling using react-toast
  • Image Generation Tool (Open AI)
  • Video Generation Tool (Replicate AI)
  • Conversation Generation Tool (Open AI)
  • Music Generation Tool (Replicate AI)
  • Page loading state
  • Stripe monthly subscription
  • Free tier with API limiting
  • Writing POST, DELETE, and GET routes in route handlers (app/api)
  • Fetching data in server react components by directly accessing the database (WITHOUT API! like Magic!)
  • Handling relations between Server and Child components!
  • Folder structure in Next 13 App Router
  • Reusable layouts

Getting Started

  1. Ensure that Git and NodeJS (18.x.x) are installed on your system.
  2. Clone this repository to your local machine.
git clone https://github.com/redtomato0129/ai-generation.git
```https://github.com/redtomato0129/ai-generation.git

3. Create a `.env` file in the **root** directory and add the following contents to your `.env` file:

```env
# Disable Next.js telemetry
NEXT_TELEMETRY_DISABLED=1

# Clerk redirect URIs
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
CLERK_SECRET_KEY=sk_test_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

# Clerk redirect URIs
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in
NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/dashboard
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/dashboard

# OpenAI API key
OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# Replicate API token
REPLICATE_API_TOKEN=r8_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# PlanetScale/Aiven database URL
DATABASE_URL="mysql://<username>:<password>@<host>:<port>/<database_name>?ssl-mode=REQUIRED"

# Stripe API/webhook secret keys
STRIPE_API_SECRET_KEY=sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
STRIPE_WEBHOOK_SECRET=whsec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# App base URL
NEXT_PUBLIC_APP_URL=http://localhost:3000

# Crisp website ID
NEXT_PUBLIC_CRISP_WEBSITE_ID=xxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx

4. Clerk Authentication Keys

  • Visit the Clerk dashboard: https://clerk.com
  • Log in to your Clerk account or sign up if you don't have one.
  • Navigate to the "Projects" section and select your project.
  • Go to the "API Keys" tab.
  • Copy the "Publishable Key" and replace NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY in the .env.local file with the copied key.
  • Copy the "Secret Key" and replace CLERK_SECRET_KEY in the .env.local file with the copied key.

5. OpenAI API Key

Visit OpenAI and sign up for an account. Once registered, find your API key in the API section of your account settings. Copy the key and set it as the OPENAI_API_KEY in your project's environment.

OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

6. Replicate API Token

Sign up or log in to Replicate. Once logged in, navigate to your account settings, and find your API token. Copy the token and set it as the REPLICATE_API_TOKEN in your project's environment.

REPLICATE_API_TOKEN=r8_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

7. Stripe API and Webhook Keys

For Stripe, sign up or log in to your Stripe Dashboard. Once logged in, create new project, get secret key by visiting dashboard.stripe.com/apikeys, and then get webhook secret by visiting dashboard.stripe.com/webhook. Then, set them as STRIPE_API_SECRET_KEY and STRIPE_WEBHOOK_SECRET in your project's environment.

STRIPE_API_SECRET_KEY=sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
STRIPE_WEBHOOK_SECRET=whsec_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

8. App Base URL

Set the base URL of your application as NEXT_PUBLIC_APP_URL in your project's environment.

NEXT_PUBLIC_APP_URL=http://localhost:3000

9. Crisp Website ID

Sign up on Crisp and create a website. Once created, find your website ID in the Crisp dashboard and set it as NEXT_PUBLIC_CRISP_WEBSITE_ID in your project's environment.

NEXT_PUBLIC_CRISP_WEBSITE_ID=xxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx

10. PlanetScale/Aiven Database URL

Create PlanetScale or Aiven account. After creating an account, set up a MySQL database. In the dashboard, find your database connection details and construct the DATABASE_URL in the following format:

DATABASE_URL="mysql://<username>:<password>@<host>:<port>/<database_name>?ssl-mode=REQUIRED"
  1. Open terminal in root directory. Run npm install --legacy-peer-deps or yarn install --legacy-peer-deps.
  2. Setup Prisma by adding MySQL Database (PlanetScale/Aiven). Run npx prisma db push or yarn prisma db push to push the queries in the database.
  3. Now, the app is fully configured 👍, and you can start using this app with either npm run dev or yarn dev.

Important

Keep your API keys and configuration values secure and do not expose them publicly.

Screenshots:

Modern UI/UX

Dashboard

Conversation Generation

Music Generation

Image Generation

Video Generation

Code Generation

Note

This project is designed exclusively for portfolio purposes, and you are welcome to utilize it as you deem fit.