You need a target for published content — usually a Git repository for your site (for example an Astro blog reading src/content/blog), or a WordPress/Ghost site for API publishing.
Fast path: copy a recipe from quickstart-recipes.md (Astro+GitHub, Hugo+GitLab, WordPress, Cloudinary, deploy hooks, …).
git clone https://github.com/bnz183/SourceDraft.git
cd SourceDraft
pnpm installRecommended — setup wizard
pnpm setupThe wizard asks which adapter, publisher, and media provider you use, then creates sourcedraft.config.json and .env with plain-language prompts. Existing .env values are kept unless you choose to overwrite them. See setup-wizard.md.
Manual — copy example files
cp sourcedraft.config.example.json sourcedraft.config.json
cp .env.example .envEdit paths, adapter, and categories to match your site. These values are safe to commit.
Pick an adapter for your stack (astro-mdx, nextjs-mdx, hugo-markdown, …). See the adapters compatibility matrix.
Set publisher to github, gitlab, bitbucket, wordpress, or ghost. See publishers.md.
Validate anytime:
pnpm validate:configIf you used pnpm setup, skip copying .env — the wizard already wrote it. Otherwise:
SOURCEDRAFT_ADMIN_PASSWORD=your-local-studio-password
# Optional: force demo mode (no GitHub commits)
# SOURCEDRAFT_DEMO_MODE=true
GITHUB_TOKEN=ghp_...
GITHUB_OWNER=your-username-or-org
GITHUB_REPO=your-site-repo
GITHUB_BRANCH=main| File | Holds |
|---|---|
sourcedraft.config.json |
contentDir, mediaDir, publicMediaPath, categories, adapter, publisher |
.env |
Password, publisher credentials, optional CMS_MEDIA_PROVIDER, deploy hook |
See configuration.md for the full split.
Create a token with permission to read and write contents in the target repository. SourceDraft uses it on the server when you publish posts, list/edit files, or upload images — not in the browser.
pnpm devStarts the editor and publish API (default API port 8787). Use this command, not dev:web alone, or publish and uploads will fail.
Sign in with SOURCEDRAFT_ADMIN_PASSWORD — this is the local Studio password, not your GitHub login.
On first visit, the sign-in screen shows five starting paths. Try demo mode if you are unsure; it needs no GitHub or API tokens.
MVP password auth is intended for local/private use. Do not expose Studio on the public internet without extra hardening.
Use demo mode to explore Studio before connecting a repository:
- Environment flag: set
SOURCEDRAFT_DEMO_MODE=truein.envand restart the API, or - Opt-in: leave
GITHUB_TOKEN,GITHUB_OWNER, andGITHUB_REPOunset and click Try demo mode on the sign-in screen.
Demo mode lets you explore SourceDraft without connecting a real blog. It provides sample articles from repository fixtures, local editing, simulated media upload paths, and simulated publish success. No real posts are published; sample content resets when the API restarts. See demo-mode.md.
Demo mode never sends your GitHub token to the browser and never commits to GitHub, even if credentials are present while SOURCEDRAFT_DEMO_MODE=true.
Open Settings in Studio. The Publishing readiness section explains in plain language whether SourceDraft can send articles to your blog — Studio password, blog connection, article folder, blog type, and demo mode status. Credentials are checked on the server and never shown in the browser. It suggests a next action when setup is incomplete. Advanced technical details are under Show advanced details.
The publish API also exposes GET /api/health/setup (authenticated) with the same safe diagnostics.
- Articles sidebar — open an existing article, or click New article
- Fill title and description in the center canvas; set slug, dates, category, and tags in Article details; upload a cover image if needed (media.md)
- Check the preview to see the generated article file before sending
- Send to your blog — or simulate sending in demo mode
SourceDraft validates, renders with your adapter, and sends to the configured publisher (git commit or remote CMS API).
Git publishers: git-publishers.md · GitHub: github-publishing.md · WordPress: wordpress.md · Ghost: ghost.md
Browser smoke tests run against demo mode — no live GitHub credentials required:
pnpm exec playwright install chromium # first time only
pnpm test:e2eFrom apps/studio, use the same commands. CI runs pnpm test:e2e after build and unit tests on every push/PR to main.
These tests cover sign-in/demo entry, post list, editor, toolbar, autosave status, media library, content quality, setup health, and simulated publish.
Regenerate README screenshots (writes to docs/assets/):
pnpm screenshots:generateUnit tests (default):
pnpm testOpen your site repo on GitHub and confirm the new file (and any uploaded images in mediaDir). Run your usual site build or wait for CI.
examples/astro-blog shows expected folders and a sample MDX file. It is an integration reference, not a complete Astro app.
| Problem | Likely cause |
|---|---|
| Cannot sign in | SOURCEDRAFT_ADMIN_PASSWORD missing; restart API after editing .env |
| Publish API unreachable | Run pnpm dev, not UI-only |
| GitHub 401 / 403 | Token scope or wrong owner/repo |
| Wrong file path | contentDir in config |
| Upload rejected | File type or 5 MB limit; see media.md |
| Empty post list | Wrong repo in .env or no .md/.mdx in contentDir |
| Demo only | GitHub not configured or SOURCEDRAFT_DEMO_MODE=true — expected; configure GitHub for real publish |
Plain-language intro: non-technical-overview.md