Buncrawl:基于 Bun 原生 API 的 AI 智能体网页数据 API
urdadx/buncrawl
Buncrawl 是一个面向 AI 智能体的网页数据 API,基于 Bun 原生 API 构建。项目采用 TypeScript、TanStack Router、tRPC、Drizzle ORM 与 SQLite,前端为 React,支持通过 Docker Compose 部署 web 与 server,并将 SQLite 持久化到 ./.data/buncrawl.db。
Buncrawl is a web data API for AI agents, built with native Bun APIs.
Tech Stack
- TypeScript - For type safety and improved developer experience
- TanStack Router - File-based routing with full type safety
- TailwindCSS - Utility-first CSS for rapid UI development
- Shared UI package - shadcn/ui primitives live in
packages/ui - tRPC - End-to-end type-safe APIs
- Bun - Runtime environment
- Drizzle - TypeScript-first ORM
- SQLite - Database engine
- Oxlint - Oxlint + Oxfmt (linting & formatting)
Getting Started
First, install the dependencies:
pnpm install
Database Setup
This project uses SQLite with Drizzle ORM.
- Start the local SQLite database (optional):
pnpm run db:local
-
Update your
.envfile in theapps/serverdirectory with the appropriate connection details if needed. -
Apply the schema to your database:
pnpm run db:push
Then, run the development server:
pnpm run dev
Open http://localhost:3001 in your browser to see the web application. The API is running at http://localhost:3000.
Deployment
Docker Compose
- Target: web + server
- Config:
docker-compose.yml(app Dockerfiles live inapps/*/Dockerfile) - Build images: pnpm run docker:build
- Start: pnpm run docker:up
- Logs: pnpm run docker:logs
- Stop: pnpm run docker:down
Environment variables are read from each app's .env file (baked into web builds for public variables) and overridden in docker-compose.yml for container networking.
Docker Compose persists SQLite at ./.data/buncrawl.db and artifacts under
./.data/artifacts. The server applies its required storage schema during startup.
Project Structure
buncrawl/
├── apps/
│ ├── web/ # Frontend application (React + TanStack Router)
│ └── server/ # Backend API (Bun, TRPC)
├── packages/
│ ├── ui/ # Shared shadcn/ui components and styles
│ ├── api/ # API layer / business logic
│ └── db/ # Database schema & queries
Available Scripts
pnpm run dev: Start all applications in development modepnpm run build: Build all applicationspnpm run dev:web: Start only the web applicationpnpm run dev:server: Start only the serverpnpm run check-types: Check TypeScript types across all appspnpm run db:push: Push schema changes to databasepnpm run db:generate: Generate database client/typespnpm run db:migrate: Run database migrationspnpm run db:studio: Open database studio UIpnpm run db:local: Start the local SQLite databasepnpm run check: Run Oxlint and Oxfmtpnpm run docker:build: Build the Docker Compose imagespnpm run docker:up: Build and start the Docker Compose stackpnpm run docker:logs: Tail logs from the Docker Compose stackpnpm run docker:down: Stop the Docker Compose stack
来源:GitHub · github.com