Skip to content

API para geração automatizada de vídeos curtos usando IA, com integração Google Generative AI, autenticação OAuth e gerenciamento de projetos via Prisma + PostgreSQL.

Notifications You must be signed in to change notification settings

GabrielMBatista/shortsai-api

Repository files navigation

ShortsAI API 🚀

Tests Code Quality TypeScript Next.js

The central nervous system of the ShortsAI platform. A robust Next.js 15 (App Router) backend with enterprise-grade architecture, acting as the API Gateway and Orchestrator.

Complete guides, architecture details, and development workflows:


🏗 Architecture Highlights

Modern Serverless Architecture with enterprise-grade features:

  • 20 Enterprise-Level Endpoints - All with logging, validation, and error handling
  • 19 Automated Tests - Jest + TypeScript for quality assurance
  • Structured Logging - Pino with request tracking and performance metrics
  • Type-Safe Validation - Zod schemas for all inputs
  • Custom Error Handling - 9 HTTP error classes with proper status codes
  • Request ID Tracking - Full observability and debugging capabilities
  • Performance Metrics - Automatic duration logging for all operations

Tech Stack

  • Framework: Next.js 15 (App Router)
  • Language: TypeScript 5.0 (strict mode)
  • Database: PostgreSQL + Prisma ORM
  • Testing: Jest + ts-jest
  • Logging: Pino (structured JSON logs)
  • Validation: Zod
  • Storage: Cloudflare R2
  • AI: Gemini 2.5 Flash, ElevenLabs, Groq

🚀 Quick Start

1. Install Dependencies

npm install

2. Database Setup

npx prisma generate
npx prisma db push

3. Environment Variables

Copy .env.example to .env and fill in your credentials:

DATABASE_URL="postgresql://..."
GEMINI_API_KEY="..."
ELEVENLABS_API_KEY="..."

4. Run Development Server

npm run dev

5. Run Tests

npm test

👉 For detailed setup instructions, see Quick Start Guide


📚 Core APIs

Endpoint Methods Description
/api/projects GET, POST, PATCH, DELETE Project management with validation
/api/channels GET, POST YouTube channel integration
/api/personas GET, POST, PATCH, DELETE AI personality management
/api/users GET, POST User management with limits

👉 See complete API Reference for all 20 endpoints


🧪 Testing

All infrastructure has comprehensive test coverage:

npm test              # Run all tests
npm run test:watch    # Watch mode
npm run test:coverage # Coverage report

Current Status: 19/19 tests passing ✅

👉 Learn more in Testing Guide


📊 Code Quality

This codebase follows enterprise-grade best practices:

  • 🏆 Clean Architecture - Separation of concerns, DRY, SOLID
  • 🔍 Type Safety - Zod + TypeScript for 100% type coverage
  • 📝 Documentation - JSDoc on all endpoints, comprehensive Wiki
  • 🧪 Test Coverage - 100% infrastructure coverage
  • 📊 Observability - Request IDs, performance metrics, structured logs
  • Performance - Optimized queries, parallel operations
  • 🔒 Security - Rate limiting, input validation, error sanitization

👉 See Migration History for transformation details


🤝 Contributing

We welcome contributions! Please follow our guidelines:

  1. Code Style: Follow existing patterns (see Development Guide)
  2. Testing: Add tests for new features
  3. Documentation: Update Wiki for significant changes
  4. Validation: Use Zod schemas for all inputs
  5. Logging: Use structured logging (Pino)
  6. Errors: Use custom error classes

👉 Full details in Development Guide


📖 Learn More


📊 Project Status

  • Code Quality: Enterprise-level
  • Test Coverage: Infrastructure 100%
  • Documentation: Complete Wiki
  • API Endpoints: 20/20 migrated
  • Type Safety: Fully typed
  • Performance: Optimized
  • 🔒 Security: Best practices applied

📝 License

This project is part of the ShortsAI platform.


Made with ❤️ by the ShortsAI team | 📚 Full Wiki Documentation

About

API para geração automatizada de vídeos curtos usando IA, com integração Google Generative AI, autenticação OAuth e gerenciamento de projetos via Prisma + PostgreSQL.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages