Home
Softono

Pocat Api

Open source TypeScript
11
Stars
3
Forks
0
Issues
0
Watchers
7 months
Last Commit

 About Pocat Api

Pocat API is a backend solution for an AI-powered video clipping platform designed to transform long-form videos into engaging short clips similar to OpusClip or Vizard AI. Built with AdonisJS 6 and TypeScript, it provides a robust API for video content analysis, highlighting detection, and smart clipping based on engagement potential. The system integrates yt-dlp to handle YouTube video downloads across various quality settings from 144p to 4K. Key features include automatic speech-to-text transcription, subtitle generation, and support for multiple export formats. The architecture utilizes Turso, an edge-replicated SQLite-compatible database, ensuring scalable data management with a custom service layer for direct integration. Security is maintained through access token-based authentication and OAuth readiness. The software includes standard user management endpoints for creating, reading, updating, and deleting user records, alongside specialized endpoints for testing database connections and managing AI w

Platforms

Web Self-hosted

Languages

TypeScript

Need Help Installing Pocat Api?

We provide expert installation service for this software. Our team will install, configure, and secure Pocat Api on your server. plans start at just $30.

Pocat.io - AI Video Clipper API

Backend API untuk platform video clipper AI yang memungkinkan users untuk mengubah video panjang menjadi clips pendek yang engaging, mirip seperti OpusClip atau Vizard AI.

🎬 Features

  • AI Video Analysis - Analisis konten video untuk highlight detection
  • Auto Transcription - Speech-to-text dengan AI
  • Smart Clipping - Generate clips berdasarkan engagement potential
  • Subtitle Generation - Auto-generate subtitle untuk clips
  • Multi-format Export - Support berbagai format output
  • Turso Database - SQLite-compatible database dengan edge replication
  • Authentication - Access tokens untuk API security

πŸš€ Tech Stack

  • AdonisJS 6 - Modern Node.js framework
  • Turso Database - Edge SQLite database
  • TypeScript - Full type safety
  • AI Integration - Ready for OpenAI, AWS services
  • Cloud Storage - S3-compatible storage integration

πŸ“¦ Installation

# Clone atau download project
cd pocat.io

# Install dependencies dengan pnpm
pnpm install

# Setup environment variables
cp .env.example .env
# Edit .env dan tambahkan Turso credentials:
# DATABASE_URL=your_turso_database_url
# DATABASE_AUTH_TOKEN=your_turso_auth_token

πŸ—„οΈ Database Setup

# Run migrations ke Turso database
pnpm exec node ace migrate:turso

# Test koneksi Turso
pnpm exec node ace test:turso

πŸƒβ€β™‚οΈ Running the Application

# Development mode
pnpm run dev

# Production build
pnpm run build
cd build
pnpm i --prod
node bin/server.js

πŸ“š API Endpoints

Base URL: http://localhost:3333

Test Endpoints

  • GET / - API information dan available endpoints
  • GET /test-turso - Test Turso database connection
  • POST /create-table - Create test table

Users API

  • GET /users - Get all users
  • POST /users - Create new user
  • GET /users/:id - Get user by ID
  • PUT /users/:id - Update user
  • DELETE /users/:id - Delete user

Example Usage

Create User

curl -X POST http://localhost:3333/users \
  -H "Content-Type: application/json" \
  -d '{
    "name": "John Doe",
    "email": "[email protected]",
    "password": "password123"
  }'

Get All Users

curl http://localhost:3333/users

Get User by ID

curl http://localhost:3333/users/1

Update User

curl -X PUT http://localhost:3333/users/1 \
  -H "Content-Type: application/json" \
  -d '{
    "name": "John Updated",
    "email": "[email protected]"
  }'

Delete User

curl -X DELETE http://localhost:3333/users/1

πŸ—οΈ Project Structure

hello-world/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ controllers/
β”‚   β”‚   β”œβ”€β”€ tests_controller.ts      # Test endpoints
β”‚   β”‚   └── users_controller.ts      # Users CRUD API
β”‚   └── services/
β”‚       └── turso_service.ts         # Turso database service
β”œβ”€β”€ commands/
β”‚   β”œβ”€β”€ migrate_turso.ts             # Turso migration command
β”‚   └── test_turso.ts                # Turso connection test
β”œβ”€β”€ config/
β”‚   └── database.ts                  # Database configuration
β”œβ”€β”€ start/
β”‚   └── routes.ts                    # API routes definition
└── .env                             # Environment variables

πŸ”§ Custom Turso Service

Project ini menggunakan custom service untuk integrasi langsung dengan Turso:

// app/services/turso_service.ts
import { createClient } from '@libsql/client'

class TursoService {
  async execute(sql: string, params?: any[]) {
    return await this.client.execute({
      sql,
      args: params || [],
    })
  }
  
  async batch(statements: Array<{ sql: string; args?: any[] }>) {
    return await this.client.batch(statements)
  }
}

πŸ› οΈ Available Commands

# Test Turso connection
pnpm exec node ace test:turso

# Run Turso migrations
pnpm exec node ace migrate:turso

# Start development server
pnpm run dev

# Build for production
pnpm run build

# Run tests
pnpm run test

# Lint code
pnpm run lint

# Format code
pnpm run format

🌟 Key Benefits

  1. Edge Database - Turso menyediakan SQLite database dengan replikasi global
  2. Low Latency - Database edge locations untuk performa optimal
  3. Scalable - Auto-scaling berdasarkan usage
  4. Cost Effective - Pay per request model
  5. Developer Friendly - SQLite syntax yang familiar

πŸ“ Environment Variables

# Server Configuration
TZ=UTC
PORT=3333
HOST=localhost
LOG_LEVEL=info
APP_KEY=your_app_key
NODE_ENV=development

# Turso Database
DATABASE_URL=libsql://your-database-url
DATABASE_AUTH_TOKEN=your_auth_token

🀝 Contributing

  1. Fork the project
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open Pull Request

πŸ“„ License

This project is licensed under the MIT License.