{"id":20114349,"url":"https://github.com/jetbridge/sls-flask","last_synced_at":"2025-05-06T12:30:59.292Z","repository":{"id":98607035,"uuid":"175660119","full_name":"jetbridge/sls-flask","owner":"jetbridge","description":"Opinionated Flask serverless starter kit","archived":false,"fork":false,"pushed_at":"2020-12-23T06:22:23.000Z","size":415,"stargazers_count":95,"open_issues_count":4,"forks_count":7,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-09T12:22:23.307Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jetbridge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-03-14T16:31:38.000Z","updated_at":"2024-05-18T22:22:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"3925c710-3f91-44a9-9289-129669f12e9e","html_url":"https://github.com/jetbridge/sls-flask","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jetbridge%2Fsls-flask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jetbridge%2Fsls-flask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jetbridge%2Fsls-flask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jetbridge%2Fsls-flask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jetbridge","download_url":"https://codeload.github.com/jetbridge/sls-flask/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252683436,"owners_count":21788041,"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","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":[],"created_at":"2024-11-13T18:29:27.307Z","updated_at":"2025-05-06T12:30:59.286Z","avatar_url":"https://github.com/jetbridge.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Opinionated Serverless Flask\n\nComes with a lot of useful stuff ready to go.\n\nDesigned for serverless API development with PostgreSQL.\n\n## Features\n\n- [Flask Smorest](https://pypi.org/project/flask-smorest/)\n  - OpenAPI\n  - Swagger UI\n  - Redoc\n- [Pytest using database subtransactions](https://pypi.org/project/pytest-flask-sqlalchemy/) for test isolation\n- [Pytest-FactoryBoy](https://pytest-factoryboy.readthedocs.io/en/latest/#model-fixture) for generating sample data for seeding DB and tests.\n- Flake8 for linting\n- [Mypy](http://mypy-lang.org/) for type-checking\n- [Black](https://black.readthedocs.io/en/stable/) for formatting\n- AWS Lambda integration\n  - [Serverless AWS](https://serverless.com/framework/docs/providers/aws/)\n  - [AWS Aurora Serverless Postgres](https://aws.amazon.com/rds/aurora/serverless/) for on-demand Postgresql DB with a [data-api query driver](https://github.com/chanzuckerberg/sqlalchemy-aurora-data-api#motivation) (optional).\n  - Load Flask config from AWS Secrets Manager\n- [Flask-Migrate](https://flask-migrate.readthedocs.io/en/latest/) for DB migrations with alembic and Flask CLI\n- [Poetry](https://python-poetry.org/docs/) for dependency management\n\n## Quickstart:\n\n### Prerequisites:\n\n```\ncurl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python  # poetry\nnpm i -g serverless\n```\n\n### Create Project:\n\n```\nnpx sls install --url https://github.com/jetbridge/sls-flask --name myapp\ncd myapp\nmake init  # install dependencies and initialize project, database\n```\n\n## Useful Commands:\n\n### Python Virtual Environment:\n\n```\npoetry shell  # activate python virtual environment\npoetry install  # install dependencies\n```\n\n### Run Dev Server:\n\n```\nflask  # CLI commands\nmake run  # run flask dev server\nsls wsgi serve  # run flask dev server under serverless\n```\n\n\n### Database:\nUsing Postgresql.\n```\ncreatedb TEMPLATE  # create DB\nflask db upgrade  # run migrations\nflask seed  # populate with sample data\nflask db migrate  # generate new migration\nflask db  # more migration commands\n```\n\n### Deploy:\n```\nmake deploy-dev   # deploy to AWS and run migrations\nmake deploy-prd  # deploy to AWS and run migrations\n```\n\n### API Documentation:\n\nOnce your flask dev server is running:\n\n- [OpenAPI JSON](http://localhost:5000/api/openapi.json) (http://localhost:5000/api/openapi.json)\n- [Swagger UI](http://localhost:5000/api/swagger) (http://localhost:5000/api/swagger)\n- [ReDoc](http://localhost:5000/api/doc) (http://localhost:5000/api/doc)\n\n### Database Driver\nThere are two options for database access: [Aurora Data API](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html) or psycopg2/libpq.\n\n#### Aurora Data API\nAllows the application to query the database using AWS API calls. Does not require lambdas to be in a VPC, reducing the need for NAT gateways reducing cost and complexity. Has limitations and is somewhat beta.\n\n#### Psycopg2\nStandard Python PostgreSQL database driver. More powerful and efficient but requires enabling lambda VPC networking.\n\n##### To Enable:\n* Uncomment VPC `subnetIds` config in `serverless.yml`\n* Uncomment `- ${file(cloudformation/vpc/lambda.yml)}` resource inclusion in `serverless.yml`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjetbridge%2Fsls-flask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjetbridge%2Fsls-flask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjetbridge%2Fsls-flask/lists"}