How mantavya2109/ai-ad-generator works
AiAdGenerator is a web app for turning uploaded product and model images into AI-generated ad images and videos. A user enters project details in the generator; the API authenticates the request, checks credits, stores uploads and project state, and invokes Google GenAI. Generated assets are persisted and can be viewed, managed, or published to the community. The README also identifies Clerk, Cloudinary, and PostgreSQL/Prisma as product integrations. Some client and server links are explicit in excerpts; unsampled subsystem relationships are omitted where not evidenced.
Main entry points: App.tsx Routes and shell · axios.ts HTTP client · projectRoutes.ts Project routes · projectController.ts Project operations
Components 20
Web application
- Routes and shell
client/src/App.tsx - Ad generator
client/src/pages/Generator.tsx - Image upload UI
client/src/components/UploadZone.tsx - My generations
client/src/pages/MyGenerations.tsx - Generation results
client/src/pages/Result.tsx - Community gallery
client/src/pages/Community.tsx - Project card
client/src/components/ProjectCard.tsx - HTTP client
client/src/configs/axios.ts
API and identity
- Express API
server/server.ts - Project routes
server/routes/projectRoutes.ts - User routes
server/routes/userRoutes.ts - Request protection
server/middlewares/auth.ts - Clerk webhook
server/controllers/clerk.ts
Asset generation
- Project operations
server/controllers/projectController.ts - Google GenAI
server/configs/ai.ts - Cloudinary
- Multipart uploads
server/configs/multer.ts
Project data
- User operations
server/controllers/userController.ts - PostgreSQL via Prisma
server/configs/prisma.ts
Other components
- Creator
Connections 25
- Creator → Routes and shell: uses
client/src/App.tsx - Routes and shell → Ad generator: routes
client/src/App.tsx - Routes and shell → My generations: routes
client/src/App.tsx - Routes and shell → Generation results: routes
client/src/App.tsx - Routes and shell → Community gallery: routes
client/src/App.tsx - Ad generator → Image upload UI: renders
client/src/pages/Generator.tsx - Ad generator → HTTP client: posts data
client/src/pages/Generator.tsx - My generations → HTTP client: fetches projects
client/src/pages/MyGenerations.tsx - My generations → Project card: renders
client/src/pages/MyGenerations.tsx - Community gallery → HTTP client: fetches projects
client/src/pages/Community.tsx - Community gallery → Project card: renders
client/src/pages/Community.tsx - Generation results → HTTP client: fetches result
client/src/pages/Result.tsx - Project card → HTTP client: manages projects
client/src/components/ProjectCard.tsx - Express API → Project routes: mounts
server/server.ts - Express API → User routes: mounts
server/server.ts - Project routes → Multipart uploads: parses files
server/routes/projectRoutes.ts - Project routes → Request protection: protects routes
server/routes/projectRoutes.ts - User routes → Request protection: protects routes
server/routes/userRoutes.ts - Project routes → Project operations: dispatches
server/routes/projectRoutes.ts - User routes → User operations: dispatches
server/routes/userRoutes.ts - Project operations → Google GenAI: generates assets
server/controllers/projectController.ts - Project operations → Cloudinary: uploads assets
server/controllers/projectController.ts - Project operations → PostgreSQL via Prisma: reads and writes
server/controllers/projectController.ts - User operations → PostgreSQL via Prisma: reads and writes
server/controllers/userController.ts - Clerk webhook → PostgreSQL via Prisma: updates identity
server/controllers/clerk.ts