graph TD
A[Start] --> B{Need Cloud Storage?}
B -->|No| C[Use Local Storage]
B -->|Yes| D{Project Type?}
D -->|MVP| E{Data Complexity?}
D -->|Enterprise| F{Need Full Control?}
E -->|Simple| G{Platform Support?}
E -->|Complex/Relational| H{Load Pattern?}
G -->|Apple Only| I[CloudKit]
G -->|Cross Platform| J[Firebase]
H -->|Constant| K[Container-based PaaS]
H -->|Sporadic| L[AWS Lambda]
F -->|Yes| M[Virtual Machine Service]
F -->|No| K
subgraph Note
Z[Services marked with arrows can run Swift code]
end
Z -.-> K
Z -.-> L
Z -.-> M
Consider local storage first if:
- Data is private/sensitive
- You're using third-party APIs (YouTube, etc.)
- You only need local device storage with Core Data
- Data backup can be handled through manual file exports
Best for:
- Private/sensitive data
- Offline-first applications
- Simple data structures
- Individual device usage
Best for:
- Apple-only ecosystem
- Native iOS development
- Push notification requirements
- Client app transfers
- Simple data structures
Best for:
- Cross-platform development
- Real-time database needs
- Simple query requirements
- Quick MVP development
- Limited backend maintenance
Best for:
- Sporadic workloads
- Pay-per-use pricing
- Event-driven processing
- Swift serverless (only platform supporting Swift natively)
- APIs with intermittent traffic
Best for:
- Constant workloads
- Relational databases
- Traditional web applications
- Better cloud provider portability
- Fixed monthly costs
Popular Options:
Best for:
- Maximum control
- Custom infrastructure requirements
- Complex networking needs
- Specific compliance requirements
- Legacy system support
Popular Options:
Swift can be used as a server-side language in multiple deployment scenarios:
- Vapor
- Hummingbird
- SwiftNIO (for building custom frameworks)
- Virtual Machine Services (run Swift directly on Linux)
- Container-based PaaS (using Docker containers)
- AWS Lambda supports Swift
- Heroku (supports Swift buildpacks)
Simple Data Needs:
- Key-value storage
- Document storage
- Basic CRUD operations
- No complex relationships
Complex Data Needs:
- Relational data
- Complex queries
- Transaction requirements
- Data consistency requirements
- PostgreSQL - Popular open-source relational database
- MySQL - Open-source relational database
- MongoDB - Document-based NoSQL database
- Redis - In-memory data structure store
- Amazon DynamoDB - NoSQL key-value database
- Amazon Aurora - Cloud-native relational database
Sporadic:
- Irregular usage
- Long idle periods
- Burst traffic
- Development/testing
Constant:
- Steady traffic
- Predictable load
- 24/7 operation
- Regular usage patterns
- Consider infrastructure as code from the start
- Plan for monitoring and logging
- Consider backup and disaster recovery
- Think about scaling strategy
- Plan for security from the beginning
- Serverless: Pay per use, good for variable loads
- Containers: Fixed costs, better for constant loads
- VMs: Most control, highest maintenance overhead
- Factor in developer time and expertise
- Consider future scaling costs