{"id":20153248,"url":"https://github.com/pmutua/document-management-api","last_synced_at":"2026-05-10T18:57:22.853Z","repository":{"id":205003022,"uuid":"655678443","full_name":"pmutua/document-management-api","owner":"pmutua","description":"API developed using Fast API for managing documents","archived":false,"fork":false,"pushed_at":"2023-07-29T18:31:52.000Z","size":177,"stargazers_count":0,"open_issues_count":16,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-13T12:21:42.650Z","etag":null,"topics":["api","aws-lambda","aws-s3","fastapi","python","sqlalchemy","uvicorn"],"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/pmutua.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}},"created_at":"2023-06-19T11:28:03.000Z","updated_at":"2024-02-12T08:39:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"5d7753a2-e774-4992-b455-56cebc1f2657","html_url":"https://github.com/pmutua/document-management-api","commit_stats":null,"previous_names":["pmutua/document-management-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmutua%2Fdocument-management-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmutua%2Fdocument-management-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmutua%2Fdocument-management-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pmutua%2Fdocument-management-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pmutua","download_url":"https://codeload.github.com/pmutua/document-management-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241592971,"owners_count":19987463,"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":["api","aws-lambda","aws-s3","fastapi","python","sqlalchemy","uvicorn"],"created_at":"2024-11-13T23:17:49.941Z","updated_at":"2026-05-10T18:57:22.798Z","avatar_url":"https://github.com/pmutua.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Document API CI/CD](https://github.com/pmutua/fastapi-project/actions/workflows/cicd.yml/badge.svg)](https://github.com/pmutua/fastapi-project/actions/workflows/cicd.yml)\n\n# Document API\n\n## Technologies\n\n- Python 3.11+\n- Poetry\n- Fast API\n- PostgreSQL\n- SQLAlchemy\n- Uvicorn\n- AWS\n\n## Local Development\n\n1. Clone the repository and `cd` into the repository directory.\n2. Check out the Python version `python --version` if less than 3.11 use `pyenv` to install and swithc to 3.11+\n3. Make sure [Poetry](https://python-poetry.org/docs/#installing-with-the-official-installer) is installed.\n4. Create a virtual environment: `python -n venv env`\n5. Activate the virtual environment:\n\n    **On Windows:**\n    Run the following command: `env\\Scripts\\activate`\n\n    **On Linux:**\n    Run the following command: `source env/bin/activate`\n\n6. Install dependences: `poetry install`\n7. You can run the server in 3 `different ways. Choose the one you want.\n\n   - **Option 1 (run with poetry):**\n\n      Run the following command `poetry run uvicorn main:app --reload`\n\n   - **Option 2 (run using existing scripts):**\n\n      _On Windows_\n      Run the following command `scripts\\run.bat`\n\n      _On Linux_\n    Make sure to give the scripts executable permissions if running on a Unix-like system. You can do this by running `chmod +x scripts/run.sh` in the terminal. Then run the following command `scripts/run.sh`\n\n   - **Option 3 (run with Docker):**\n\n    Run: `docker-compose build`\n    Then run the following command: `docker-compose up`\n\n8. Updating migrations\n    **Updating Migrations**\n    Run the following:\n\n    `alembic revision --autogenerate -m \"Added user and document table\"`\n\n    `alembic upgrade head`\n\n9. Access swagger docs at: `http:127.0.0.1:8080/docs`\n\n## Schema\n\nUser Table\n----------\n\n| Column      | Description                                              |\n|-------------|----------------------------------------------------------|\n| user_id     | Unique identifier for each user (Primary Key).            |\n| email       | User's email address.                                    |\n| password    | User's password (stored securely, e.g., hashed).          |\n| created_at  | Timestamp indicating when the user was created.           |\n| updated_at  | Timestamp indicating the last update to the user's information. |\n\nDocument Table\n--------------\n\n| Column         | Description                                              |\n|----------------|----------------------------------------------------------|\n| document_id    | Unique identifier for each document (Primary Key).        |\n| user_id        | Reference to the user_id in the User table, indicating the owner of the document (Foreign Key). |\n| title          | Title of the document.                                   |\n| file_type      | Type of the document, selected from a predefined list (enum). |\n| file_url       | URL or path to the uploaded file.                         |\n| description    | Description of the document.                              |\n| created_at     | Timestamp indicating when the document was uploaded.      |\n| updated_at     | Timestamp indicating the last update to the document.     |\n\n## Features\n\n### Authentication\n\n- User registration: Users should be able to register by providing their username, email, and password.\n- User login: Registered users should be able to log in using their username and password to obtain a JSON Web Token (JWT).\n- JWT-based authentication: All protected routes should require authentication using JWT. Users should include the JWT in the authorization header of their requests.\n\n### Document Upload\n\n- Document Model: Create a document model with the following attributes:\n  - `title`: Title of the document (string).\n  - `file_type`: Type of the document, selected from a predefined list (enum).\n  - `file_url`: URL or path to the uploaded file (string).\n  - `description`: Description of the document (string).\n\n- Upload Endpoint: Create an API endpoint to upload a document with the following features:\n  - Accepts the document details (title, file type, file URL, description) as input.\n  - Validates the input data against the defined model.\n  - Stores the document in a database or file storage system.\n  - Returns a success message or appropriate error response.\n\n### Protected Route\n\n- Retrieve All Documents: Create a protected route that requires authentication to retrieve all uploaded documents.\n- Retrieve a Specific Document: Create a protected route that requires authentication to retrieve a specific document by its ID.\n- Update Document Details: Create a protected route that requires authentication to update the details of a specific document.\n- Delete Document: Create a protected route that requires authentication to delete a specific document.\n\n### Additional Requirements\n\n- Error Handling: Implement appropriate error handling and return meaningful error responses for various scenarios (e.g., invalid input, authentication failure, resource not found).\n- Documentation: Generate API documentation automatically based on the defined routes and models.\n- Unit Testing: Write unit tests to verify the functionality of the authentication, document upload, and text extraction endpoints.\n- Security Considerations: Implement necessary security measures, such as password hashing for user authentication and secure file storage for uploaded documents.\n- Extract Text from Images: Create an API endpoint to extract text from uploaded images. This endpoint should:\n  - Accept an image file as input.\n  - Process the image and extract text from it using OCR or other image processing techniques.\n  - Return the extracted text as a response.\n- CI/CD Pipeline: Set up a CI/CD pipeline for automated building, testing, and deployment of the application. Configure tasks for building the application, running tests, generating documentation, and deploying to a server or cloud platform.\n- Deployment: Prepare the application for deployment to a server or cloud platform, including any necessary configuration files and instructions.\n\n## Project idea skeleton\n\n- `main.py`: The main entry point of the application.\n\n- `app/`: The root folder of the application.\n  - `api/`: Contains API-related components.\n    - `routers/`: Contains API route handlers.\n      - `__init__.py`: Initializes the API routers.\n      - `route1.py`: Defines routes and handlers for Route 1.\n      - `route2.py`: Defines routes and handlers for Route 2.\n      - ... (additional route files)\n    - `models/`: Contains data models for the API.\n      - `__init__.py`: Initializes the API models.\n      - `model1.py`: Defines the data model for Model 1.\n      - `model2.py`: Defines the data model for Model 2.\n      - ... (additional model files)\n    - `schemas/`: Contains Pydantic schemas for request/response validation.\n      - `__init__.py`: Initializes the API schemas.\n      - `schema1.py`: Defines the Pydantic schema for Schema 1.\n      - `schema2.py`: Defines the Pydantic schema for Schema 2.\n      - ... (additional schema files)\n  - `services/`: Contains service modules that handle business logic.\n    - `__init__.py`: Initializes the services.\n    - `route1_service.py`: Implements the service logic for Route 1.\n    - `route2_service.py`: Implements the service logic for Route 2.\n    - ... (additional service files)\n  - `repositories/`: Contains repository modules for data access.\n    - `__init__.py`: Initializes the repositories.\n    - `route1_repository.py`: Implements the repository logic for Route 1.\n    - `route2_repository.py`: Implements the repository logic for Route 2.\n    - ... (additional repository files)\n  - `utils/`: Contains utility modules with reusable functions.\n    - `__init__.py`: Initializes the utility modules.\n    - `utility1.py`: Provides utility functions for common tasks.\n    - `utility2.py`: Provides utility functions for common tasks.\n    - ... (additional utility files)\n\n- `tests/`: Contains test cases for the application.\n  - `test_route1.py`: Test cases for Route 1.\n  - `test_route2.py`: Test cases for Route 2.\n  - ... (additional test files)\n\n- `config/`: Contains configuration files and settings.\n  - `__init__.py`: Initializes the configuration.\n  - `settings.py`: Stores application settings.\n  - `database.py`: Configuration related to the database.\n  - ... (additional configuration files)\n\n- `requirements.txt`: Lists the project dependencies.\n\n- `Dockerfile`: Defines the Docker image configuration for the application.\n- `docker-compose.yml`: Defines the Docker configuration for docker containers\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmutua%2Fdocument-management-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpmutua%2Fdocument-management-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpmutua%2Fdocument-management-api/lists"}