{"id":21602174,"url":"https://github.com/iam-tsr/easystore-api","last_synced_at":"2025-04-11T02:32:43.720Z","repository":{"id":249808791,"uuid":"831474080","full_name":"iam-tsr/EasyStore-API","owner":"iam-tsr","description":"An API that offers a straightforward and efficient backend storage solution.","archived":false,"fork":false,"pushed_at":"2024-09-06T04:44:33.000Z","size":7364,"stargazers_count":1,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T23:51:32.113Z","etag":null,"topics":["api","api-key","backend-store","storage"],"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/iam-tsr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2024-07-20T16:50:59.000Z","updated_at":"2024-09-06T04:44:36.000Z","dependencies_parsed_at":"2024-07-23T13:52:42.695Z","dependency_job_id":"6d69181c-3b6f-450d-b1c8-dcb4da26f69e","html_url":"https://github.com/iam-tsr/EasyStore-API","commit_stats":null,"previous_names":["iam-tsr/api-key-generator"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iam-tsr%2FEasyStore-API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iam-tsr%2FEasyStore-API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iam-tsr%2FEasyStore-API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iam-tsr%2FEasyStore-API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iam-tsr","download_url":"https://codeload.github.com/iam-tsr/EasyStore-API/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248329711,"owners_count":21085589,"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","api-key","backend-store","storage"],"created_at":"2024-11-24T19:12:21.491Z","updated_at":"2025-04-11T02:32:43.691Z","avatar_url":"https://github.com/iam-tsr.png","language":"Python","readme":"# EasyStore API\n\n## Overview\nThe EasyStore API provides a simple and efficient backend storage solution for small websites or projects that lack a backend storage system. This API allows users to generate API keys, store files, manage access, monitor usage, and ensure security. The service utilizes a local system drive for storage and includes features such as API key generation and file upload automation.\n\n## Demo Video -\u003e https://www.youtube.com/watch?v=DtxvTkJkLoY\n\nhttps://github.com/user-attachments/assets/13750a97-08a4-4260-9b48-1dbbf4ccf58c\n\n## Project Structure\nThe project consists of the following main files and directories:\n\n- `.env` - Environment variables configuration file.\n- `.env.example` - Example environment variables file.\n- `.gitignore` - Specifies which files and directories to ignore in git.\n- `app.py` - Main application script.\n- `db.sqlite` - SQLite database file.\n- `requirements.txt` - Python dependencies required for the project.\n- `migrations/` - Directory containing database migration scripts.\n- `static/` - Directory for static files like CSS.\n- `templates/` - Directory for HTML template files.\n- `uploads/` - Directory where uploaded files are stored.\n- `tests/` - Directory containing test scripts.\n\n## Setup and Installation\n\n### Prerequisites\n- Python 3.9 or higher\n- pip (Python package installer)\n- PostgreSQL (for database)\n\n### Installation Steps\n1. **Clone the Repository**\n   ```sh\n   git clone https://github.com/iam-tsr/EasyStore-API.git\n   cd EasyStore-API\n   ```\n\n2. **Create a Virtual Environment**\n   ```sh\n   python -m venv venv\n   source venv\\Scripts\\activate  # On Windows use `venv/bin/activate`\n   ```\n\n3. **Install Dependencies**\n   ```sh\n   pip install -r requirements.txt\n   ```\n\n4. **Set Up Environment Variables**\n   - Create a `.env` file based on the `.env.example` file.\n   - Configure the necessary environment variables.\n\n5. **Create PostgreSQL Database**\n   - Log in to PostgreSQL:\n     ```sh\n     psql -U postgres\n     ```\n   - Create a new database and user:\n     ```sql\n     CREATE DATABASE store;\n     CREATE USER api WITH PASSWORD 'key';\n     ```\n   - Grant all privileges on the database to the user:\n     ```sql\n     GRANT ALL PRIVILEGES ON DATABASE store TO api;\n     ```\n      ```\n      \\c store\n      GRANT ALL PRIVILEGES ON DATABASE store TO api;\n      GRANT USAGE ON SCHEMA public TO api;\n      GRANT CREATE ON SCHEMA public TO api;\n      ```\n      ```\n      ALTER USER api WITH SUPERUSER;\n      ALTER USER api WITH NOSUPERUSER;\n      ```\n\n6. **Configure Environment Variables (Only if you have made changes while creating PostgreSQL Database)**\n\n   - Update your `.env` file with the following variables :\n\n     ```\n     DATABASE_URL=postgresql://easystore_user:your_password@localhost/easystore_db\n     SECRET_KEY=your_secret_key\n     UPLOAD_FOLDER=uploads\n     ```\n\n\u003c!-- 7. **Run Migrations**\n   ```sh\n   alembic upgrade head\n   ``` --\u003e\n\n7. **Start the Application**\n   ```sh\n   python app.py\n   ```\n\n## Usage\n\n### API Endpoints\n- **Authentication**\n  - `POST /register`: Register a new user.\n  - `POST /login`: Log in an existing user to receive an authentication token.\n\n- **File Management**\n  - `POST /upload`: Upload a file.\n  - `GET /files`: Retrieve a list of uploaded files.\n  - `GET /files/\u003cfile_id\u003e`: Download a specific file.\n\n### Example Requests\n- **Register**\n  ```sh\n  curl -X POST http://localhost:5000/register -d '{\"username\": \"testuser\", \"password\": \"testpass\"}' -H \"Content-Type: application/json\"\n  ```\n\n- **Login**\n  ```sh\n  curl -X POST http://localhost:5000/login -d '{\"username\": \"testuser\", \"password\": \"testpass\"}' -H \"Content-Type: application/json\"\n  ```\n\n- **Upload File**\n  ```sh\n  curl -X POST http://localhost:5000/upload -F 'file=@path/to/your/file.txt' -H \"Authorization: Bearer \u003cyour_token\u003e\"\n  ```\n\n- **Get Files**\n  ```sh\n  curl -X GET http://localhost:5000/files -H \"Authorization: Bearer \u003cyour_token\u003e\"\n  ```\n\n- **Download File**\n  ```sh\n  curl -X GET http://localhost:5000/files/\u003cfile_id\u003e -H \"Authorization: Bearer \u003cyour_token\u003e\" -o downloaded_file.txt\n  ```\n\n## Configuration\n- **Environment Variables**\n  - `SECRET_KEY`: Secret key for session management.\n  - `DATABASE_URL`: Database connection string.\n  - `UPLOAD_FOLDER`: Directory for storing uploaded files.\n\n## Testing\nTo run the tests, use the following command:\n```sh\npytest\n```\nThis will execute the tests defined in `test_authentication.py` and `test_query.py`.\n\n## File Descriptions\n- **app.py**: Main application script handling routing and logic.\n- **db.sqlite**: SQLite database file storing user and file information.\n- **requirements.txt**: Lists the dependencies required by the project.\n- **migrations/**: Contains scripts for database migrations.\n- **static/**: Stores static assets like CSS files.\n- **templates/**: Contains HTML templates for rendering web pages.\n- **uploads/**: Directory for storing uploaded files.\n- **tests/**: Directory containing test scripts.\n\n## License\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE.txt) file for details.\n\n## Contributing\nFeel free to contribute by submitting issues or pull requests. Please ensure your contributions align with the project's goals and standards.\n\n## Contact\nFor any inquiries or support, please contact Tushar Rajput (@iam-tsr) or Ansh Chauhan (@Anshchauhanhub).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiam-tsr%2Feasystore-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiam-tsr%2Feasystore-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiam-tsr%2Feasystore-api/lists"}