{"id":16976952,"url":"https://github.com/johndatserakis/find-the-state-api","last_synced_at":"2026-04-11T13:32:23.403Z","repository":{"id":86795312,"uuid":"353881549","full_name":"johndatserakis/find-the-state-api","owner":"johndatserakis","description":"🔍 Find all the States in the contiguous USA on a map. Simple enough.","archived":false,"fork":false,"pushed_at":"2021-05-05T03:08:11.000Z","size":259,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-03-21T22:11:29.283Z","etag":null,"topics":["alembic","fastapi","poetry","postgresql","python","sqlalchemy"],"latest_commit_sha":null,"homepage":"https://find-the-state.netlify.app","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/johndatserakis.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":"2021-04-02T02:24:57.000Z","updated_at":"2021-12-23T15:40:53.000Z","dependencies_parsed_at":"2023-03-06T14:15:34.902Z","dependency_job_id":null,"html_url":"https://github.com/johndatserakis/find-the-state-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/johndatserakis/find-the-state-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johndatserakis%2Ffind-the-state-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johndatserakis%2Ffind-the-state-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johndatserakis%2Ffind-the-state-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johndatserakis%2Ffind-the-state-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johndatserakis","download_url":"https://codeload.github.com/johndatserakis/find-the-state-api/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johndatserakis%2Ffind-the-state-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31682953,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T13:07:20.380Z","status":"ssl_error","status_checked_at":"2026-04-11T13:06:47.903Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["alembic","fastapi","poetry","postgresql","python","sqlalchemy"],"created_at":"2024-10-14T01:27:42.657Z","updated_at":"2026-04-11T13:32:23.388Z","avatar_url":"https://github.com/johndatserakis.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Find the State API\n\nFind all the States in the contiguous USA on a map. Simple enough.\n\n- [Live URL](https://find-the-state.netlify.app/)\n- [Frontend UI GitHub](https://github.com/johndatserakis/find-the-state-ui) - Built with TypeScript and React\n- [Backend API GitHub](https://github.com/johndatserakis/find-the-state-api) - Built with Python and FastAPI\n\n## Run\n\n```bash\n# If your running this for the first time, make sure to run the migrations\n\n# Start\ndocker-compose up -d --build\n\n# Stop\ndocker-compose down\n\n# Docker cleanup commands https://gist.github.com/johndatserakis/0002d9aded5778f9d0589a23ce1e08d4\n```\n\n## Commands While Running\n\n```bash\n# Below are commands to be run when the containers are running locally with docker-comose\n\n# Run migrations\ndocker-compose exec api poetry run alembic upgrade head\n\n# Run tests\ndocker-compose exec api pytest .\n\n# Run a specific script\ndocker-compose exec api python ./program_scripts/get_state_data.py\n\n# Add a dependency\ndocker-compose exec api poetry add slowapi\n\n# Create poetry.lock file\ndocker-compose exec api poetry lock\n```\n\n## Alembic\n\n```bash\n# Create migration (called a \"revision\")\ndocker-compose exec api poetry run alembic revision -m \"Create score table\"\n\n# Run migrations\ndocker-compose exec api poetry run alembic upgrade head\n\n# Downgrade 1 migration file\ndocker-compose exec api poetry run alembic downgrade -1\n\n# View list of migration files\ndocker-compose exec api poetry run alembic history\ndocker-compose exec api poetry run alembic downgrade $Id\n```\n\n## View Running API\n\n- http://localhost:8000/docs\n- http://localhost:8000/api/v1/health\n\n## Build for Production\n\nIn development I use `docker-compose` because it sets up the `PostgreSQL` dependency nicely. For the production build, I just use a regular Dockerfile, `./app/Dockerfile-production`, to build the API.\n\n```bash\n# Currently I'm using AWS ECR for the registry\n\n# From root, build for production using `./app/Dockerfile-production` Dockerfile\ndocker build \\\n-t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG \\\n-f ./app/Dockerfile-production ./app \\\n--build-arg POSTGRES_USER=$POSTGRES_USER \\\n--build-arg POSTGRES_PASSWORD=$POSTGRES_PASSWORD \\\n--build-arg POSTGRES_HOST=$POSTGRES_HOST \\\n--build-arg POSTGRES_DB=$POSTGRES_DB\n\n# Run what you built locally to test\ndocker run -dit --publish 8000:8000 --restart unless-stopped $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG\n\n# Lastly push to your container registry of choice\ndocker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG\n```\n\n## Built With\n\n- Python 3.8\n- FastAPI\n- SQLAlchemy\n- Alembic\n- pymediawiki\n- Poetry\n- PostgreSQL\n- [slowapi](https://github.com/laurentS/slowapi)\n\n## Notes\n\n- Below are some links I saved while learning Python.\n\n## Python\n\n- [Packages](https://docs.python.org/3/tutorial/modules.html#packages)\n- [Learn X in Y minutes](https://learnxinyminutes.com/docs/python/)\n\n## FastAPI\n\n- [Folder Structure](https://fastapi.tiangolo.com/tutorial/bigger-applications/)\n\n## [Pydantic](https://pydantic-docs.helpmanual.io/usage/types/)\n\n## [encode/databases](https://github.com/encode/databases)\n\n## [SQLAlchemy Core](https://docs.sqlalchemy.org/en/14/core/tutorial.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohndatserakis%2Ffind-the-state-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohndatserakis%2Ffind-the-state-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohndatserakis%2Ffind-the-state-api/lists"}