Skip to content

Commit a7c74a2

Browse files
authored
Merge branch 'main' into feat/about-us
2 parents 8f2c4ba + 9d1c01d commit a7c74a2

253 files changed

Lines changed: 19570 additions & 10506 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cursor/rules/core-standards.mdc

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
description: Core development standards applied to every chat and every model
3+
alwaysApply: true
4+
---
5+
6+
# Core Development Standards
7+
8+
Act as a senior Software engineer with 10+ years of experience.
9+
10+
## Code Quality
11+
12+
- Write the most minimal, clean, and only necessary code
13+
- Follow DRY — never duplicate logic; extract shared utilities
14+
- Follow First Principle Analysis
15+
- Strict type safety everywhere — no `any`, no implicit types, no type assertions unless unavoidable
16+
- Use fewer comments — code should be self-documenting; only comment non-obvious intent or trade-offs
17+
- Be concise with responses — no filler, no over-explanation
18+
19+
## Architecture
20+
21+
- Design for scale — every solution must handle high-volume traffic and large user bases
22+
- Follow scalable architecture patterns: queue-based processing, connection pooling, pagination, caching
23+
- Prefer database-level constraints (RLS, foreign keys, indexes) over application-level checks
24+
- Use bulk operations over loops for DB writes when possible
25+
26+
## Research & Problem Solving
27+
28+
- Always search for latest docs before implementing — never rely on outdated patterns
29+
- For complicated or unfamiliar issues, search GitHub issues, StackOverflow, and Reddit for prior solutions before guessing
30+
- Verify model names, API signatures, and library versions are current
31+
32+
## Best Practices
33+
34+
- Industry-level error handling — never swallow errors, always propagate meaningful messages
35+
- Validate all inputs at the boundary (Zod schemas, guards, middleware)
36+
- Use structured output from AI APIs (responseJsonSchema) instead of manual JSON parsing
37+
- Prefer existing project patterns over introducing new ones

.cursor/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"plugins": {
3+
"supabase": {
4+
"enabled": true
5+
}
6+
}
7+
}

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# 🤝 Contributing to Script AI
1+
# 🤝 Contributing to Creator AI
22

3-
Thank you for your interest in contributing to Script AI! This guide will help you get started and understand our development process.
3+
Thank you for your interest in contributing to Creator AI! This guide will help you get started and understand our development process.
44

55
## 📋 Table of Contents
66

@@ -367,4 +367,4 @@ Contributors are recognized in several ways:
367367

368368
---
369369

370-
Thank you for contributing to Script AI! Your contributions help make this project better for everyone. 🚀
370+
Thank you for contributing to Creator AI! Your contributions help make this project better for everyone. 🚀

README.md

Lines changed: 203 additions & 127 deletions
Large diffs are not rendered by default.

apps/api/README.md

Lines changed: 128 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,138 @@
1-
# With-NestJs | API
1+
# Creator AI — API
22

3-
## Getting Started
3+
NestJS backend for Creator AI. Handles scripts, ideation, subtitles, dubbing, story builder, AI training, billing, and auth.
44

5-
First, run the development server:
5+
## Endpoints
66

7-
```bash
8-
pnpm run dev
9-
```
7+
All endpoints (except health and Stripe webhook) are prefixed with `/api/v1` and require a Supabase JWT in the `Authorization: Bearer <token>` header, validated by `SupabaseAuthGuard`.
8+
9+
### Auth (`/api/v1/auth`)
10+
11+
| Method | Path | Description |
12+
|--------|------|-------------|
13+
| POST | `/forgot-password` | Send OTP to email |
14+
| POST | `/verify-otp` | Verify 6-digit OTP |
15+
| POST | `/reset-password` | Reset password with verified OTP |
16+
17+
### Scripts (`/api/v1/script`)
18+
19+
| Method | Path | Description |
20+
|--------|------|-------------|
21+
| POST | `/generate` | Queue script generation job (BullMQ), supports file uploads |
22+
| GET | `/` | List user's scripts |
23+
| GET | `/:id` | Get single script |
24+
| GET | `/:id/export` | Export script as PDF |
25+
| PATCH | `/:id` | Update script title & content |
26+
| DELETE | `/:id` | Delete script |
27+
| SSE | `/status/:jobId` | Real-time generation progress stream |
28+
29+
### Ideation (`/api/v1/ideation`)
30+
31+
| Method | Path | Description |
32+
|--------|------|-------------|
33+
| POST | `/` | Queue ideation job (BullMQ) |
34+
| GET | `/` | List ideation jobs (paginated) |
35+
| GET | `/profile-status` | Check user AI training status |
36+
| GET | `/:id` | Get single ideation job |
37+
| GET | `/:id/export/pdf` | Export ideation as PDF |
38+
| GET | `/:id/export/json` | Export ideation as JSON |
39+
| DELETE | `/:id` | Delete ideation job |
40+
| SSE | `/status/:jobId` | Real-time ideation progress stream |
41+
42+
### Story Builder (`/api/v1/story-builder`)
43+
44+
| Method | Path | Description |
45+
|--------|------|-------------|
46+
| POST | `/generate` | Queue story builder job (BullMQ) |
47+
| GET | `/` | List story builder jobs |
48+
| GET | `/profile-status` | Check user AI training status |
49+
| GET | `/:id` | Get single story builder job |
50+
| DELETE | `/:id` | Delete story builder job |
51+
| SSE | `/status/:jobId` | Real-time generation progress stream |
52+
53+
### Subtitles (`/api/v1/subtitle`)
54+
55+
| Method | Path | Description |
56+
|--------|------|-------------|
57+
| POST | `/` | Generate subtitles with Gemini AI |
58+
| GET | `/` | List user's subtitle jobs |
59+
| POST | `/upload` | Upload video (max 200 MB) |
60+
| PATCH | `/` | Update subtitle JSON |
61+
| GET | `/:id` | Get single subtitle job |
62+
| PATCH | `/:id` | Update subtitle by ID |
63+
| DELETE | `/:id` | Delete subtitle job and file |
64+
| POST | `/burn` | Burn subtitles into video (FFmpeg) |
65+
66+
### Dubbing (`/api/v1/dubbing`)
1067

11-
By default, your server will run at [http://localhost:3000](http://localhost:3000). You can use your favorite API platform like [Insomnia](https://insomnia.rest/) or [Postman](https://www.postman.com/) to test your APIs
68+
| Method | Path | Description |
69+
|--------|------|-------------|
70+
| POST | `/` | Create dubbing project (Murf.ai) |
71+
| GET | `/` | List dubbing projects (paginated) |
72+
| GET | `/status/:projectId` | SSE stream for dubbing progress |
73+
| GET | `/:id` | Get dubbing project |
74+
| DELETE | `/:id` | Delete dubbing project |
1275

13-
You can start editing the demo **APIs** by modifying [linksService](./src/links/links.service.ts) provider.
76+
### AI Training (`/api/v1/train-ai`)
1477

15-
### ⚠️ Note about build
78+
| Method | Path | Description |
79+
|--------|------|-------------|
80+
| POST | `/` | Queue training job (BullMQ) |
81+
| GET | `/status/:jobId` | SSE stream for training progress |
1682

17-
If you plan to only build this app. Please make sure you've built the packages first.
83+
### Billing (`/api/v1/billing`)
1884

19-
## Learn More
85+
| Method | Path | Description |
86+
|--------|------|-------------|
87+
| GET | `/plans` | List available subscription plans |
88+
| GET | `/info` | Get user's billing info |
89+
| POST | `/checkout` | Create Stripe Checkout session |
90+
| POST | `/portal` | Create Stripe Customer Portal session |
2091

21-
To learn more about NestJs, take a look at the following resources:
92+
### Stripe Webhook (`/api/v1/stripe`)
93+
94+
| Method | Path | Description |
95+
|--------|------|-------------|
96+
| POST | `/webhook` | Handle Stripe webhook events |
97+
98+
Handled events: `checkout.session.completed`, `customer.subscription.updated`, `customer.subscription.deleted`, `invoice.paid`
99+
100+
### Health
101+
102+
| Method | Path | Description |
103+
|--------|------|-------------|
104+
| GET | `/` | Health check |
105+
| GET | `/api/v1/test-db` | Database connection test |
106+
107+
## Job Queues (BullMQ)
108+
109+
| Queue | Purpose |
110+
|-------|---------|
111+
| `train-ai` | AI style training from YouTube videos |
112+
| `script` | Script generation with style personalization |
113+
| `ideation` | Idea research with web search |
114+
| `story-builder` | Narrative structure generation |
115+
116+
All queues stream progress to the client via SSE.
117+
118+
## Key Integrations
119+
120+
| Service | Purpose |
121+
|---------|---------|
122+
| Supabase | Database, auth, storage |
123+
| Google Gemini AI | Script generation, ideation, training, transcription |
124+
| Murf.ai | Audio/video dubbing |
125+
| Stripe | Subscriptions, checkout, billing portal |
126+
| BullMQ + Redis | Job queue for async AI operations |
127+
| FFmpeg | Video processing & subtitle burning |
128+
| Resend | OTP and transactional emails |
129+
130+
## Setup
131+
132+
```bash
133+
cp .env.example .env # Fill in credentials
134+
pnpm install
135+
pnpm run dev --filter=api
136+
```
22137

23-
- [Official Documentation](https://docs.nestjs.com) - A progressive Node.js framework for building efficient, reliable and scalable server-side applications.
24-
- [Official NestJS Courses](https://courses.nestjs.com) - Learn everything you need to master NestJS and tackle modern backend applications at any scale.
25-
- [GitHub Repo](https://github.com/nestjs/nest)
138+
Runs at [http://localhost:8000](http://localhost:8000).

apps/api/package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
},
2020
"dependencies": {
2121
"@elevenlabs/elevenlabs-js": "^2.21.0",
22-
"ffmpeg-static": "^5.2.0",
23-
"ffprobe-static": "^3.1.0",
2422
"@google/genai": "^1.12.0",
2523
"@nestjs/bullmq": "^10.2.1",
2624
"@nestjs/common": "^10.0.0",
@@ -37,14 +35,20 @@
3735
"@tabler/icons-react": "^3.34.1",
3836
"bullmq": "catalog:",
3937
"clsx": "^2.1.1",
38+
"ffmpeg-static": "^5.2.0",
39+
"ffprobe-static": "^3.1.0",
4040
"fluent-ffmpeg": "^2.1.3",
4141
"form-data": "^4.0.0",
42+
"ioredis": "^5.8.2",
4243
"jsonrepair": "^3.13.0",
44+
"marked": "^16.2.0",
4345
"motion": "^12.23.12",
4446
"multer": "^2.0.2",
47+
"pdf-lib": "^1.17.1",
4548
"reflect-metadata": "^0.2.0",
4649
"resend": "^4.8.0",
4750
"rxjs": "^7.8.1",
51+
"stripe": "^20.3.1",
4852
"tailwind-merge": "^2.6.0",
4953
"ytdl-core": "^4.11.5",
5054
"zod": "^3.23.8"

apps/api/src/app.controller.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
import { Controller, Get, Req, UseGuards } from '@nestjs/common';
2-
import { AppService } from './app.service';
1+
import { Controller, Get, UseGuards } from '@nestjs/common';
32
import { SupabaseService } from './supabase/supabase.service';
43
import { SupabaseAuthGuard } from './guards/auth.guard';
54

65
@Controller()
76
@UseGuards(SupabaseAuthGuard)
87
export class AppController {
9-
constructor(private readonly appService: AppService, private readonly supabaseService: SupabaseService) { }
8+
constructor(private readonly supabaseService: SupabaseService) {}
109

1110
@Get('test-db')
12-
async testDb(@Req() req) {
11+
async testDb() {
1312
const { data, error } = await this.supabaseService.getClient().from('profiles').select('*').limit(1);
1413
if (error) throw error;
1514
return data;

apps/api/src/app.module.ts

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
11
import { Module } from '@nestjs/common';
2-
import { ConfigModule, ConfigService } from '@nestjs/config';
2+
import { ConfigModule } from '@nestjs/config';
33
import { BullModule } from '@nestjs/bullmq';
44
import * as path from 'path';
55
import redisConfig from './config/redis.config';
6+
import { getRedisConnection } from './redis.connection';
67
import { SupabaseModule } from './supabase/supabase.module';
78

8-
import { AppService } from './app.service';
99
import { AppController } from './app.controller';
1010
import { HealthController } from './health.controller';
1111
import { TrainAiController } from './train-ai/train-ai.controller';
1212
import { TrainAiModule } from './train-ai/train-ai.module';
1313
import { AuthModule } from './auth/auth.module';
1414
import { SubtitleModule } from './subtitle/subtitle.module';
1515
import { DubbingModule } from './dubbing/dubbing.module';
16+
import { ThumbnailModule } from './thumbnail/thumbnail.module';
17+
import { StoryBuilderModule } from './story-builder/story-builder.module';
18+
import { ReferralModule } from './referral/referral.module';
19+
import { ScriptModule } from './script/script.module';
20+
import { CourseModule } from './course/course.module';
21+
import { YoutubeModule } from './youtube/youtube.module';
22+
import { UploadModule } from './upload/upload.module';
23+
import { SupportModule } from './support/support.module';
24+
import { IdeationModule } from './ideation/ideation.module';
25+
import { BillingModule } from './billing/billing.module';
1626

1727
@Module({
1828
imports: [
@@ -27,9 +37,8 @@ import { DubbingModule } from './dubbing/dubbing.module';
2737
],
2838
}),
2939
BullModule.forRootAsync({
30-
imports: [ConfigModule],
31-
useFactory: async (configService: ConfigService) => ({
32-
connection: configService.get('redis'),
40+
useFactory: () => ({
41+
connection: getRedisConnection(),
3342
defaultJobOptions: {
3443
attempts: 1,
3544
backoff: { type: 'exponential', delay: 1000 },
@@ -38,19 +47,28 @@ import { DubbingModule } from './dubbing/dubbing.module';
3847
limiter: { max: 100, duration: 60000 }
3948
},
4049
}),
41-
inject: [ConfigService],
42-
}),
43-
BullModule.registerQueue({
44-
name: 'train-ai'
4550
}),
51+
BullModule.registerQueue(
52+
{ name: 'train-ai' },
53+
{ name: 'script' },
54+
),
4655
SupabaseModule,
4756
TrainAiModule,
4857
AuthModule,
4958
SubtitleModule,
50-
AuthModule,
51-
DubbingModule
59+
DubbingModule,
60+
ThumbnailModule,
61+
StoryBuilderModule,
62+
ReferralModule,
63+
ScriptModule,
64+
CourseModule,
65+
YoutubeModule,
66+
UploadModule,
67+
SupportModule,
68+
IdeationModule,
69+
BillingModule,
5270
],
5371
controllers: [AppController, HealthController, TrainAiController],
54-
providers: [AppService],
72+
providers: [],
5573
})
5674
export class AppModule { }

apps/api/src/app.service.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

apps/api/src/auth/auth.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class AuthService {
3737

3838
try {
3939
await this.resend.emails.send({
40-
from: 'Script AI <no-reply@tryscriptai.com>',
40+
from: 'Creator AI <no-reply@tryscriptai.com>',
4141
to: email,
4242
subject: 'Your Password Reset Code',
4343
html,

0 commit comments

Comments
 (0)