Skip to content

rajan0323/imghlp

Repository files navigation

SaaS App with AI Features, Payments, and Credits System

This project is a Software-as-a-Service (SaaS) application that integrates AI features with a robust payments and credits system. The app is built using Next.js 14, Cloudinary AI, Clerk, and Stripe, and is designed to be scalable, potentially allowing you to turn it into a side income or business.

Table of Contents

Introduction

This application demonstrates how to build a SaaS product with modern web technologies. It leverages AI capabilities for advanced features, integrates with Stripe for payments and credits management, and uses Cloudinary for media handling.

Features

  • AI Features: Integration with Cloudinary AI for image tagging and processing.
  • Payments and Credits System: Powered by Stripe to handle transactions and credits.
  • Authentication: Managed by Clerk for secure user authentication.
  • Image Upload: Users can upload images that are processed and tagged using Cloudinary.

Technologies Used

  • Next.js 14: The React framework for production.
  • Cloudinary AI: For image processing and auto-tagging.
  • Clerk: Authentication and user management.
  • Stripe: Payment gateway for handling transactions and credits.

Getting Started

Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js
  • npm (or yarn)
  • A Stripe account
  • A Cloudinary account
  • A Clerk account

Installation

  1. Clone the repository:
    git clone https://github.com/yourusername/your-repo-name.git
    cd your-repo-name

Install dependencies: sh Copy code npm install Running the App Start the development server:

sh Copy code npm run dev Open your browser and navigate to http://localhost:3000.

Configuration Create a .env.local file in the root of your project and add the following environment variables:

env Copy code NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name NEXT_PUBLIC_CLOUDINARY_API_KEY=your_cloudinary_api_key NEXT_PUBLIC_CLOUDINARY_API_SECRET=your_cloudinary_api_secret NEXT_PUBLIC_STRIPE_API_KEY=your_stripe_api_key NEXT_PUBLIC_CLERK_FRONTEND_API=your_clerk_frontend_api CLERK_API_KEY=your_clerk_api_key Ensure you have the correct settings and permissions configured in your Cloudinary, Stripe, and Clerk accounts.

Usage Uploading Images The MediaUploader component handles image uploads. Users can upload images, which are then processed by Cloudinary. Successful uploads trigger a toast notification indicating success and credit deduction.

Error Handling The app includes error handling for common issues, such as missing subscriptions or invalid requests. Errors are communicated to users through toast notifications.

Example of Error Handling: javascript Copy code const onUploadErrorHandler = () => { toast({ title: 'Something went wrong while uploading', description: 'Please try again', duration: 5000, className: 'error-toast' }); }; Contributing Contributions are welcome! Please open an issue or submit a pull request with your changes. Ensure you follow the project's code style and guidelines.

License This project is licensed under the MIT License. See the LICENSE file for more details.

Simply copy and paste the above content into your README.md file in your GitHub repository. Make sure to replace placeholders like yourusername and your-repo-name with the actual values relevant to your project.