Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
node_modules
dist
npm-debug.log
.git
.gitignore
.vscode
.env
.git
npm-debug.log
dist
Dockerfile*
docker-compose*
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Design
# Node modules
node_modules/

postman

# Temporary files
npm-temp/
temp/
Expand Down
12 changes: 0 additions & 12 deletions .postman/config.json

This file was deleted.

13 changes: 7 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ FROM node:20-alpine

WORKDIR /app

# Install dev dependencies (nodemon) and app deps
COPY package*.json ./
RUN npm ci

# If you prefer nodemon global: RUN npm install -g nodemon
# Copy only when building image layer for deps (source will be mounted at runtime)
# Expose the port your app uses
RUN npm ci --only=production

COPY . .

RUN npm run build

Comment on lines 5 to +12

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Dockerfile installs production-only dependencies (npm ci --only=production) and then runs npm run build, but build uses tsc which is in devDependencies. The image build will fail unless TypeScript is installed. Consider a multi-stage build (install dev deps to build, then copy compiled output + prod deps), or install dev deps during the build stage.

Copilot uses AI. Check for mistakes.
EXPOSE 4000

CMD ["npm", "run", "dev"]
CMD ["node", "dist/server.js"]

Copilot AI Mar 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The container entrypoint runs node dist/server.js, but tsconfig.json currently emits to src/dist (outDir: "src/dist"). Unless artifacts are moved as part of the build, the container will fail at startup. Either change outDir to dist or update the Docker CMD/start script to match the emitted path.

Suggested change
CMD ["node", "dist/server.js"]
CMD ["node", "src/dist/server.js"]

Copilot uses AI. Check for mistakes.
11 changes: 11 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM node:20-alpine

WORKDIR /app

COPY package*.json ./

RUN npm install

EXPOSE 4000

CMD ["npm", "run", "dev"]
21 changes: 21 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: "3.9"

services:
backend:
build:
context: .
dockerfile: Dockerfile.dev

container_name: backend-dev

volumes:
- .:/app
- /app/node_modules

env_file:
- .env

ports:
- "4000:4000"

command: npm run dev
17 changes: 17 additions & 0 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: "3.9"

services:
backend:
build:
context: .
dockerfile: Dockerfile

container_name: backend-prod

ports:
- "4000:4000"

env_file:
- .env

restart: always
49 changes: 49 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"cors": "^2.8.5",
"dotenv": "^17.2.3",
"express": "^5.2.1",
"fluent-ffmpeg": "^2.1.3",
"helmet": "^8.1.0",
"jsonwebtoken": "^9.0.2",
"mongoose": "^9.0.0",
Expand All @@ -31,6 +32,7 @@
"@types/bcrypt": "^6.0.0",
"@types/cors": "^2.8.19",
"@types/express": "^5.0.6",
"@types/fluent-ffmpeg": "^2.1.28",
"@types/jsonwebtoken": "^9.0.10",
"@types/node": "^24.10.1",
"@types/nodemailer": "^7.0.4",
Expand Down
73 changes: 73 additions & 0 deletions src/config/creditPricing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
export type ActionType =
| 'TXT_TO_IMAGE_GEN'
| 'IMG_TO_IMAGE_GEN'
| 'AUDIO_GEN'
| 'STORY_GEN'
| 'TXT_TO_VIDEO_GEN'
| 'IMG_TO_VIDEO_GEN'
| 'SCENE_GEN'
| 'NARRATION_GEN';

export const CREDIT_PRICING: Record<ActionType, Record<number, number>> = {
TXT_TO_IMAGE_GEN: {
1: 2,
2: 6,
3: 10,
4: 15,
5: 25,
},

IMG_TO_IMAGE_GEN: {
1: 2,
2: 6,
3: 10,
4: 15,
5: 25,
},

AUDIO_GEN: {
1: 2,
2: 5,
3: 8,
4: 12,
5: 20,
},

STORY_GEN: {
1: 1,
2: 3,
3: 6,
4: 10,
5: 15,
},

SCENE_GEN: {
1: 1,
2: 2,
3: 4,
4: 6,
5: 10,
10: 60,
},
NARRATION_GEN: {
1: 1,
2: 3,
3: 5,
4: 8,
5: 12,
},

TXT_TO_VIDEO_GEN: {
2: 20,
3: 35,
4: 50,
5: 75,
},

IMG_TO_VIDEO_GEN: {
2: 20,
3: 35,
4: 50,
5: 75,
},
};
30 changes: 30 additions & 0 deletions src/constants/audioAssetConsts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Audio Asset validation constants
export const MAX_AUDIO_PROMPT_LENGTH = 2000;
export const MAX_AUDIO_URL_LENGTH = 2048;
export const MAX_AUDIO_ASSETS_PER_NARRATION = 50;

// Audio types
export const audioTypes = ['narration', 'background', 'effect'] as const;
export type AudioType = (typeof audioTypes)[number];

// Generation sources
export const audioGenerationSources = ['ai', 'user'] as const;
export type AudioGenerationSource = (typeof audioGenerationSources)[number];

// Supported audio formats
export const audioFormats = ['mp3', 'wav', 'ogg', 'aac', 'm4a', 'flac', 'wma', 'opus'] as const;
export type AudioFormat = (typeof audioFormats)[number];

// Duration constraints
export const MIN_AUDIO_DURATION = 0.1;
export const MAX_AUDIO_DURATION = 7200; // 2 hours max

// File size constraints (in bytes)
export const MAX_AUDIO_FILE_SIZE = 100 * 1024 * 1024; // 100MB

// Voice ID constraints
export const MAX_VOICE_ID_LENGTH = 100;

// Version constraints
export const AUDIO_VERSION_GAP = 1;
export const MIN_AUDIO_VERSION = 1;
2 changes: 1 addition & 1 deletion src/constants/globalConts.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const ALLOWED_ORIGINS = process.env.ALLOWED_ORIGINS
? process.env.ALLOWED_ORIGINS.split(',')
: [
process.env.DEV_CLIENT_URL || 'http://localhost:3000',
process.env.DEV_CLIENT_URL || 'http://localhost:5173',
process.env.PROD_CLIENT_URL || 'https://your-production-app.com',
];

33 changes: 33 additions & 0 deletions src/constants/sceneAssetConsts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Scene Asset validation constants
export const MAX_ASSET_PROMPT_LENGTH = 2000;
export const MAX_ASSET_URL_LENGTH = 2048;
export const MAX_ASSETS_PER_SCENE = 50;

// Asset types
export const assetTypes = ['image', 'video'] as const;
export type AssetType = (typeof assetTypes)[number];

// Visibility types
export const visibilityTypes = ['private', 'public'] as const;
export type VisibilityType = (typeof visibilityTypes)[number];

// Generation sources
export const generationSources = ['ai', 'user'] as const;
export type GenerationSource = (typeof generationSources)[number];

// Supported formats
export const videoFormats = ['mp4', 'mov', 'mkv', 'mpg', 'webm', 'avi', 'ogg', 'mpeg', 'm4v', 'flv', 'wmv', '3gp'] as const;
export const imageFormats = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'tiff', 'webp', 'svg', 'ico', 'heic', 'raw'] as const;
export const allFormats = [...videoFormats, ...imageFormats] as const;

export type VideoFormat = (typeof videoFormats)[number];
export type ImageFormat = (typeof imageFormats)[number];
export type AssetFormat = (typeof allFormats)[number];

// Dimension constraints
export const MIN_DIMENSION = 1;
export const MAX_DIMENSION = 8192;

// Duration constraints (for video assets)
export const MIN_ASSET_DURATION = 0.1;
export const MAX_ASSET_DURATION = 3600; // 1 hour max
Loading