{"id":27919345,"url":"https://github.com/emuhs/s2p-api","last_synced_at":"2026-04-07T09:32:03.079Z","repository":{"id":291656136,"uuid":"978336703","full_name":"emuhs/s2p-api","owner":"emuhs","description":"Source-to-Pay backend application built with FastAPI and PostgreSQL","archived":false,"fork":false,"pushed_at":"2025-05-16T03:05:36.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-12T04:42:23.788Z","etag":null,"topics":["alembic","backend","crud","docker","fastapi","postgresql","python","rest-api","sqlalchemy"],"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/emuhs.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,"zenodo":null}},"created_at":"2025-05-05T20:37:32.000Z","updated_at":"2025-05-28T17:43:36.000Z","dependencies_parsed_at":"2025-06-12T04:33:55.496Z","dependency_job_id":"84db0173-62c0-4ede-8d49-2b7d5f341f5a","html_url":"https://github.com/emuhs/s2p-api","commit_stats":null,"previous_names":["emuhs/s2p-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/emuhs/s2p-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emuhs%2Fs2p-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emuhs%2Fs2p-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emuhs%2Fs2p-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emuhs%2Fs2p-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/emuhs","download_url":"https://codeload.github.com/emuhs/s2p-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/emuhs%2Fs2p-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31508011,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T03:10:19.677Z","status":"ssl_error","status_checked_at":"2026-04-07T03:10:13.982Z","response_time":105,"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","backend","crud","docker","fastapi","postgresql","python","rest-api","sqlalchemy"],"created_at":"2025-05-06T19:16:49.762Z","updated_at":"2026-04-07T09:32:03.060Z","avatar_url":"https://github.com/emuhs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Source-to-Pay (S2P) API\n\nSource-to-Pay (S2P) API is a secure, containerized backend for managing supplier relationships and purchase workflows. \nBuilt with FastAPI and PostgreSQL, it supports full CRUD operations, schema migrations, and test coverage — making it ideal for internal finance or procurement teams needing a lightweight yet scalable foundation.\n\n## Features\n\n- Supplier and purchase order CRUD functionality\n- Input validation with Pydantic\n- SQLAlchemy ORM with PostgreSQL (via Docker)\n- RESTful API with FastAPI\n- Alembic for schema migrations\n- Dockerized for portability and local development\n- Unit tests with pytest\n\n## Tech Stack\n\n- FastAPI\n- SQLAlchemy\n- Pydantic\n- PostgreSQL (via Docker)\n- Alembic (for migrations)\n- Docker \u0026 Docker Compose\n- pytest\n\n## Project Structure\n\n```\n.\n├── Dockerfile\n├── LICENSE\n├── README.md\n├── alembic\n│   ├── README\n│   ├── env.py\n│   ├── script.py.mako\n│   └── versions\n│       └── dd21dda05376_initial_schema.py\n├── alembic.ini\n├── app\n│   ├── config.py\n│   ├── db\n│   │   ├── __init__.py\n│   │   └── session.py\n│   ├── main.py\n│   ├── models\n│   │   ├── __init__.py\n│   │   ├── purchase_order.py\n│   │   └── supplier.py\n│   ├── routes\n│   │   ├── __init__.py\n│   │   ├── purchase_order.py\n│   │   └── supplier.py\n│   └── schemas\n│       ├── purchase_order.py\n│       └── supplier.py\n├── docker-compose.yml\n├── requirements.txt\n└── tests\n    ├── __init__.py\n    ├── test_purchase_order.py\n    └── test_supplier.py\n```\n\n## Endpoints\n\n### Supplier Routes\n- `GET /supplier`: List all suppliers  \n- `POST /supplier`: Create a new supplier  \n- `GET /supplier/{supplier_id}`: Retrieve a supplier by ID  \n- `PUT /supplier/{supplier_id}`: Update a supplier  \n- `DELETE /supplier/{supplier_id}`: Delete a supplier  \n- `GET /supplier/{supplier_id}/purchase_orders`: Get Purchase Orders For Supplier\n\n### Purchase Order Routes\n- `GET /purchase_order`: List all purchase orders  \n- `POST /purchase_order`: Create a new purchase order  \n- `GET /purchase_order/{id}`: Retrieve a purchase order by ID  \n- `PUT /purchase_order/{id}`: Update a purchase order  \n- `DELETE /purchase_order/{id}`: Delete a purchase order  \n\n\n## Getting Started\n\n### Running the Project with Docker\n\n1. Start the application stack (API and PostgreSQL) using Docker Compose:\n\n```bash\ndocker-compose up --build\n```\n\n2. The API will be available at:\n\n- Swagger UI: [http://localhost:8000/docs](http://localhost:8000/docs)\n- ReDoc: [http://localhost:8000/redoc](http://localhost:8000/redoc)\n\n3. To shut down the stack:\n\n```bash\ndocker-compose down\n```\n\n### Database Migrations with Alembic\n\nAlembic is used to handle database schema migrations with PostgreSQL.\n\n1. Create a new migration after editing your SQLAlchemy models:\n\n```bash\ndocker-compose exec web alembic revision --autogenerate -m \"Your message here\"\n```\n\n2. Apply the migration to the database:\n\n```bash\ndocker-compose exec web alembic upgrade head\n```\n\n## Running Tests\n\nTo run the test suite using Docker (recommended):\n\n```bash\ndocker-compose exec web pytest\n```\n\n## Future Improvements\n\n- Add authentication and authorization (OAuth2 or JWT)\n- Harden PostgreSQL setup for production (secure env vars, persistent volumes)\n- Extend schema to support invoices and approvals\n- Implement pagination and filtering for list endpoints\n- Improve error handling and standardized API responses\n- Set up CI/CD pipeline for automated testing and deployment\n- Add unit and integration tests with coverage reporting\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femuhs%2Fs2p-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femuhs%2Fs2p-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femuhs%2Fs2p-api/lists"}