{"id":22468575,"url":"https://github.com/projectweekend/flask-postgresql-api-seed","last_synced_at":"2026-03-11T10:32:52.704Z","repository":{"id":20193223,"uuid":"23464390","full_name":"projectweekend/Flask-PostgreSQL-API-Seed","owner":"projectweekend","description":"A starting point for a Flask API backend","archived":false,"fork":false,"pushed_at":"2015-05-15T23:09:03.000Z","size":291,"stargazers_count":23,"open_issues_count":0,"forks_count":9,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-02T09:26:59.113Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","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/projectweekend.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}},"created_at":"2014-08-29T13:13:42.000Z","updated_at":"2024-05-18T15:51:17.000Z","dependencies_parsed_at":"2022-09-07T19:40:29.654Z","dependency_job_id":null,"html_url":"https://github.com/projectweekend/Flask-PostgreSQL-API-Seed","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/projectweekend/Flask-PostgreSQL-API-Seed","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectweekend%2FFlask-PostgreSQL-API-Seed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectweekend%2FFlask-PostgreSQL-API-Seed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectweekend%2FFlask-PostgreSQL-API-Seed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectweekend%2FFlask-PostgreSQL-API-Seed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/projectweekend","download_url":"https://codeload.github.com/projectweekend/Flask-PostgreSQL-API-Seed/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projectweekend%2FFlask-PostgreSQL-API-Seed/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30378102,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T06:09:32.197Z","status":"ssl_error","status_checked_at":"2026-03-11T06:09:17.086Z","response_time":84,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-12-06T11:17:51.148Z","updated_at":"2026-03-11T10:32:52.678Z","avatar_url":"https://github.com/projectweekend.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Development Environment\n====================\n\nThe development environment uses [Docker](http://www.docker.com/) and [Docker Compose](https://docs.docker.com/compose/). This makes it super easy to get up and running with a configuration that would closely mirror production. A [Vagrant](http://www.vagrantup.com/) config file is included for operating systems that cannot yet run Docker natively.\n\nWith Docker/Compose/Vagrant installed, use the following steps to launch for the first time:\n\n* `vagrant up` - from within the project root to build the Ubuntu VM with Docker and Fig automatically installed. If you're already using Linux, you can skip this step and just install Docker and Fig on your system.\n* `docker-compose up` to start the web app. This will download and provision two containers: one running PostgreSQL and one running the Flask app. This will take a while, but once it completes subsequent launches will be much faster. (NOTE: if you are using the Vagrant VM that was provisioned in the first step, change into the `/vagrant` directory before running `docker-compose up`.)\n* When `docker-compose up` completes, the app should be accessible at [http://127.0.0.1:5000](http://127.0.0.1:5000). (NOTE: if running commands within the Vagrant VM that was provisioned in the first step, the app can be found at: [http://192.168.13.81:5000](http://192.168.13.81:5000))\n\n\nEnvironment Variables\n====================\n\nThere are just a couple of configurations managed as environment variables. In the development environment, these are injected by Docker Compose and managed in the `docker-compose.yml` file.\n\n* `DATABASE_URL` - This is the connection URL for the PostgreSQL database. It is not used in the **development environment**.\n* `DEBUG` - This toggle debug mode for the app to True/False.\n* `SECRET_KEY` - This is a secret string that you make up. It is used to encrypt and verify the authentication token on routes that require authentication.\n\n\nProject Organization\n====================\n\n* Application-wide settings are stored in `config.py` at the root of the repository. These items are accessible on the `config` dictionary property of the `app` object. Example: `debug = app.config['DEBUG']`\n* The directory `/app` contains the API application\n* URL mapping is managed in `/app/routes.py`\n* Functionality is organized in packages. Example: `/app/users` or `/app/utils`.\n* Tests are contained in each package. Example: `app/users/tests.py`\n\n\nRunning Tests\n====================\n\nTests are ran with [nose](https://nose.readthedocs.org/en/latest/) from inside the `docker-compose` web container:\n\n```\n$ docker-compose run web nosetests -v\n```\n\n\nDatabase Migrations\n====================\n\nMigrations for the provided models are part of the seed project. To generate new migrations use `Flask-Migrate`:\n\n    $ docker-compose run web python run.py db migrate\n    $ docker-compose run web python run.py db upgrade\n\n\nAPI Routes\n====================\n\nThis API uses token-based authentication. A token is obtained by registering a new user (`/api/v1/user`) or authenticating an existing user (`/api/v1/authenticate`). Once the client has the token, it must be included in the `Authorization` header of all requests.\n\n\n### Register a new user\n\n**POST:**\n```\n/api/v1/user\n```\n\n**Body:**\n```json\n{\n    \"email\": \"something@email.com\",\n    \"password\": \"123456\"\n}\n```\n\n**Response:**\n```json\n{\n    \"id\": 2,\n    \"token\": \"eyJhbGciOiJIUzI1NiIsImV4cCI6MTQxMDk2ODA5NCwiaWF0IjoxNDA5NzU4NDk0fQ.eyJpc19hZG1pbiI6ZmFsc2UsImlkIjoyLCJlbWFpbCI6InRlc3QyQHRlc3QuY29tIn0.goBHisCajafl4a93jfal0sD5pdjeYd5se_a9sEkHs\"\n}\n```\n\n**Status Codes:**\n* `201` if successful\n* `400` if incorrect data provided\n* `409` if email is in use\n\n\n### Get the authenticated user\n\n**GET:**\n```\n/api/v1/user\n```\n\n**Response:**\n```json\n{\n    \"id\": 2,\n    \"email\": \"test2@test.com\",\n}\n```\n\n**Status Codes:**\n* `200` if successful\n* `401` if not authenticated\n\n\n### Authenticate a user\n\n**POST:**\n```\n/api/v1/authenticate\n```\n\n**Body:**\n```json\n{\n    \"email\": \"something@email.com\",\n    \"password\": \"123456\"\n}\n```\n\n**Response:**\n```json\n{\n    \"id\": 2,\n    \"token\": \"eyJhbGciOiJIUzI1NiIsImV4cCI6MTQxMDk2ODA5NCwiaWF0IjoxNDA5NzU4NDk0fQ.eyJpc19hZG1pbiI6ZmFsc2UsImlkIjoyLCJlbWFpbCI6InRlc3QyQHRlc3QuY29tIn0.goBHisCajafl4a93jfal0sD5pdjeYd5se_a9sEkHs\"\n}\n```\n\n**Status Codes:**\n* `200` if successful\n* `401` if invalid credentials\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojectweekend%2Fflask-postgresql-api-seed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprojectweekend%2Fflask-postgresql-api-seed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojectweekend%2Fflask-postgresql-api-seed/lists"}