How imriyamandal/ai-course-generator-ibm-cloud works
Project type and purpose
• This is a full-stack SaaS web application (“AI Course Generator SaaS”) built with Next.js (App Router), TypeScript, Tailwind, and shadcn/ui.
• It lets authenticated users generate AI-powered course outlines (modules, lessons) via IBM watsonx.ai and persists them in an IBM Cloudant database.
File structure
• Top-level files: configuration (tsconfig.json, next.config.ts, tailwind.config.ts), package.json, README.
• src/app: the Next.js App Router directory. Splits into three route groups:
• (landing) – public marketing pages (Home, About, Features, Contact, etc.)
• (auth) – callback, sign-in, sign-up pages (Clerk integration)
• (dashboard) – authenticated user views (courses, settings)
• src/app/api: serverless API routes, e.g. /api/generate-course/route.ts
• src/components: UI components organized by feature (LandingPage, Dashboard, auth, ui primitives)
• src/lib/cloudant.ts: Cloudant client wrapper
• src/actions: small utility actions (fetching auth status)
• src/middleware.ts: Next.js middleware to protect dashboard routes
• src/utils: constants and helper functions
Readme insights
• External services:
• Clerk – authentication and session management
• IBM watsonx.ai – AI text generation
• IBM Cloudant – NoSQL document store for users/courses
• API endpoint: src/app/api/generate-course/route.ts calls WatsonX and writes to Cloudant.
• Environment variables configure Clerk, WatsonX, Cloudant.
Main components & their interactions
a. Client (Browser)
• Loads Next.js pages (landing, auth, dashboard).
• Gets static assets from /public.
• Uses Clerk UI widgets/hooks for sign-in/up.
b. Next.js App Server
• Renders React pages server- and client-side.
• Hosts API routes under /api/*.
• Applies middleware for route protection.
• Invokes src/lib/cloudant.ts to talk to DB.
• Invokes WatsonX via IBM Cloud SDK in the generate-course API.
c. Authentication Service (Clerk)
• External identity provider.
• Issuing JWTs/cookies, redirect callbacks under /auth-callback.
d. AI Service (IBM watsonx.ai)
• Returns generated course outlines.
e. Database (IBM Cloudant)
• Stores user profiles and generated courses in document collections (users, courses).
Architectural patterns & design principles
• Three-tier architecture: Presentation (Next.js + UI), Application (API routes + business logic), Data (Cloudant).
• Serverless functions (Next.js API routes) handling AI calls and persistence.
• Middleware for route guard (Clerk).
• Logical separation: landing vs. auth vs. dashboard route groups in App Router.