Overview
SnackBase is designed to be extensible at multiple levels, allowing you to add custom functionality without modifying core code.Extension Philosophy
What Can Be Extended?
Extension Methods
1. Hooks (Recommended)
Best for: Business logic, event-driven automation, integrations- Stable API (v1.0 contract)
- Automatic event triggering
- Account isolation built-in
- No core modifications
- Limited to defined events
- Can’t add new API endpoints
2. Custom API Endpoints
Best for: New features, external integrations, custom operations- Full control over endpoint
- Can access all SnackBase services
- Leverage existing authentication
- Must manually handle permissions
- Requires more code
3. Custom Database Tables
Best for: Domain-specific data, complex relationships- Full SQL control
- Complex relationships
- Migrations versioned
- Requires manual migrations
- Not auto-integrated with collections
4. Middleware
Best for: Request/response processing, logging, custom auth- Runs on every request
- Can modify requests/responses
- Good for cross-cutting concerns
- Adds latency to all requests
- Must be carefully designed
5. Custom Services
Best for: Reusable business logic, external integrations- Encapsulates logic
- Reusable across endpoints
- Testable in isolation
- More initial code