Scripthing is a professional-grade, local-first, web-based screenplay writing application. It offers industry-standard formatting, distraction-free writing, and optional AI-assisted writing that keeps you in control of your data.
- Industry-Standard Formatting: Automatic formatting for Scene Headings, Action, Character, Dialogue, Parentheticals, and Transitions.
- Local-First Architecture: Your data stays on your machine. We use SQLite for backend persistence and debounced auto-save.
- AI-Optional Power: Connect your own OpenAI, Anthropic, Gemini, or Ollama (offline) keys for chat, suggestions, and rewrites.
- Professional Exports: Export your scripts to pixel-perfect PDF (via Puppeteer) or Final Draft .fdx format.
- Robust Security: AES-256-GCM encryption for your API keys and automated database backups.
- Dark Mode Support: Write day or night with a sleek, responsive UI built with shadcn/ui and TailwindCSS.
- Self-Hostable: Easily deploy to any VPS using Docker Compose.
- Frontend: React 18.x, TypeScript, Vite, Tiptap (ProseMirror), Zustand, TanStack Query, TailwindCSS.
- Backend: Node.js 22.x LTS, Fastify, Prisma, SQLite (better-sqlite3), Zod, Pino.
- DevOps: Docker, GitHub Actions, Nginx.
- Node.js 22.x LTS
- pnpm 10.x (
npm install -g pnpm) - Docker & Docker Compose (optional, for self-hosting)
- Clone the repo:
git clone https://github.com/abengkris/scripthing.git && cd scripthing
- Install dependencies:
pnpm install
- Setup environment:
Edit
cp apps/backend/.env.example apps/backend/.env cp apps/frontend/.env.example apps/frontend/.env
apps/backend/.envand setAPP_SECRETto a random 32-character string. - Initialize database:
This creates a ready-to-use demo account:
pnpm --filter backend db:migrate pnpm --filter backend db:seed
- Email:
demo@scripthing.local - Password:
demo1234
- Email:
- Start development server:
Frontend: http://localhost:5173 | Backend: http://localhost:3001
pnpm run dev
| Variable | Description |
|---|---|
DATABASE_URL |
Prisma connection string for SQLite (e.g., file:./data/scripthing.db) |
APP_SECRET |
32-char secret for session tokens and key encryption. |
PORT |
Backend port (default 3001). |
FRONTEND_URL |
URL of the frontend (for CORS). |
AI_RATE_LIMIT_RPM |
Rate limit for AI requests per user (default 20). |
- Configure Compose: Edit
docker-compose.ymland set yourAPP_SECRET. - Build and Run:
docker compose up -d
- Nginx Configuration: For Production/VPS, use the provided
nginx.confbehind a reverse proxy like Nginx or Caddy. Note: To ensure the AI typing effect (Server-Sent Events) works instantly, you must disable Nginx buffering for the/api/v1/ai/location in your configuration (proxy_buffering off;).
The system includes a script at scripts/backup.sh that performs atomic SQLite backups.
- Cronjob Example: Run
0 0 * * * /opt/scripthing/scripts/backup.sh /opt/scripthing/apps/backend/data/scripthing.db /opt/scripthing/backups/to backup daily.
- Stop the application.
- Copy the backup
.dbfile over the currentscripthing.db. - Restart the application.
- API Key Decryption Error: If you change
APP_SECRET, you must provide the old secret asAPP_SECRET_PREVIOUSto enable graceful key rotation. - PDF Export Fails: Ensure Puppeteer dependencies are installed on the host or use the Docker environment which has them pre-configured.
Contributions are welcome! Please read AGENTS.md for our architectural guide and code conventions.
Distributed under the MIT License. See LICENSE for more information.