Hi all,
I've developed a new Swift Package, called
Breeze, to deploy a Swift Serverless REST API on AWS using APIGateway, Lambda and DynamoDB. I hope that Breeze can improve the development experience in the Serverless field.
Why Serverless?
Assuming developers know Swift, the amount of knowledge required to put all the AWS's jigsaw pieces together is the primary challenge for Server Side Swift.
I come from an iOS development perspective; I'm interested in having a backend solution for iOS Apps that I can deploy with minimum costs in terms of money, effort and time.
My daily goal is to focus on iOS Apps, not on the backend, and I want a solution scalable from day one.
My idea is that I want to code in Swift, but I don't have time to invest in learning other languages or in server management.
For me, Serverless is the answer to these requirements.
Serverless challenges
The issue is that the learning curve is high.
There are many challenges to overcome:
- Most of the examples in Swift are just adding some BL logic in Lambda, but they don't consume any AWS service using Soto.
- Most developers have no experience using Swift on Linux and tend to add MacOS frameworks to their code. Swift NIO is hard to learn
- It's not easy setting up the coding and the building environment.
- There is a lack of real-world deployment examples with different frameworks: Serverless, SAM, and Terraform.
- The deployment needs to adapt to the company's backend practice. Flexibility and diversity must be encouraged to reach all the most common cases. Not focusing only on one peculiar vendor tool such as SAM, Amplify or CDK, but having plenty of possibilities.
Breeze
With Breeze, I released a template generator to help the Swift community to get into Serverless more quickly. The template includes the Lambda's code and the code required to deploy the solution on AWS.
The tool includes the following components:
Command Line
- Breeze command line: generates the folder with the swift package with Lambda's business logic, the deployment using the Serverless framework and some scripting.
API implementation
- BreezeLambdaAPI: The Swift Lambda that translates the APIGatewayV2 events to operations on the BreezeDynamoDBService.
- BreezeDynamoDBService: A service to interact with Soto DynamoDB
A config file customizes the Serverless app, it's possible to enable the JWT Token authorization for the API (for example the Sing in with Apple).
Once the command line generates the project template, the developer can modify the code to adapt it before the deployment.
Ideally, I'd like to support common mobile use cases like file uploading, custom lambda authorizers, simple lambdas, and push notifications.
Breeze supports the Serverless Framework, but in the future would be nice to decide on the deployment tool at generation time.
Happy to get feedback, suggestions and contributions.