SeanStack Architecture
Understanding SeanStack's innovative hybrid architecture that combines the best of npm packages and copy-paste patterns for maximum flexibility and control.
The Three-Layer Architecture
Core Infrastructure Layer
npm packages for security-critical, stable functionality
What's Included:
- Authentication primitives
- Database utilities
- API clients
- Type definitions
Benefits:
- Security updates via npm
- Tested and hardened
- Version controlled
- Minimal API surface
Pattern Library Layer
Copy-paste patterns for UI components and features
What's Included:
- UI components
- Page templates
- Feature implementations
- Business logic patterns
Benefits:
- Full customization
- No version conflicts
- Own your code
- Instant modifications
AI Enhancement Layer
Metadata and tooling for AI-assisted development
What's Included:
- Pattern metadata
- Update intelligence
- Code generation hints
- Learning from usage
Benefits:
- Smart updates
- Cross-project learning
- Tool agnostic
- Progressive enhancement
Package vs Pattern Decision Matrix
How to decide what belongs in a package versus a pattern:
Criteria | Package | Pattern |
---|---|---|
Security Critical | ||
Needs Customization | ||
Stable API | ||
UI/UX Related | ||
Business Logic | ||
Infrastructure |
Monorepo Structure
SeanStack uses a monorepo architecture powered by Turborepo for efficient development:
Why Monorepo?
Benefits:
- • Shared code and configurations
- • Atomic commits across projects
- • Consistent tooling and standards
- • Simplified dependency management
Features:
- • Parallel builds with Turborepo
- • Smart caching for fast rebuilds
- • Workspace dependencies
- • Coordinated deployments
Security Architecture
Defense in Depth
Authentication Layer
Supabase Auth with JWT tokens, refresh rotation, and session management
Authorization Layer
Row Level Security (RLS) policies and role-based access control (RBAC)
API Security
Rate limiting, CORS configuration, and webhook signature validation
Data Protection
Encryption at rest, secure environment variables, and audit logging
Deployment Architecture
Edge Deployment
Deploy to Vercel's Edge Network for optimal performance:
- • Global CDN distribution
- • Automatic SSL certificates
- • Smart caching strategies
- • Zero-config deployments
Self-Hosted Options
Deploy to your own infrastructure:
- • Docker containers
- • Kubernetes ready
- • AWS/GCP/Azure support
- • On-premise deployment
Learn More
Dive deeper into specific aspects of the SeanStack architecture: