Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

AIEraDev/clypra-api

Repository files navigation

Clypra API — Zero-Cost High-Scale Edge Server

A high-performance, serverless edge API that serves text styling effect definitions and Lottie vector animations for the Clypra video editor desktop application.

Served globally across 300+ edge locations on Cloudflare Workers, cached in Cloudflare KV, and backed by public assets on GitHub — keeping running costs at $0/month forever.


⚡ Key Architectural Highlights

  • Thin Index Manifests: Drop initial app load times by 99% by serving lightweight asset summaries (IDs, names, tags, and thumbnails) for picking views, shrinking payload size from ~5MB to ~50KB.
  • On-Demand Lazy Loading: Heavy-duty assets (full vector stops, fills, outlines, and complete Lottie JSON keyframe data) are fetched dynamically only when selected or applied.
  • Client-Side RAM Cache: The desktop client maintains a local cache map to guarantee 0ms latency for timeline refreshes and recurring preset selections.
  • Edge-Cached: KV caching ensures raw GitHub fetches are bypassed on subsequent queries, serving requests with sub-10ms response times at scale.

🗺️ API Route Reference

Endpoint Method Cache TTL Description
/health GET None Sandbox health check and runtime timestamp
/effects GET 24 Hours Master array of all 24 text effect thin summaries
/effects/:category GET 24 Hours Array of thin summaries filtered by category
/effects/:category/:id GET 24 Hours Heavy vector style configs (fills, strokes, shadows, glows)
/templates GET 24 Hours Master array of all 16 template metadata summaries
/templates/:category GET 24 Hours Array of templates metadata filtered by category
/templates/:category/:id GET 6 Hours Heavy raw Lottie JSON animation keyframe payload
/audio GET 24 Hours Master array of approved public audio metadata
/audio/:category GET 24 Hours Approved public audio filtered by category
/audio/:category/:id GET 24 Hours Single approved audio metadata record
/search?q=neon GET None Global search query matching names, tags, and descriptions

🛠️ Local Sandbox Development

You can run the entire environment offline on your local machine using Python's static server and Wrangler's Miniflare simulation.

1. Recompile Optimized Database

If you add or modify text effects/templates in your desktop codebase, recompile the JSON manifests inside /data:

npm run extract

2. Start the Sandbox Environment

  1. Start the local asset server in the background (serves local JSON assets on port 8080):
    python3 -m http.server 8080 --directory data
  2. Start Wrangler Dev Server (routes worker requests locally on port 8787):
    npm run dev
  3. Verify Health Check:
    curl http://localhost:8787/health

🚀 Cloud Deployment Checklist

To push the database and Hono Worker live globally:

Step 1 — Push Assets to GitHub

Ensure your repository is set to Public so that Cloudflare's servers can read raw files securely from raw.githubusercontent.com.

git add .
git commit -m "Configure: compile high-scale thin manifests"
git push origin main

Step 2 — Create your KV Namespace

Generate a production KV store in your Cloudflare account:

npx wrangler kv:namespace create "EFFECTS_KV"

Copy the generated ID and replace the placeholder inside wrangler.toml:

[[kv_namespaces]]
binding = "EFFECTS_KV"
id = "YOUR_NEW_KV_NAMESPACE_ID"

Step 3 — Deploy Live

Upgraded to Wrangler v4 with 0 security vulnerabilities. Deploy instantly using:

npm run deploy

Output: https://clypra-worker-api.abdulkabirmusa.com


📝 License

Licensed under the MIT License.

About

High-performance, zero-cost edge API for Clypra video editor text effects and Lottie templates. Scalably served via Cloudflare Workers & Cloudflare KV with automated dynamic GitHub asset building.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors