{"id":23629636,"url":"https://github.com/santonel/notes-api","last_synced_at":"2025-10-15T20:15:10.271Z","repository":{"id":269987475,"uuid":"909004652","full_name":"santonel/notes-api","owner":"santonel","description":"GraphQL api to manage notes with freetext search","archived":false,"fork":false,"pushed_at":"2024-12-29T10:09:40.000Z","size":113,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-07T01:36:49.525Z","etag":null,"topics":["graphql","mikro-orm","sqlite","typegraphql","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/santonel.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":"2024-12-27T14:09:29.000Z","updated_at":"2024-12-29T10:09:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"94590d6e-613b-48f3-a968-1d5c49a0a20b","html_url":"https://github.com/santonel/notes-api","commit_stats":null,"previous_names":["santonel/notes-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/santonel/notes-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/santonel%2Fnotes-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/santonel%2Fnotes-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/santonel%2Fnotes-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/santonel%2Fnotes-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/santonel","download_url":"https://codeload.github.com/santonel/notes-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/santonel%2Fnotes-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279110816,"owners_count":26105907,"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","status":"online","status_checked_at":"2025-10-15T02:00:07.814Z","response_time":56,"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":["graphql","mikro-orm","sqlite","typegraphql","typescript"],"created_at":"2024-12-28T01:16:28.382Z","updated_at":"2025-10-15T20:15:10.241Z","avatar_url":"https://github.com/santonel.png","language":"TypeScript","readme":"# NOTES-API\n\nNotes-api is a GraphQL service for managing notes, associating them with a language, a source, and tags.  \nIt is written in TypeScript and uses various open-source libraries, including:\n\n* [mikro-orm](https://github.com/mikro-orm/mikro-orm)  \n* [type-graphql](https://github.com/MichalLytek/type-graphql)  \n* [SQLite](https://www.sqlite.org/)\n\n## 📑 Background\n\nI wanted to try the SQLite FTS5 extension and explore how easy it would be to use it with mikro-orm in a GraphQL API.\n\nI ended up using a schema with an [external content table](https://www.sqlite.org/fts5.html#external_content_tables). The inspiration for this solution came from this great [video](https://www.youtube.com/watch?v=eXMA_2dEMO0) by James Moore.\n\n## 🚀 Quick Start\n\nIf you are using Visual Studio Code, clone the repository and launch VS Code in the repository directory. If you have the Remote extension installed, it will offer to re-open the project in a devcontainer.\n\n\u003e If you are using Podman/Podman Desktop, select the Podman container.\n\nBoth devcontainers install two extensions:  \n* biomejs.biome (formatting, linter)  \n* Orta.vscode-jest (tests)\n\nThe project requires at least Node.js 22:\n\n```bash\nnpm install\n```\n\nRun the unit/integration tests with:\n\n```bash\nnpm run test\n```\n\nRun the API with:\n\n```bash\nnpm run start\n```\n\n## 👓 Examples \n\nEdit the example.env file with your preferred options. You can leave it as-is, but VS Code will use development.env as the default environment file.\n\nStart the project and connect to localhost:4000/graphql. You can use Apollo Studio to execute queries against the API.\n\nInsert a note with:\n\n```graqphql\nmutation SaveNote($data: NoteInput!) {\n  saveNote(data: $data) {\n    title\n    body\n    date\n    internalId\n    languageId\n    noteId\n    sourceId\n  }\n}\n```\n\nusing these variables:\n\n```json\n{\n  \"data\": {\n    \"internalId\": \"MATH-001\",\n    \"title\": \"Geometry lesson 1\",\n    \"body\": \"In a Euclidean space, the sum of angles of a triangle equals a straight angle\",\n    \"date\": \"2018-06-01T13:20:00Z\",\n    \"languageId\": 1,\n    \"sourceId\": 1,\n  }\n}\n```\n\nYou can associate tags with it:\n\n```graqphql\n\nmutation AssociateTagsWithNote($associations: NoteAssociationInput!) {\n  associateTagsWithNote(associations: $associations)\n}\n\n```\n\nusing these variables:\n\n```json\n{\n  \"associations\": {\n    \"noteId\": 1,\n    \"tags\": [\n      {\n        \"displayOrder\": 1,\n        \"tagId\": 1\n      }\n    ]\n  }\n}\n```\n\nAt this point, you can perform a free-text search.\n\n\u003e Under the hood, sqlite uses MATCH to search the title or body of the note.\n\n``` graqphql\nquery searchNotes($pagination: PaginationInput!, $searchInput: SearchNotesInput!, $sortInput: NoteMultiSortInput) {\n  searchNotes(pagination: $pagination, searchInput: $searchInput, sortInput: $sortInput) {\n    hasNextPage\n    items {\n      noteId\n      title\n      body\n      date\n      language {\n        name\n      }\n      source {\n        name\n      }\n      tags {\n        tag {\n          name\n        }\n      }\n    }\n  }\n}\n\n```\n\nusing these variables:\n\n```json\n{\n\n  \"searchInput\": {\n    \"fromDate\": \"2018-01-01T00:00:00Z\",\n    \"toDate\": \"2018-12-31T00:00:00Z\",\n    \"searchPhrase\": \"triangle\"\n  },\n  \"sortInput\": {\n    \"sorts\": [\n      {\n        \"sort\": \"asc\",\n        \"field\": \"date\"\n      }\n    ]\n  },\n    \"pagination\": {\n    \"limit\": 10,\n    \"offset\": 0\n  },\n}\n```\n\n     \n## 🤝 Feedback and Contributions\n\nI'd love to hear your feedback and suggestions for further improvements. Feel free to contribute!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsantonel%2Fnotes-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsantonel%2Fnotes-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsantonel%2Fnotes-api/lists"}