srrexus/komicastapi
<div align="center">
๐ Komikcast API
A fast, free, and open-source REST API for manga data
    
Live Demo ยท API Explorer ยท Report Bug
</div>
โจ Features
- ๐ Blazing Fast โ Responses are aggressively cached on the Edge (5 min to 7 days)
- ๐ API Key Support โ Your own apps get unlimited access with a secret bypass key
- ๐ก๏ธ Rate Limited โ Built-in per-IP rate limiting (60 req/min) to prevent abuse
- ๐ผ๏ธ Image Proxy โ Built-in proxy to bypass hotlinking and CORS restrictions
- ๐ Interactive Docs โ API Explorer dashboard at
/api - ๐ Cloudflare Bypass โ CF Worker proxy to avoid 403 blocks on serverless platforms
- ๐ฆ Self-Hostable โ Deploy to Vercel or Hugging Face Spaces with one push
๐ฆ API Endpoints
Base URL: https://your-deployment.vercel.app
Popular Categories
?category=best-manhwa
?category=best-manhua
?category=best-manga
?category=anime-adaptations
?category=trendingResponse Format
All endpoints return structured JSON:
{
"status": 200,
"message": "Success",
"data": { ... }
}Rate Limiting
Bypass rate limit by sending your secret API key:
X-API-Key: your-secret-key๐ ๏ธ Tech Stack
๐ Self-Hosting Guide
Prerequisites
- Node.js 22+
- pnpm 11
- A Vercel or Hugging Face account (both free)
- A Cloudflare account (free)
1. Clone & Install
git clone https://github.com/Wakype/komikcast-api.git
cd komikcast-api
pnpm install2. Configure Environment
cp .env.example .env.localEdit .env.local:
# Required: Target manga site URL
MANGA_BASE_URL=https://be.komikcast.cc/
# Required for Vercel/HF deploy: Your CF Worker proxy URL
SCRAPER_PROXY_URL=https://your-worker.your-subdomain.workers.dev
# Optional: additional proxy fallbacks
SCRAPER_PROXY_URL_2=
SCRAPER_PROXY_URL_3=
# Optional: ScraperAPI key (alternative to CF Worker)
SCRAPER_API_KEY=
# Optional: Secret key for rate limit bypass
BYPASS_SECRET=your-super-secret-key3. Deploy Cloudflare Worker
The deployment needs a Cloudflare Worker to bypass Cloudflare's IP blocking. The worker code is at cloudflare-worker/worker.js.
- Go to Cloudflare Dashboard โ Workers & Pages โ Create Worker
- Name it (e.g.,
komikcast-proxy) โ click Deploy - Click Edit Code โ paste the contents of
cloudflare-worker/worker.js - In Worker Settings โ Variables, add:
BYPASS_SECRET= same value as your.env.local - Click Deploy and copy the Worker URL โ set it as
SCRAPER_PROXY_URL
4. Run Locally
pnpm devOpen http://localhost:3000 for the landing page, or http://localhost:3000/api for the API Explorer.
โ๏ธ Deploy to Vercel
# Push to GitHub, then import in Vercel dashboard
# Or use Vercel CLI:
npx vercelSet all environment variables in Vercel โ Project โ Settings โ Environment Variables.
๐ค Deploy to Hugging Face Spaces
This project supports auto-deploy to Hugging Face Spaces via GitHub Actions.
1. Add Dockerfile to project root
FROM node:22-alpine AS builder
WORKDIR /app
RUN corepack enable
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY . .
RUN pnpm build
FROM node:22-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV PORT=7860
RUN corepack enable
COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
EXPOSE 7860
CMD ["node", "server.js"]2. Enable standalone output in next.config.ts
const nextConfig: NextConfig = {
output: 'standalone',
};3. Create a Hugging Face Space
- Login to huggingface.co โ New Space
- Choose SDK: Docker
- Note your
usernameandspace-name
4. Get a Hugging Face Token
Go to huggingface.co/settings/tokens โ New token โ Role: Write
5. Add GitHub Secrets
Go to your GitHub repo โ Settings โ Secrets and variables โ Actions โ New repository secret
6. Add the GitHub Action
Add .github/workflows/deploy-huggingface.yml to your repo (see the workflow file included in this repo). Every push to main will automatically build and deploy to your Space.
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ
โ Your Frontend โโโโโโโ API Server โโโโโโโ CF Worker โโโโโโ Target Site
โ + X-API-Key โ โ (Next.js) โ โ (Proxy) โ (komikcast)
โ โ โ Rate Limiter โ โ Trusted IPs โ
โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ
โ
Random Users
(rate limited)Why Cloudflare Worker? Vercel and Hugging Face serverless functions run on datacenter IPs that Cloudflare actively blocks. By routing requests through a CF Worker (which runs inside Cloudflare's own network), requests are treated as trusted.
๐ Project Structure
komikcast-api/
โโโ .github/
โ โโโ workflows/
โ โโโ deploy-huggingface.yml # Auto-deploy to HF Spaces
โโโ app/
โ โโโ api/ # API endpoints + Explorer UI
โ โโโ legal/ # Legal pages (Terms, Privacy, DMCA)
โ โโโ page.tsx # Landing page
โโโ cloudflare-worker/ # CF Worker proxy (deploy separately)
โโโ libs/ # Scraper core (fetchAPI, fetchPage)
โโโ types/ # TypeScript interfaces
โโโ utils/ # Response helpers, cache utilities
โโโ Dockerfile # For Hugging Face Spaces deployment
โโโ .env.example # Environment variable template
โโโ AGENTS.md # AI coding assistant guideโ ๏ธ Legal Disclaimer
This API is provided for educational purposes and personal projects only. The creator is not responsible for how you use the data. We do not host any manga, images, or copyrighted content. All content belongs to their respective copyright holders.
๐ License
MIT License
Made with โค๏ธ by waky.dev
