5.8 KiB
5.8 KiB
Auth Folder Documentation Index
All enforcement rules, patterns, and guidance for Job Info
📚 Documentation Files
For First-Time Setup & Questions
- ONBOARDING.md ← START HERE
- Quick start (5 minutes)
- Project structure overview
- Common tasks
- Debugging tips
- FAQ
Core Rules & Patterns
- RULES.md ← READ THIS FIRST
- Authentication rules (single token)
- Caching strategy (Redis/Valkey)
- Data filtering & transformation
- State management
- API response formats
- Naming conventions
- Testing rules
- Error handling
- Logging rules
Application Design
-
- High-level user journey
- Data flow diagram
- Cache flow
- State management flow
- Authentication flow
- View hierarchy
-
- View architecture
- AuthView (Sign In)
- LandingView (Jobs List)
- ManagerInfoView (Job Detail)
- NotesView (Expanded Notes)
- FilePreviewModal
- Component standards (buttons, cards, badges)
- Responsive design
- Accessibility standards
Technology Stack
- TECH_STACK.md
- Bun (runtime) -
latest - Hono (web framework) -
^4.10.8 - PostCSS -
^8.5.6 - Tailwind CSS -
^4.1.18 - TypeScript -
^5 - ioredis (cache client) -
^5.x - PocketBase SDK -
^0.26.5 - dotenv -
^17.2.3 - Installation, configuration, and usage patterns
- Bun (runtime) -
Auth Implementation
- auth-universal.js
- Single PocketBase authentication
- Token storage & retrieval
- Sign out logic
🚀 Quick Navigation by Task
"I'm new, where do I start?"
- Read ONBOARDING.md
- Set up dev environment (5 min)
- Read RULES.md (30 min)
"I need to add a new API endpoint"
- Check RULES.md - Cache Strategy
- Check TECH_STACK.md - Hono Patterns
- Follow ONBOARDING.md - Adding New Endpoint
"I need to create a new view/page"
- Check VIEWS.md - View Architecture
- Check FLOWMAP.md - User Flow
- Follow ONBOARDING.md - Adding New View
"I need to understand how data flows"
- Read FLOWMAP.md - Data Flow Diagram
- Check RULES.md - Caching Strategy
- Review TECH_STACK.md - ioredis Usage
"I'm stuck or debugging an error"
- Check ONBOARDING.md - Debugging section
- Review RULES.md - Error Handling
- Search logs in
logs/folder
"I need to modify auth behavior"
- Review auth-universal.js
- Check RULES.md - Authentication & Token Rules
- Test in ONBOARDING.md - Testing section
📋 Rules Checklist
Before committing, ensure:
Code Quality
- All functions have TypeScript types
- No
anytype annotations (except justifiable cases) - All errors are caught and logged
- Follows RULES.md naming conventions
Authentication
- Uses single PocketBase token (no Graph tokens)
- Token obtained at login, reused everywhere
- No repeated reauthentication
- Sign out clears all state
Caching (Backend)
- GET requests cached
- Cache key follows
noun:filter:valueformat - TTL appropriate (5-30 minutes)
- Cache invalidation on mutations
- Cache hit/miss logged
Frontend
- Uses Tailwind for all styling (no inline styles)
- No hardcoded secrets
- State changes go through designated functions
- File filtering correct (PDF, Word, Image only)
- Files categorized correctly
Testing
- Tests mock external APIs
- Core logic tested
- No test dependencies on Redis/PocketBase
Documentation
- New endpoints documented in API.md
- New data patterns documented in RULES.md
- New views documented in VIEWS.md
- Code comments explain "why", not "what"
🔄 When to Update Documentation
| Change | Update |
|---|---|
| New API endpoint | API.md |
| New data pattern | RULES.md |
| New view/page | VIEWS.md |
| Modify cache strategy | RULES.md |
| Modify auth flow | RULES.md, FLOWMAP.md |
| Modify tech stack | TECH_STACK.md |
| Update development process | ONBOARDING.md |
📞 Getting Help
- Check documentation - 80% of questions answered here
- Search codebase - Find similar patterns
- Check logs - logs/server.log and logs/error.log
- Ask team - Include: problem, code, expected behavior
Key Principles
| Principle | Why | What to Do |
|---|---|---|
| Single Source of Truth | Avoid confusion | One auth module, one state object |
| Explicit Over Implicit | Readability | Type all functions, name clearly |
| Fail Fast | Debugging | Validate input, log errors immediately |
| Reuse Over Reinvent | Maintainability | Follow existing patterns |
| Cache Wisely | Performance | Cache GET, not mutations; use TTL |
| Document Decisions | Onboarding | Explain "why" in code comments |
File Organization
auth/
├── README.md (This folder's purpose)
├── RULES.md (Data handling rules)
├── FLOWMAP.md (Application flows)
├── VIEWS.md (UI/View patterns)
├── TECH_STACK.md (Technology versions & usage)
├── ONBOARDING.md (Getting started & common tasks)
├── INDEX.md (This file - navigation guide)
└── auth-universal.js (Authentication implementation)
Version History
| Version | Date | Changes |
|---|---|---|
| 1.0 | Jan 2026 | Initial comprehensive documentation |
Last Updated: January 2026
Status: Production Ready
Maintained By: Development Team