Skip to content

Latest commit

Β 

History

History
493 lines (410 loc) Β· 16 KB

File metadata and controls

493 lines (410 loc) Β· 16 KB

StudioBot.ai: Directory Structure & Navigation Guide

πŸ“ Complete Project Structure

StudioBot.ai/
β”‚
β”œβ”€β”€ πŸ“‚ src/                                 # TypeScript Source Code
β”‚   β”œβ”€β”€ index.ts                           # Express server entry point
β”‚   β”‚
β”‚   β”œβ”€β”€ πŸ“‚ routes/                         # API Route Handlers (6 files)
β”‚   β”‚   β”œβ”€β”€ auth.routes.ts                 # Auth endpoints (register, login, profile)
β”‚   β”‚   β”œβ”€β”€ video.routes.ts                # Video management (upload, list, delete)
β”‚   β”‚   β”œβ”€β”€ clip.routes.ts                 # Clip creation & approval
β”‚   β”‚   β”œβ”€β”€ short.routes.ts                # Shorts generation
β”‚   β”‚   β”œβ”€β”€ thumbnail.routes.ts            # Thumbnail generation
β”‚   β”‚   └── platform.routes.ts             # Platform integrations
β”‚   β”‚
β”‚   β”œβ”€β”€ πŸ“‚ services/                       # Business Logic Layer (10 files)
β”‚   β”‚   β”œβ”€β”€ auth.service.ts                # User authentication
β”‚   β”‚   β”œβ”€β”€ video.service.ts               # Video analysis & processing
β”‚   β”‚   β”œβ”€β”€ clip.service.ts                # Clip extraction with FFmpeg
β”‚   β”‚   β”œβ”€β”€ short.service.ts               # Vertical format conversion
β”‚   β”‚   β”œβ”€β”€ thumbnail.service.ts           # Thumbnail generation
β”‚   β”‚   β”œβ”€β”€ platform.service.ts            # Multi-platform publishing
β”‚   β”‚   β”œβ”€β”€ platform.integrations.ts       # YouTube, Twitch, Rumble APIs
β”‚   β”‚   β”œβ”€β”€ oauth.service.ts               # OAuth flow management
β”‚   β”‚   β”œβ”€β”€ analytics.service.ts           # Analytics aggregation
β”‚   β”‚   └── ai.integration.ts              # AI service integrations
β”‚   β”‚
β”‚   β”œβ”€β”€ πŸ“‚ middleware/                     # Express Middleware (2 files)
β”‚   β”‚   β”œβ”€β”€ errorHandler.ts                # Centralized error handling
β”‚   β”‚   └── auth.ts                        # JWT authentication
β”‚   β”‚
β”‚   β”œβ”€β”€ πŸ“‚ database/                       # Data Access Layer (1 file)
β”‚   β”‚   └── init.ts                        # SQLite/PostgreSQL schema
β”‚   β”‚
β”‚   β”œβ”€β”€ πŸ“‚ types/                          # TypeScript Types (1 file)
β”‚   β”‚   └── models.ts                      # Data models & interfaces
β”‚   β”‚
β”‚   β”œβ”€β”€ πŸ“‚ utils/                          # Utility Functions (1 file)
β”‚   β”‚   └── logger.ts                      # Structured logging
β”‚   β”‚
β”‚   └── πŸ“‚ dashboard/                      # React Components (1 file)
β”‚       └── Dashboard.tsx                  # Main dashboard UI
β”‚
β”œβ”€β”€ πŸ“‚ sdk/                                 # Client Libraries
β”‚   └── studiobot-sdk.ts                   # TypeScript SDK (400+ lines)
β”‚
β”œβ”€β”€ πŸ“‚ cli/                                 # Command-Line Tools
β”‚   └── studiobot-cli.ts                   # CLI with Commander.js
β”‚
β”œβ”€β”€ πŸ“‚ data/                                # Runtime Data
β”‚   └── studiobot.db                       # SQLite database (auto-created)
β”‚
β”œβ”€β”€ πŸ“‚ temp/                                # Temporary Files
β”‚   └── πŸ“‚ videos/                         # Temporary video storage
β”‚
β”œβ”€β”€ πŸ“‚ output/                              # Generated Content
β”‚   β”œβ”€β”€ πŸ“‚ clips/                          # Generated clips
β”‚   β”œβ”€β”€ πŸ“‚ shorts/                         # Generated shorts (1080x1920)
β”‚   └── πŸ“‚ thumbnails/                     # Generated thumbnails
β”‚
β”œβ”€β”€ πŸ“‚ logs/                                # Application Logs
β”‚   └── app.log                            # Main application log file
β”‚
β”œβ”€β”€ πŸ“‚ node_modules/                        # NPM Dependencies (auto-created)
β”‚   └── [100+ packages]
β”‚
β”œβ”€β”€ πŸ“‚ dist/                                # Compiled JavaScript (auto-created)
β”‚   └── [compiled .js files]
β”‚
β”œβ”€β”€ πŸ“ Configuration Files
β”‚   β”œβ”€β”€ package.json                       # Dependencies & scripts
β”‚   β”œβ”€β”€ package-lock.json                  # Locked versions
β”‚   β”œβ”€β”€ tsconfig.json                      # TypeScript config
β”‚   β”œβ”€β”€ .env.example                       # Environment variables template
β”‚   β”œβ”€β”€ .env                                # Your local env vars (git ignored)
β”‚   β”œβ”€β”€ .gitignore                         # Git ignore rules
β”‚   └── .eslintrc.json                     # Linting rules
β”‚
β”œβ”€β”€ 🐳 Container Files
β”‚   β”œβ”€β”€ Dockerfile                         # Single container build
β”‚   └── docker-compose.yml                 # Multi-service orchestration
β”‚
β”œβ”€β”€ πŸ“š Documentation Files
β”‚   β”œβ”€β”€ README.md                          # Project description
β”‚   β”œβ”€β”€ API.md                             # API reference (30+ endpoints)
β”‚   β”œβ”€β”€ ARCHITECTURE.md                    # System design & patterns
β”‚   β”œβ”€β”€ CONFIGURATION.md                   # Advanced configuration
β”‚   β”œβ”€β”€ DEPLOYMENT.md                      # Deployment guide
β”‚   β”œβ”€β”€ SETUP_GUIDE.md                     # Getting started (NEW)
β”‚   β”œβ”€β”€ PLATFORM_INTEGRATION.md            # Platform setup (NEW)
β”‚   β”œβ”€β”€ WORKFLOWS_AND_RECIPES.md           # Usage examples (NEW)
β”‚   β”œβ”€β”€ PROJECT_OVERVIEW.md                # Complete overview (NEW)
β”‚   β”œβ”€β”€ LATEST_UPDATES.md                  # What's new (NEW)
β”‚   └── DIRECTORY_STRUCTURE.md             # This file (NEW)
β”‚
β”œβ”€β”€ πŸ§ͺ Testing
β”‚   └── test-api.js                        # API integration tests (300+ lines)
β”‚
└── πŸ“‹ Project Files
    β”œβ”€β”€ LICENSE                            # MIT License
    └── .gitattributes                     # Git attributes

πŸ—ΊοΈ Navigation Guide

Quick Links by Task

πŸš€ Getting Started

  1. First Time Setup: Read SETUP_GUIDE.md
  2. Quick Test: Run node test-api.js
  3. Check Health: curl http://localhost:3000/health

πŸ“‘ API Development

  1. View All Endpoints: API.md
  2. Route Handlers: src/routes/ (6 files)
  3. Services: src/services/ (10 files)
  4. Types: src/types/models.ts

πŸ”Œ Platform Integration

  1. Setup Instructions: PLATFORM_INTEGRATION.md
  2. Implementation: src/services/platform.integrations.ts
  3. OAuth Flows: src/services/oauth.service.ts
  4. Analytics: src/services/analytics.service.ts

πŸ’» Client Development

  1. TypeScript SDK: sdk/studiobot-sdk.ts
  2. CLI Tool: cli/studiobot-cli.ts
  3. React Dashboard: src/dashboard/Dashboard.tsx

πŸ“Š Monitoring & Analytics

  1. Logs: logs/app.log
  2. Analytics Service: src/services/analytics.service.ts
  3. Database: data/studiobot.db

🐳 Deployment

  1. Docker Setup: DEPLOYMENT.md
  2. Dockerfile: ./Dockerfile
  3. Docker Compose: ./docker-compose.yml
  4. Configuration: CONFIGURATION.md

πŸ“š Learning Resources

  1. Architecture: ARCHITECTURE.md
  2. Workflows: WORKFLOWS_AND_RECIPES.md
  3. Project Overview: PROJECT_OVERVIEW.md
  4. Latest Updates: LATEST_UPDATES.md

πŸ“‚ Directory Purpose

src/ - Main Application Code

Contains all TypeScript source code organized into layers:

  • routes/ - HTTP endpoint handlers
  • services/ - Business logic & external APIs
  • middleware/ - Express middleware
  • database/ - Data access & schema
  • types/ - TypeScript interfaces
  • utils/ - Helper functions
  • dashboard/ - React components

Files: 22 TypeScript files Lines: 5,000+ lines of code Key File: src/index.ts (application entry point)

sdk/ - Client Libraries

Client-side code for consuming the API:

  • studiobot-sdk.ts - TypeScript SDK with 20+ methods

Usage:

import { StudioBotAPI } from './sdk/studiobot-sdk';
const api = new StudioBotAPI('http://localhost:3000');

cli/ - Command-Line Interface

Interactive console tool:

  • studiobot-cli.ts - 400+ lines with 10+ commands

Usage:

studiobot-cli auth:register
studiobot-cli video:upload
studiobot-cli clip:create

data/ - Database Files

Runtime data storage:

  • studiobot.db - SQLite database (auto-created)

Access:

sqlite3 data/studiobot.db ".tables"

temp/ - Temporary Storage

Intermediate processing files:

  • videos/ - Downloaded/uploaded videos awaiting processing

Auto-cleanup: Typically cleared after processing

output/ - Generated Content

Final processed outputs:

  • clips/ - Extracted clip videos
  • shorts/ - Vertical format shorts
  • thumbnails/ - Generated preview images

Storage: Persisted for download/delivery

logs/ - Application Logs

Runtime diagnostic information:

  • app.log - Main application log file

View logs:

tail -f logs/app.log

dist/ - Compiled Output

Auto-generated compiled JavaScript:

  • Contains compiled .js files from src/ TypeScript
  • Generated by npm run build

Generated from: src/ directory Used by: npm start command


πŸ“– Documentation Map

Getting Started (Beginner)

1. README.md              ← Start here
2. SETUP_GUIDE.md         ← Installation & config
3. test-api.js            ← Try it out

Understanding the System (Intermediate)

1. ARCHITECTURE.md        ← How it works
2. API.md                 ← API endpoints
3. PROJECT_OVERVIEW.md    ← Complete structure

Building & Customizing (Advanced)

1. PLATFORM_INTEGRATION.md ← Add YouTube/Twitch/Rumble
2. CONFIGURATION.md        ← Advanced settings
3. WORKFLOWS_AND_RECIPES.md ← Automation examples

Deployment & Operations (DevOps)

1. DEPLOYMENT.md          ← Production setup
2. Docker files           ← Containerization
3. CONFIGURATION.md       ← Env variables

πŸ” Finding Things

By Feature

Video Upload

  • Route: src/routes/video.routes.ts
  • Service: src/services/video.service.ts
  • Endpoint: POST /api/videos/upload
  • SDK: api.uploadVideo()

Multi-Platform Publishing

  • Route: src/routes/platform.routes.ts
  • Service: src/services/platform.service.ts
  • Integration: src/services/platform.integrations.ts
  • Endpoint: POST /api/distributions/publish

User Authentication

  • Route: src/routes/auth.routes.ts
  • Service: src/services/auth.service.ts
  • Middleware: src/middleware/auth.ts
  • Endpoint: POST /api/auth/login

Analytics

  • Service: src/services/analytics.service.ts
  • Endpoint: GET /api/distributions/analytics
  • SDK: api.getDistributionAnalytics()

OAuth Integration

  • Service: src/services/oauth.service.ts
  • Doc: PLATFORM_INTEGRATION.md
  • Endpoint: POST /api/platforms/auth/:platform

By Language

TypeScript Services

  • Location: src/services/*.ts
  • Count: 10 files
  • Purpose: Business logic

API Routes

  • Location: src/routes/*.ts
  • Count: 6 files
  • Purpose: HTTP endpoints

React Components

  • Location: src/dashboard/
  • Count: 1 main component
  • Purpose: Web UI

JavaScript

  • Location: test-api.js, cli/*, sdk/*`
  • Purpose: Testing, CLI, SDK

SQL/Database

  • Location: src/database/init.ts
  • Purpose: Schema definition

πŸ› οΈ Common Commands

Development

npm install              # Install dependencies
npm run build            # Build TypeScript
npm run dev              # Development with hot-reload
npm start                # Run server
npm test                 # Run tests

Testing

node test-api.js         # Run integration tests
curl http://localhost:3000/health  # Health check
npm test -- --watch      # Watch mode

Database

sqlite3 data/studiobot.db ".tables"     # List tables
sqlite3 data/studiobot.db ".schema"     # View schema
npm run migrate:up                      # Database migrations

Docker

docker build -t studiobot:latest .      # Build image
docker run -p 3000:3000 studiobot      # Run container
docker-compose up -d                    # Start all services

CLI

npx ts-node cli/studiobot-cli.ts help          # List commands
npm link                                        # Install globally
studiobot-cli auth:register                    # Run command

πŸ“Š Project Statistics

Code Files

Type Count Lines
Services 10 2,500+
Routes 6 800+
Middleware 2 150
Components 1 350+
SDK 1 400+
CLI 1 400+
Tests 1 300+
Total 22 5,000+

Documentation

File Lines Purpose
README.md 150 Overview
API.md 400 API reference
ARCHITECTURE.md 300 Design patterns
CONFIGURATION.md 250 Config guide
DEPLOYMENT.md 300 Deployment
SETUP_GUIDE.md 400 Setup instructions
PLATFORM_INTEGRATION.md 300 Platform setup
WORKFLOWS_AND_RECIPES.md 500 Examples
PROJECT_OVERVIEW.md 400 Complete overview
LATEST_UPDATES.md 400 What's new
Total 3,000+ Complete docs

πŸš€ Project Readiness

βœ… Core Features

  • 30+ API endpoints
  • 7-table database schema
  • Video processing pipeline
  • Multi-platform integration
  • OAuth 2.0 flows
  • Analytics aggregation
  • React dashboard
  • CLI tool
  • TypeScript SDK

βœ… Development Tools

  • TypeScript support
  • ESLint config
  • Jest setup
  • Integration tests
  • Error handling
  • Logging system
  • Docker support

βœ… Documentation

  • API reference
  • Setup guide
  • Architecture guide
  • Platform integration guide
  • Workflow examples
  • Deployment guide
  • Configuration guide

⏳ Future Enhancements

  • Live streaming support
  • Mobile app (React Native)
  • Advanced ML features
  • Webhook support
  • Message queuing
  • GraphQL API
  • Admin dashboard

πŸ’‘ Tips for Navigation

  1. Always start with README.md - Get oriented
  2. Use SETUP_GUIDE.md before running anything - Proper environment
  3. Check API.md for endpoint details - Find what you need
  4. Read ARCHITECTURE.md to understand design - Learn the structure
  5. Look at WORKFLOWS_AND_RECIPES.md for examples - See real code
  6. Search for feature names - Find implementation quickly
  7. Use IDE's "Go to Definition" - Jump between files
  8. Check test-api.js for usage - See working examples

πŸ†˜ If You Can't Find Something

Problem: "Where is X feature?"

  1. Search in PROJECT_OVERVIEW.md for feature index
  2. Check API.md for endpoint
  3. Look in src/routes/ for route handler
  4. Find in src/services/ for business logic
  5. Check DIRECTORY_STRUCTURE.md (this file)

Problem: "How do I use X?"

  1. Check SETUP_GUIDE.md for initial setup
  2. See API.md for endpoint docs
  3. Look at test-api.js for usage examples
  4. Check SDK method in sdk/studiobot-sdk.ts
  5. View recipes in WORKFLOWS_AND_RECIPES.md

Problem: "How do I deploy?"

  1. Follow DEPLOYMENT.md
  2. Use docker-compose.yml for full stack
  3. Configure CONFIGURATION.md
  4. Follow production checklist in SETUP_GUIDE.md

πŸ“ž Documentation Cross-References

Doc Covers Links To
README.md Overview All other docs
SETUP_GUIDE.md Getting started PLATFORM_INTEGRATION.md
PLATFORM_INTEGRATION.md Platform setup CONFIGURATION.md
API.md Endpoints src/routes/
WORKFLOWS_AND_RECIPES.md Examples SDK, CLI, API
ARCHITECTURE.md Design Database, Services
DEPLOYMENT.md Production Docker, docker-compose.yml
PROJECT_OVERVIEW.md Reference All docs

You're all set! Navigate using this guide and the cross-references above. Happy coding! πŸš€