Compact guidance for AI agents. Also see CLAUDE.md for fuller context.
make dev-server # Go backend on :8904 (kills existing process first)
make dev-web # Vite dev server on :3000, proxies /api -> :8904
make build # Frontend + Go binary -> release/<VERSION>/notepad
make cross-compile # linux/amd64, linux/arm64, darwin/amd64, darwin/arm64
make clean # Remove build artifactsNo tests. No linter. No typecheck. No CI. Skip all verification steps.
- Two-package monorepo:
server/(Go,go.modroot) andweb/(Vue,package.jsonroot). They are independent — no workspace tooling links them. - Frontend embeds into Go:
make buildrunsnpm ci && npm run buildinweb/, copiesweb/distintoserver/static/dist/, then builds the Go binary. The binary embedsserver/static/dist/via//go:embedinserver/static/embed.go. - SQLite is pure Go (
modernc.org/sqlite):CGO_ENABLED=0everywhere. Never enable CGO. - Single DB connection:
DB.SetMaxOpenConns(1)inserver/database/database.go. Concurrent writes will queue. - No ORM: all raw SQL.
database.DBis the global*sql.DB.
Custom upgrade system in server/database/upgrade.go, not a standard migration tool.
- Add new upgrades by appending to the
upgradesslice:{"X.Y.Z", upgrade_fn} - Version must match the
VERSIONfile (withoutvprefix) - Upgrade function receives
*sql.Tx— all statements in one transaction nilfn = version-only record (no schema change)- Anti-downgrade: DB version > binary version = fatal error at startup
- First registered user auto-becomes admin (role column, not a separate table)
- JWT via
Authorization: Bearerheader ortokencookie - SPA fallback: all non-
/apiroutes serveindex.html - Frontend routes:
/login,/register,/forgot-passwordare public; everything else requires auth;/admin/*requires admin role
| Var | Default | Notes |
|---|---|---|
| PORT | 8904 | Server port |
| DB_PATH | ./data/notepad.db | SQLite path |
| JWT_SECRET | random per start | Set a fixed value for persistence |
| DATA_DIR | ./data | Data directory |
Version, build time, and git commit injected via ldflags at build time:
-X main.Version=... -X main.BuildTime=... -X main.GitCommit=...
Source of truth for version: VERSION file at repo root.
./notepad find-admin # Show admin username
./notepad recover-admin # Reset admin password
./notepad list-users # List all usersThese dispatch from server/main.go when the first arg doesn't start with -.
- Location: All skills are stored in the
.skills/directory at the project root. - Usage: Reference skills by their path relative to the project root (e.g.,
.skills/skill-name.md). - Organization: Keep skill files organized and up-to-date. Remove obsolete skills.
- Docker:
Dockerfilemulti-stage build, data volume at/app/data, healthcheck at/api/health - Feiniu NAS (飞牛): FPK package built by
make fpk→scripts/build-fnpack.sh - Direct binary: just run
./notepad, data in./data/