{"id":17983520,"url":"https://github.com/techjacker/python-serverless-api","last_synced_at":"2025-07-30T23:33:02.233Z","repository":{"id":43310529,"uuid":"129121577","full_name":"techjacker/python-serverless-api","owner":"techjacker","description":"Boilerplate flask app that is portable between different serverless platforms (AWS, Azure, GCP).","archived":false,"fork":false,"pushed_at":"2023-02-15T21:32:37.000Z","size":36,"stargazers_count":25,"open_issues_count":7,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-06T09:52:14.190Z","etag":null,"topics":["aws-lambda","azure-functions","flask","google-functions","python","serverless"],"latest_commit_sha":null,"homepage":"https://andrewgriffithsonline.com/blog/180412-deploy-flask-api-any-serverless-cloud-platform","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/techjacker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-11T16:18:48.000Z","updated_at":"2023-06-08T05:24:37.000Z","dependencies_parsed_at":"2024-10-29T18:48:22.636Z","dependency_job_id":null,"html_url":"https://github.com/techjacker/python-serverless-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/techjacker/python-serverless-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techjacker%2Fpython-serverless-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techjacker%2Fpython-serverless-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techjacker%2Fpython-serverless-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techjacker%2Fpython-serverless-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/techjacker","download_url":"https://codeload.github.com/techjacker/python-serverless-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/techjacker%2Fpython-serverless-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267960688,"owners_count":24172506,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-lambda","azure-functions","flask","google-functions","python","serverless"],"created_at":"2024-10-29T18:17:34.630Z","updated_at":"2025-07-30T23:33:02.187Z","avatar_url":"https://github.com/techjacker.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python Serverless API\n\nBoilerplate Flask app that is portable between different serverless platforms.\n\n-----------------------------------------------------------\n## Platforms\n\nDeployment and application code adaptors are being added for the following:\n\n\u003cbr /\u003e\n\n| Platform       \t\t\t\t| Deployment\t\t\t\t| Status\t\t\t\t\t\t |\n|--------------------------|-----------------------|:----------------------:|\n| AWS Lambda\t\t\t\t\t| AWS SAM \t\t\t\t\t| :heavy_check_mark:\t\t |\n| AWS Lambda\t\t\t\t\t| Terraform \t\t\t\t| :heavy_check_mark: \t |\n| Azure Functions\t\t\t\t| Terraform \t\t\t\t| \t\t\t\t\t \t\t\t |\n| Google Cloud Functions\t| Terraform \t\t\t\t| \t\t\t\t\t \t\t\t |\n| Google Kubernetes Engine\t| `gcloud` \u0026 `kubectl`  | \t\t\t \t\t\t\t\t |\n\n\n| Platform       \t\t\t\t| Adaptor\t\t\t\t\t| Code/Config\t\t\t\t |\n|--------------------------|-----------------------|:----------------------:|\n| Local Development\t\t\t| None\t\t\t\t \t\t| [:floppy_disk:](run.py)\t \t \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t|\n| AWS Lambda Python \u003e= 3.6\t| [Flask-Lambda-Python36](https://github.com/techjacker/flask-lambda) | [:floppy_disk:](run_lambda.py)|\n| AWS Lambda Python \u003c= 3.6\t| [Flask-Lambda](https://github.com/sivel/flask-lambda) | [:floppy_disk:](run_lambda.py) \t \t\t\t\t|\n| Azure Functions\t\t\t\t| \t\t\t\t \t\t\t\t| \t\t\t\t\t \t\t\t |\n| Google Cloud Functions\t| \t\t\t\t \t\t\t\t| \t\t\t\t\t \t\t\t |\n\n-----------------------------------------------------------\n## Setup\n\n\n#### 1. Create `.env` file and update contents\nThis is used to set the environment variables required for deployment and local development.\n```\n$ cp .env.example .env\n$ vim .env\n```\n\n#### 2. Create a virtualenv then install requirements:\n```\n$ make env\n$ source env/bin/activate\n$ make deps\n```\n\n-----------------------------------------------------------\n## Example Usage\n\n#### 1. Set Environment\nEnsure you have created your virtualenv and have the necessary environment variables set (see [setup instructions](#setup) above).\n```\n$ source env/bin/activate\n$ source .env\n```\n\n#### 2. Run server\n\n##### On host\n```\n$ make server-debug\n```\n\n##### In docker\n```\n$ docker-compose up\n```\n\n#### 3. Manually test development server\n```\n$ http-prompt localhost:5000\nGET /artists\n```\n\n\n-----------------------------------------------------------\n## AWS Lambda\n\n### Terraform Deployment\nEnsure you have created your virtualenv and have the necessary environment variables set (see [setup instructions](#setup) above).\n\n##### Setup\nCreate terraform state bucket.\n```\n$ aws s3 mb --region eu-west-2 s3://\u003cbucket_name\u003e\n```\n\nUpdate bucket name in `/terraform/main.tf`.\n```\nterraform {\n  backend \"s3\" {\n    bucket = \"\u003cbucket_name\u003e\"\n    key    = \"terraform.tfstate\"\n    region = \"eu-west-2\"\n  }\n}\n```\n\n#### Deploy\nBundle the app into a zip and deploy it using terraform.\n```\n$ ./bin/deploy\n```\n\n#### Manually Test API\n```\n$ http-prompt $(cd terraform \u0026\u0026 terraform output api_url)\nGET artists\n```\n\n### [AWS Serverless Application Model (SAM)](https://aws.amazon.com/about-aws/whats-new/2016/11/introducing-the-aws-serverless-application-model/) Deployment\n\nUnlike Terraform SAM doesn't upload the zip bundle so do this using the `aws-cli` tool.\n```Shell\n$ aws s3 mb s3://\u003cmybucket\u003e\n$ aws s3 cp terraform/dist/python-serverless-api.zip s3://\u003cmybucket\u003e/python-serverless-api.zip\n```\n\nUpdate the S3 bucket value in the SAM config.\n```YAML\n# template.yaml\nAWSTemplateFormatVersion: '2010-09-09'\nTransform: 'AWS::Serverless-2016-10-31'\nDescription: 'Boilerplate Python 3.6 Flask App.'\nResources:\n  FlaskAPI:\n    Type: 'AWS::Serverless::Function'\n    Properties:\n      CodeUri: s3://\u003cmybucket\u003e/flask-app.zip\n```\n\nDeploy the SAM template with Cloudformation.\n```Shell\n$ aws cloudformation deploy \\\n\t\t--template-file template.yaml \\\n\t\t--stack-name python-serverless-stack-sam\n\t\t--capabilities CAPABILITY_IAM\n```\n\n\n-----------------------------------------------------------\n## Test\n```\n$ make test\n$ make lint\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechjacker%2Fpython-serverless-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftechjacker%2Fpython-serverless-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftechjacker%2Fpython-serverless-api/lists"}