How reyothedev/clipandpost_api works
ClipAndPost is an Express API for managing uploaded project clips and publishing them to Instagram. The main workflow is authenticated API requests for project and clip management, direct-to-R2 uploads with metadata persisted in Supabase, then schedule or publish operations that fetch media and submit it to Instagram. The README documents the project, clip, schedule, and connected-account data model; the supplied source excerpts do not show video clipping or generation, so that capability is not represented as an implemented stage. Some route wiring and controller relationships are supported by the SOURCE INDEX rather than full excerpts.
Main entry points: index.js API route map · db.service.js Persistence service · publishing.service.js Publish orchestration · r2.service.js Media storage service
Components 25
API and access
- Express app
src/app.js - API route map
src/routes/index.js - User authentication
src/middleware/auth.middleware.js - Health endpoint
src/controllers/health.controller.js - Instagram routes
src/routes/instagram.routes.js
Projects and uploads
- Project routes
src/routes/projects.routes.js - Project API
src/controllers/projects.controller.js - Upload routes
src/routes/upload.routes.js - Clip upload API
src/controllers/upload.controller.js
Scheduling and publishing
- Schedule routes
src/routes/schedule.routes.js - Schedule API
src/controllers/schedule.controller.js - Publishing routes
src/routes/publishing.routes.js - Publishing API
src/controllers/publishing.controller.js - Publish orchestration
src/services/publishing/publishing.service.js
External integrations
- Instagram account API
src/controllers/instagram.controller.js - Instagram OAuth and API
src/services/instagram.service.js - Instagram publisher
src/services/instagram/instagramPublisher.service.js - Media storage service
src/services/storage/r2.service.js - Persistence service
src/services/supabase/db.service.js - Token encryption
src/services/encryption/tokenCrypto.service.js - Supabase client
src/config/supabase.js - Supabase PostgreSQL
- Cloudflare R2
- Meta Instagram API
Other components
- API client
Connections 36
- API client → Express app: sends requests
README.md - Express app → API route map: mounts API
src/app.js - Express app → API client: returns errors
src/app.js - API route map → Health endpoint: routes health
src/routes/index.js - API route map → Instagram routes: mounts routes
src/routes/index.js - API route map → Project routes: mounts routes
src/routes/index.js - API route map → Upload routes: mounts routes
src/routes/index.js - API route map → Schedule routes: mounts routes
src/routes/index.js - API route map → Publishing routes: mounts routes
src/routes/index.js - Instagram routes → Instagram account API: dispatches to
src/routes/instagram.routes.js - Instagram account API → Instagram OAuth and API: calls OAuth
src/controllers/instagram.controller.js - Instagram account API → Supabase client: persists account
src/controllers/instagram.controller.js - Instagram OAuth and API → Meta Instagram API: calls API
src/services/instagram.service.js - Project routes → User authentication: authenticates
src/routes/projects.routes.js - Project routes → Project API: dispatches to
src/routes/projects.routes.js - Project API → Persistence service: manages project data
src/controllers/projects.controller.js - Project API → Media storage service: manages media
src/controllers/projects.controller.js - Upload routes → User authentication: authenticates
src/routes/upload.routes.js - Upload routes → Clip upload API: dispatches to
src/routes/upload.routes.js - Clip upload API → Media storage service: presigns and deletes
src/controllers/upload.controller.js - Clip upload API → Persistence service: persists clip metadata
src/controllers/upload.controller.js - Schedule routes → User authentication: authenticates
src/routes/schedule.routes.js - Schedule routes → Schedule API: dispatches to
src/routes/schedule.routes.js - Schedule API → Persistence service: reads and saves schedules
src/controllers/schedule.controller.js - Publishing routes → User authentication: authenticates
src/routes/publishing.routes.js - Publishing routes → Publishing API: dispatches to
src/routes/publishing.routes.js - Publishing API → Publish orchestration: starts publishing
src/controllers/publishing.controller.js - Publishing API → Persistence service: reads publishing data
src/controllers/publishing.controller.js - Publish orchestration → Persistence service: loads and updates state
src/services/publishing/publishing.service.js - Publish orchestration → Media storage service: checks and signs media
src/services/publishing/publishing.service.js - Publish orchestration → Instagram publisher: publishes containers
src/services/publishing/publishing.service.js - Instagram publisher → Meta Instagram API: submits media
src/services/instagram/instagramPublisher.service.js - Persistence service → Supabase client: uses client
src/services/supabase/db.service.js - Persistence service → Token encryption: uses encryption
src/services/supabase/db.service.js - Supabase client → Supabase PostgreSQL: connects to
src/config/supabase.js - Media storage service → Cloudflare R2: reads and writes
src/services/storage/r2.service.js