lastsaas
CLAUDE.md172 starsChanged 9 months agoMITView on GitHub
LastSaaS uses hybrid validation: Go-side (validate struct tags via go-playground/validator) and MongoDB JSON Schema (internal/db/schema.go). When modifying model structs in internal/models/: 1. Update validate struct tags on the model 2. Update the corresponding MongoDB JSON Schema in internal/db/schema.go 3. Keep both in sync — the Go tags and MongoDB schema must enforce the same constraints 4. Run cd backend && go test ./internal/validation/... to verify When adding a new collection that accepts user/API writes: 1. Add validate tags to the…
The file
We split this CLAUDE.md into the rules it gives an agent
11 rules. About 0 are common, 4 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Update validate struct tags on the model
- Very specific: line 9
Update the corresponding MongoDB JSON Schema in internal/db/schema.go
- Distinctive: line 10
Keep both in sync — the Go tags and MongoDB schema must enforce the same constraints
- Very specific: line 11
Run cd backend && go test ./internal/validation/...
- Very specific: line 14
Add validate tags to the model struct
- Very specific: line 15
Add a schema function to internal/db/schema.go and include it in AllSchemas()
- Very specific: line 16
Add tests in internal/validation/validate_test.go
- Very specific: line 20
Use syslog.Logger for all significant system events.
- Distinctive: line 24
Always verify after changes:
- Distinctive: line 41
Propagation rule: When setting up or working on any dependent project, ensure:
- Distinctive: line 44
If the project doesn't have these yet, create them before the first deployment
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
LastSaaS Development Rules
Validation
LastSaaS uses hybrid validation: Go-side (validate struct tags via go-playground/validator) and MongoDB JSON Schema (internal/db/schema.go).
When modifying model structs in internal/models/:
- Update
validatestruct tags on the model - Update the corresponding MongoDB JSON Schema in
internal/db/schema.go - Keep both in sync — the Go tags and MongoDB schema must enforce the same constraints
- Run
cd backend && go test ./internal/validation/...to verify
When adding a new collection that accepts user/API writes:
- Add
validatetags to the model struct - Add a schema function to
internal/db/schema.goand include it inAllSchemas() - Add tests in
internal/validation/validate_test.go
System Logging
Use syslog.Logger for all significant system events. Severity levels: critical, high, medium, low, debug.
Build Verification
Always verify after changes:
cd backend && go build ./...
cd frontend && npx tsc --noEmitDependent Project Deployment (CRITICAL)
Any project built on the LastSaaS boilerplate — whether using it as a Git submodule, fork, or copy — MUST deploy using the SaaS Dockerfile (Dockerfile.saas) and the corresponding Fly config (fly.saas.toml). Never use bare fly deploy on a project that depends on LastSaaS.
Why this matters: The SaaS Dockerfile runs both the product backend AND the LastSaaS backend behind Caddy (via supervisord). The LastSaaS backend serves all auth endpoints (/api/auth/*), bootstrap status (/api/bootstrap/status), OAuth providers (Google, etc.), billing, and admin APIs. Without it, login breaks silently — the product backend has no auth routes, so API calls return HTML from the SPA catch-all, causing mysterious redirects to /setup or broken login forms with missing OAuth buttons.
Correct deploy command:
fly deploy -c fly.saas.tomlPropagation rule: When setting up or working on any dependent project, ensure:
- The project has a
deploy.mdat its root with full deployment instructions and the "why" behind the multi-process architecture - The project's Claude Code memory (MEMORY.md or CLAUDE.md) contains a cross-reference: "See
deploy.md— never barefly deploy" - If the project doesn't have these yet, create them before the first deployment
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

