A full-stack AI novel creation platform powered by Cloudflare Workers, with both Web and React Native App clients.
- Multi-provider model support (Gemini, OpenAI, DeepSeek, custom provider headers)
- Story Bible generation and editing
- Outline generation and refinement (SSE stream)
- Single chapter generation (SSE stream)
- Batch chapter generation (persistent background task)
- Chapter reading, copying, and ZIP export
- Character relationship graph and context-aware writing
| Layer/Phase | Module | Purpose |
|---|---|---|
| Base | Story Bible | World, rules, setting, constraints |
| Base | Rolling Summary | Compressed running summary |
| Base | Recent Chapters | Style and continuity anchoring |
| Phase 1 | Character State | Character status snapshots |
| Phase 2 | Plot Graph | Foreshadowing and dependency graph |
| Phase 3 | Narrative Control | Pacing and narrative arc guidance |
| Phase 4 | Multi-dimensional QC | Consistency, pacing, goal checks |
| Phase 5 | Semantic Cache | Context reuse and optimization |
| Phase 6 | Timeline Tracking | Event deduplication and chronology |
- Task persistence in
generation_tasks - Global active task endpoint:
/api/active-tasks - Project active task endpoint:
/api/projects/:projectRef/active-task - Preferred cancel endpoint:
/api/tasks/:id/cancel - Web: SSE-based synchronization
- App: polling synchronization with lower frequency
novel-copilot/
├── src/ # Cloudflare Worker backend
│ ├── worker.ts # app entry and route mounting
│ ├── middleware/
│ │ └── authMiddleware.ts # JWT auth + optional auth
│ ├── routes/
│ │ ├── auth.ts # login/register/google auth
│ │ ├── projects.ts # project/chapter CRUD + download
│ │ ├── generation.ts # outline/chapter generation (SSE + task)
│ │ ├── tasks.ts # active-task/cancel/pause/delete
│ │ ├── editing.ts # chapter editing related APIs
│ │ ├── characters.ts # relationship graph APIs
│ │ ├── context.ts # context engineering APIs
│ │ ├── anime.ts # anime pipeline APIs
│ │ ├── admin.ts # admin model feature controls
│ │ ├── credit.ts # credit APIs
│ │ └── config.ts # runtime configs
│ ├── services/
│ │ ├── aiClient.ts # provider abstraction
│ │ ├── configManager.ts # dynamic model config
│ │ ├── creditService.ts # credit consume logic
│ │ ├── imageGen.ts # image generation
│ │ ├── veoClient.ts # video generation
│ │ └── voiceService.ts # TTS
│ ├── context/
│ │ ├── characterStateManager.ts
│ │ ├── plotManager.ts
│ │ ├── semanticCache.ts
│ │ └── timelineManager.ts
│ ├── narrative/
│ │ └── pacingController.ts
│ ├── qc/
│ │ ├── multiDimensionalQC.ts
│ │ ├── characterConsistencyCheck.ts
│ │ ├── pacingCheck.ts
│ │ ├── goalCheck.ts
│ │ └── repairLoop.ts
│ ├── db/
│ │ ├── schema.sql
│ │ └── anime-schema.sql
│ └── worker.ts
├── web/ # React Web app
│ ├── src/components/
│ │ ├── layout/ # header/sidebar/activity panel
│ │ ├── views/ # dashboard/outline/generate/chapters/...
│ │ └── ui/ # shared UI primitives
│ ├── src/contexts/ # auth/project/generation/server-events
│ ├── src/pages/ # route pages
│ └── src/layouts/ # project layout
├── mobile/ # Expo React Native app
│ ├── src/navigation/ # root stack + tabs + project stack
│ ├── src/screens/ # auth/projects/activity/anime/settings/admin
│ ├── src/contexts/ # auth + app config
│ ├── src/hooks/ # active task polling
│ ├── src/lib/ # API client + storage + constants
│ └── src/types/ # domain/navigation types
├── migrations/ # D1 migrations
├── scripts/
│ ├── ios-package.sh # local iOS packaging script
│ └── android-enable-abi-splits.sh # ABI split patch for Android CI build
├── docs/
│ ├── mobile-ci.md # CI packaging docs
│ └── images/ # README screenshots
├── .github/workflows/
│ └── build-mobile-packages.yml # mobile build + release publishing
├── package.json
├── wrangler.toml
└── README.zh.md
- Web routes now use
projectIdby default:/project/:projectId/dashboard/project/:projectId/outline/project/:projectId/generate/project/:projectId/chapters
- Mobile navigation uses
projectIdin route params. - Backend
projectRefsupports bothidandnamefor backward compatibility, but new clients should always sendid.
- Node.js 22+
- pnpm 9+
- Cloudflare account (for deployment)
pnpm install
pnpm -C web install
pnpm -C mobile installpnpm db:migrate:localpnpm devBackend runs at http://localhost:8787.
pnpm -C web devWeb runs at http://localhost:5173.
pnpm dev:mobile# type check
pnpm typecheck
pnpm mobile:typecheck
# web build
pnpm build:web
# db migration
pnpm db:migrate:local
pnpm db:migrate:remote
# deploy worker + web assets
pnpm deploy
# local iOS package
pnpm mobile:ios:package
pnpm mobile:ios:package:installWorkflow: .github/workflows/build-mobile-packages.yml
Build outputs (artifact names):
NovelCopilot-android-universal-apkNovelCopilot-android-arm64-apkNovelCopilot-ios-ipa
Released asset file names:
NovelCopilot-android-universal.apkNovelCopilot-android-arm64-v8a.apkNovelCopilot-ios.ipa
The workflow also auto-publishes to a rolling GitHub pre-release:
- Tag:
mobile-builds - Release name:
NovelCopilot Mobile Builds
Required repository secrets:
IOS_CERT_BASE64IOS_CERT_PASSWORDIOS_PROVISION_PROFILE_BASE64IOS_TEAM_IDIOS_KEYCHAIN_PASSWORD
Optional:
IOS_BUNDLE_IDIOS_EXPORT_METHODIOS_CODE_SIGN_IDENTITY
More details: ./docs/mobile-ci.md
# create D1
npx wrangler d1 create novel-copilot-db
# optional: create R2 for anime/video
npx wrangler r2 bucket create novel-copilot-videos
# initialize schema
pnpm db:init
# deploy
pnpm deploy| Table | Description |
|---|---|
projects |
project metadata and bible |
states |
next chapter index, rolling summary, open loops |
chapters |
chapter content |
outlines |
outline JSON |
characters |
relationship graph data |
generation_tasks |
background generation tasks |
chapter_qc |
QC results |
users |
auth users and permissions |
MIT



