{"id":20138380,"url":"https://github.com/biosan/appuntidb","last_synced_at":"2026-04-20T04:06:11.604Z","repository":{"id":79299370,"uuid":"118157818","full_name":"biosan/AppuntiDB","owner":"biosan","description":"Database back-end for Project Note – \"Reti di Calcolatori\" course project","archived":false,"fork":false,"pushed_at":"2018-09-13T11:57:12.000Z","size":87,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-09T06:49:53.836Z","etag":null,"topics":["amqp","flask","flask-restful","pika","sqlachemy","tornado","university-project","websocket"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/biosan.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":"2018-01-19T17:42:59.000Z","updated_at":"2022-06-10T17:14:39.000Z","dependencies_parsed_at":"2023-03-18T13:03:13.177Z","dependency_job_id":null,"html_url":"https://github.com/biosan/AppuntiDB","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/biosan/AppuntiDB","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biosan%2FAppuntiDB","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biosan%2FAppuntiDB/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biosan%2FAppuntiDB/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biosan%2FAppuntiDB/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/biosan","download_url":"https://codeload.github.com/biosan/AppuntiDB/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/biosan%2FAppuntiDB/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32032306,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["amqp","flask","flask-restful","pika","sqlachemy","tornado","university-project","websocket"],"created_at":"2024-11-13T21:37:44.386Z","updated_at":"2026-04-20T04:06:11.586Z","avatar_url":"https://github.com/biosan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Project Note Database Back-end\n\n## Introduction\n\nThis repository contains Appunti-DB, the database back-end for Project Note, a platform for note sharing.\nAppunti-DB is written in Python using Flask framework running on Tornado WSGI server, everything is packed in a Docker container that allow fast, reproducible and dependency-less deployment.\n\n\n## Architecture\n\n```\n+-------------------------------------+\n|               My Code               |\n|--------+                +-----------|\n|  Pika  |                | WebSocket |\n+-------------------------------------+\n     |             |              |\n     |             V              |\n     |     +---------------+      |\n     |     | Flask-Restful |      |\n     |     +---------------+      |\n     |             |              |\n     |             V              |\n     |       +-----------+        |\n     |       |   Flask   |        |\n     |       +-----------+        |\n     |             |              |\n     |AMQP         |HTTP          |WebSocket\n     |             |              |\n     V             V              V\n +------+   +-------------------------+\n | Pika |   |      Tornado WSGI       |\n +------+   +-------------------------+\n+======================================+\n|            Supervisord               |\n+======================================+\n+======================================+\n|              Docker                  |\n+======================================+\n```\n\n### Libraries and dependencies\n\n- **Flask**\n    - `Flask-Restful`- to reduce Flask boilerplate for API-only services)\n    - `Flask-Script`- allow CLI-like management of Flask\n    - `Flask-HTTPAuth` - add support for HTTP simple auth used for user authentication\n    - `Flask-Migrate`  - integrate Flask, Alembic (and SQLAlchemy)\n    - `Flask-SQLAlchemy` - integration of SQLAlchemy ORM inside Flask\n- **Database** *(PostgreSQL)*\n    - `PsycoPG2-binary` - PostgreSQL driver (compiled binary)\n    - `SQLAlchemy`` - Python's best ORM\n    - `Alembic`` - migrations manager for SQLAlchemy\n- **Security**\n    - `Passlib` - easy, fast and reliable library for password hashing\n        - `argon2pure` - pure Python implementation of Argon2 password hashing algorithm (must switch to C compiled version for better performance)\n- **Production Performance**\n    - `Tornado` - add WebSocket support and high performance (concorrent workers)\n        - `gevent` - enable Tornado concurrency\n- **AMQP**\n    - `pika` - library for AMQP protocol\n    - `requests` - Pythonic HTTP library to send requests to main Flask/Tornado server\n\n\n## API Reference\n\n### **GET** - /db/api/v0.1/users\n\n#### CURL\n\n```sh\ncurl -X GET \"https://appunti-db.herokuapp.com/db/api/v0.1/users\"\n```\n\n### **POST** - /db/api/v0.1/users\n\n#### CURL\n\n```sh\ncurl -X POST \"https://appunti-db.herokuapp.com/db/api/v0.1/users\" \\\n    -H \"Content-Type: application/json; charset=utf-8\" \\\n    --data-raw \"$body\" \\\n-u \"test\":\"$password\"\n```\n\n#### Header Parameters\n\n- **Content-Type** should respect the following schema:\n\n```\n{\n  \"type\": \"string\",\n  \"enum\": [\n    \"application/json; charset=utf-8\"\n  ],\n  \"default\": \"application/json; charset=utf-8\"\n}\n```\n\n#### Body Parameters\n\n- **body** should respect the following schema:\n\n```\n{\n  \"type\": \"string\",\n  \"default\": \"{\\\"username\\\":\\\"test\\\",\\\"mail\\\":\\\"test@test.com\\\",\\\"password\\\":\\\"\\\"}\"\n}\n```\n\n#### Security\n\n- Basic Authentication\n  - **username**: test\n  - **password**: $password\n\n### **GET** - /db/api/v0.1/users/rRZCgStOp0g/auth\n\n#### CURL\n\n```sh\ncurl -X GET \"https://appunti-db.herokuapp.com/db/api/v0.1/users/rRZCgStOp0g/auth\" \\\n-u \"rRZCgStOp0g\":\"$password\"\n```\n\n#### Path Parameters\n\n- **RequestVariable** should respect the following schema:\n\n```\n{\n  \"type\": \"string\",\n  \"default\": \"rRZCgStOp0g\"\n}\n```\n\n#### Security\n\n- Basic Authentication\n  - **username**: rRZCgStOp0g\n  - **password**: $password\n\n### **DELETE** - /db/api/v0.1/users/rRZCgStOp0g\n\n#### CURL\n\n```sh\ncurl -X DELETE \"https://appunti-db.herokuapp.com/db/api/v0.1/users/rRZCgStOp0g\" \\\n-u \"rRZCgStOp0g\":\"$password\"\n```\n\n#### Path Parameters\n\n- **RequestVariable** should respect the following schema:\n\n```\n{\n  \"type\": \"string\",\n  \"default\": \"rRZCgStOp0g\"\n}\n```\n\n#### Security\n\n- Basic Authentication\n  - **username**: rRZCgStOp0g\n  - **password**: $password\n\n### **GET** - /db/api/v0.1/search\n\n#### Description\nSearch all stored notes.\n\n#### CURL\n\n```sh\ncurl -X GET \"https://appunti-db.herokuapp.com/db/api/v0.1/search\\\n?query=Fisica\"\n```\n\n#### Query Parameters\n\n- **query** should respect the following schema:\n\n```\n{\n  \"type\": \"string\",\n  \"enum\": [\n    \"Fisica\"\n  ],\n  \"default\": \"Fisica\"\n}\n```\n\n### **GET** - /db/api/v0.1/notes\n\n#### CURL\n\n```sh\ncurl -X GET \"https://appunti-db.herokuapp.com/db/api/v0.1/notes\"\n```\n\n### **POST** - /db/api/v0.1/notes\n\n#### CURL\n\n```sh\ncurl -X POST \"https://appunti-db.herokuapp.com/db/api/v0.1/notes\" \\\n    -H \"Content-Type: application/json; charset=utf-8\" \\\n    --data-raw \"$body\" \\\n-u \"test\":\"$password\"\n```\n\n#### Header Parameters\n\n- **Content-Type** should respect the following schema:\n\n```\n{\n  \"type\": \"string\",\n  \"enum\": [\n    \"application/json; charset=utf-8\"\n  ],\n  \"default\": \"application/json; charset=utf-8\"\n}\n```\n\n#### Body Parameters\n\n- **body** should respect the following schema:\n\n```\n{\n  \"type\": \"string\",\n  \"default\": \"{\\\"name\\\":\\\"Test Note 1234\\\",\\\"owner\\\":\\\"rRZCgStOp0g\\\",\\\"teacher\\\":\\\"Sibilia\\\",\\\"subject\\\":\\\"fisica\\\",\\\"university\\\":\\\"sapienza\\\",\\\"year\\\":\\\"2016\\\",\\\"tags\\\":[\\\"exercises\\\"],\\\"language\\\":\\\"ita\\\"}\"\n}\n```\n\n#### Security\n\n- Basic Authentication\n  - **username**: test\n  - **password**: $password\n\n### **DELETE** - /db/api/v0.1/notes/82f8AjF3WzE\n\n#### CURL\n\n```sh\ncurl -X DELETE \"https://appunti-db.herokuapp.com/db/api/v0.1/notes/82f8AjF3WzE\" \\\n-u \"test\":\"$password\"\n```\n\n#### Path Parameters\n\n- **ResponseBodyPath** should respect the following schema:\n\n```\n{\n  \"type\": \"string\",\n  \"default\": \"82f8AjF3WzE\"\n}\n```\n\n#### Security\n\n- Basic Authentication\n  - **username**: test\n  - **password**: $password\n\n### **GET** - /db/api/v0.1/amqp/SIo7LfcujeQ/1/0002\n\n#### CURL\n\n```sh\ncurl -X GET \"https://appunti-db.herokuapp.com/db/api/v0.1/amqp/SIo7LfcujeQ/1/0002\"\n```\n\n### **POST** - /db/api/v0.1/files/82f8AjF3WzE\n\n#### CURL\n\n```sh\ncurl -X POST \"https://appunti-db.herokuapp.com/db/api/v0.1/files/82f8AjF3WzE\" \\\n    -H \"Content-Type: multipart/form-data; charset=utf-8; boundary=__X_PAW_BOUNDARY__\" \\\n    --data-raw \"enctype\"=\"multipart/form-data\" \\\n    --data-raw \"file1\"=\"$file1\" \\\n-u \"test\":\"$password\"\n```\n\n#### Path Parameters\n\n- **RequestVariable** should respect the following schema:\n\n```\n{\n  \"type\": \"string\",\n  \"default\": \"82f8AjF3WzE\"\n}\n```\n\n#### Header Parameters\n\n- **Content-Type** should respect the following schema:\n\n```\n{\n  \"type\": \"string\",\n  \"enum\": [\n    \"multipart/form-data; charset=utf-8; boundary=__X_PAW_BOUNDARY__\"\n  ],\n  \"default\": \"multipart/form-data; charset=utf-8; boundary=__X_PAW_BOUNDARY__\"\n}\n```\n\n#### Body Parameters\n\n- **enctype** should respect the following schema:\n\n```\n{\n  \"type\": \"string\",\n  \"enum\": [\n    \"multipart/form-data\"\n  ],\n  \"default\": \"multipart/form-data\"\n}\n```\n- **file1** should respect the following schema:\n\n```\n{\n  \"type\": \"string\",\n  \"enum\": [\n    \"\"\n  ]\n}\n```\n\n#### Security\n\n- Basic Authentication\n  - **username**: test\n  - **password**: $password\n\n### **GET** - /db/api/v0.1/files/82f8AjF3WzE/1\n\n#### CURL\n\n```sh\ncurl -X GET \"https://appunti-db.herokuapp.com/db/api/v0.1/files/82f8AjF3WzE/1\"\n```\n\n#### Path Parameters\n\n- **RequestVariable** should respect the following schema:\n\n```\n{\n  \"type\": \"string\",\n  \"default\": \"82f8AjF3WzE\"\n}\n```\n- **RequestVariable_2** should respect the following schema:\n\n```\n{\n  \"type\": \"string\",\n  \"default\": \"1\"\n}\n```\n\n### **PUT** - /db/api/v0.1/files/82f8AjF3WzE\n\n#### CURL\n\n```sh\ncurl -X PUT \"https://appunti-db.herokuapp.com/db/api/v0.1/files/82f8AjF3WzE\" \\\n    -H \"Content-Type: multipart/form-data; charset=utf-8; boundary=__X_PAW_BOUNDARY__\" \\\n    --data-raw \"enctype\"=\"multipart/form-data\" \\\n    --data-raw \"file_to_append\"=\"$file_to_append\" \\\n-u \"test\":\"$password\"\n```\n\n#### Path Parameters\n\n- **RequestVariable** should respect the following schema:\n\n```\n{\n  \"type\": \"string\",\n  \"default\": \"82f8AjF3WzE\"\n}\n```\n\n#### Header Parameters\n\n- **Content-Type** should respect the following schema:\n\n```\n{\n  \"type\": \"string\",\n  \"enum\": [\n    \"multipart/form-data; charset=utf-8; boundary=__X_PAW_BOUNDARY__\"\n  ],\n  \"default\": \"multipart/form-data; charset=utf-8; boundary=__X_PAW_BOUNDARY__\"\n}\n```\n\n#### Body Parameters\n\n- **enctype** should respect the following schema:\n\n```\n{\n  \"type\": \"string\",\n  \"enum\": [\n    \"multipart/form-data\"\n  ],\n  \"default\": \"multipart/form-data\"\n}\n```\n- **file_to_append** should respect the following schema:\n\n```\n{\n  \"type\": \"string\",\n  \"enum\": [\n    \"\"\n  ]\n}\n```\n\n#### Security\n\n- Basic Authentication\n  - **username**: test\n  - **password**: $password\n\n\n## Building container\n\nTo build the container run this inside this repo\n\n```\ndocker build -t db_api .\n```\n\nTo run it\n\n```\ndocker run db_api -p INT_PORT:EXT_PORT\n```\n\n### Environment variables\n```\n-e B2_APPLICATION_KEY='XXXXXXXXX...XXXXXXXX'\n-e B2_ACCOUNT_ID='XXXX...XXXX'\n-e AMQP_BROKER_URL='amqp://USERNAME:PASSWORD@URL'\n-e APPLICATION_MODE='PRODUCTION or TESTING or DEVELOPMENT'\n-e DATABASE_URL='postgres://USERNAME:PASSWORD@URL'\n-e ADDRESS='0.0.0.0'\n-e PORT='INT_PORT'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiosan%2Fappuntidb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbiosan%2Fappuntidb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbiosan%2Fappuntidb/lists"}