Production-ready MVP for managing project documentation stored only in private GitHub repositories.
- Next.js App Router + TypeScript
- Tailwind CSS + shadcn/ui + lucide-react
- NextAuth (GitHub OAuth)
- MongoDB + Mongoose
- Octokit (GitHub REST API)
- Monaco editor/diff
- Vitest (unit/smoke tests)
- GitHub-only authentication.
- Server-side allowlist enforcement.
- Projects dashboard.
- Admin project creation modes:
connectexisting private repo (fully implemented)createprivate repo (feature-flagged byENABLE_GITHUB_REPO_CREATE)
- File explorer with nested folders/files.
- Global custom right-click behavior (browser context menu disabled app-wide).
- File operations: create file/folder, rename/move, delete.
.md/.txtin-app editing and GitHub commit save.- Diff viewer for unsaved changes (Monaco diff).
.pdfin-app viewer via server proxy route..docxdownload fallback.- Audit logs for project/file actions.
- Basic API rate limiting middleware.
- Optional email notifications on commits/changes (Nodemailer + SMTP).
- Missing-repository handling with user confirmation before local cleanup.
- Install dependencies:
npm install- Copy env template:
cp .env.example .env.local- Fill required values in
.env.local. - Start dev server:
npm run dev- Open http://localhost:3000.
Use .env.example:
NEXTAUTH_URLNEXTAUTH_SECRETGITHUB_CLIENT_IDGITHUB_CLIENT_SECRETMONGODB_URIAPP_BASE_URLENABLE_GITHUB_REPO_CREATEGITHUB_REPO_CREATE_OWNERGITHUB_DEFAULT_BRANCHALLOWED_GITHUB_LOGINSAUDIT_LOG_RETENTION_DAYSRATE_LIMIT_WINDOW_MSRATE_LIMIT_MAX_REQUESTSGITHUB_TOKEN_SCOPE_HINTMAIL_NOTIFY_ENABLEDSMTP_HOSTSMTP_PORTSMTP_SECURESMTP_USERSMTP_PASSMAIL_FROM
When enabled, the app sends email notifications to project collaborators for commit-producing changes.
Events:
- file create/edit commit
- file delete commit
- rename/move actions
Each email includes:
- project name and repository
- who changed it
- commit message
- commit hash (when available)
- changed path
- timestamp
Enable with env:
MAIL_NOTIFY_ENABLED=true
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_SECURE=false
SMTP_USER=your-user
SMTP_PASS=your-pass
MAIL_FROM=DocVerCtl <no-reply@example.com>Set recipients per project in the create project form:
Collaborator emails for commit notifications (comma separated)
- GitHub -> Settings -> Developer settings -> OAuth Apps -> New OAuth App.
- Set Homepage URL:
- Local:
http://localhost:3000 - Prod: your deployed URL.
- Set Authorization callback URL:
- Local:
http://localhost:3000/api/auth/callback/github - Prod:
https://doc.searchngo.app/api/auth/callback/github
- Copy Client ID/Secret to env.
Bootstrap first admin:
npm run seed:admin -- --id <github_user_id> --login <github_login> --admin trueThen sign in with that account and manage allowlist in /admin/allowlist.
Set ALLOWED_GITHUB_LOGINS=login1,login2.
- Mode B (
connect) is complete and default. - Mode A (
create) requires:ENABLE_GITHUB_REPO_CREATE=true- token scopes/org permissions allowing repository creation.
GET /api/projectsPOST /api/projectsGET /api/projects/:id/tree?path=GET /api/projects/:id/file?path=POST /api/projects/:id/fileDELETE /api/projects/:id/file?path=POST /api/projects/:id/renameGET /api/user/meGET /api/github/repo-checkGET /api/admin/allowlistPOST /api/admin/allowlist
All routes enforce auth + allowlist on server.
Run:
npm testIncluded tests:
- allowlist gate logic (
tests/allowlist.test.ts) - zod validation (
tests/schemas.test.ts) - GitHub wrapper with mocked Octokit (
tests/github-client.test.ts)
- Push repository to GitHub.
- Import into Vercel.
- Add all env vars from
.env.example. - Update
NEXTAUTH_URLto production URL. - Update GitHub OAuth callback URL to production callback.
- Redeploy.
- Auth/session: NextAuth JWT strategy with
NEXTAUTH_SECRET. - Allowlist enforcement: server-side in NextAuth sign-in callback and all protected APIs.
- Token handling: GitHub access token is used server-side only for API calls.
- CSRF: NextAuth built-in CSRF protections for auth endpoints.
- Rate limiting: in-memory middleware over
/api/*(MVP baseline). - Audit trail: MongoDB
AuditLogcaptures project/file write actions. - Private file access: binary/PDF retrieval proxied by server route to avoid token exposure.
- Note: DevTools cannot be meaningfully blocked; security is enforced server-side.
- First admin should be inserted with
npm run seed:admincommand above. - After first login, admin can add more users and admin roles from
/admin/allowlist.