{"id":22559657,"url":"https://github.com/taurusilver7/insight","last_synced_at":"2025-03-28T12:12:06.658Z","repository":{"id":225955606,"uuid":"767055381","full_name":"taurusilver7/insight","owner":"taurusilver7","description":"A RESTful API for registered users to manage books, authors \u0026 reviews","archived":false,"fork":false,"pushed_at":"2024-04-05T17:37:30.000Z","size":180,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-02T12:35:46.432Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/taurusilver7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-03-04T16:15:30.000Z","updated_at":"2024-03-04T16:16:53.000Z","dependencies_parsed_at":"2025-02-02T12:34:32.064Z","dependency_job_id":"f1e1dd5c-9257-47e2-aafe-a802fe10b005","html_url":"https://github.com/taurusilver7/insight","commit_stats":null,"previous_names":["taurusilver7/insight"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taurusilver7%2Finsight","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taurusilver7%2Finsight/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taurusilver7%2Finsight/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taurusilver7%2Finsight/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taurusilver7","download_url":"https://codeload.github.com/taurusilver7/insight/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246026109,"owners_count":20711581,"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":[],"created_at":"2024-12-07T21:07:52.555Z","updated_at":"2025-03-28T12:12:06.643Z","avatar_url":"https://github.com/taurusilver7.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# INSIGHT - Books \u0026 Authors\n\nA Secured, CRUD, RESTful API to manage books, authors (bio) for the registered users. It could be used as an api for a library rental feature.\n\nBuilt with Typescript, Express, TyepORM, Class Validators \u0026 JWT.\n\n## Features\n\n- CRUD operations for books and authors\n- Authentication and authorization with JWT\n- Validation with Class Validator\n- Pagination support\n- Error handling\n\n## Available Scripts\n\n```bash\nyarn init -y\n# and\nyarn add (dependencies)\n# and\nyarn add -D (dev-dependencies)\n# and\nnpx tsc --init (ts-config)\n# and\nyarn dev (local dev server)\n```\n\n## Setup\n\n1. Clone the repository: `https://github.com/taurusilver7/insight`\n2. Copy the `.env.example` to `.env` and update the necessary variables `cp .env.example .env`\n3. Install dependencies \u0026 run migrations `yarn install \u0026\u0026 yarn migrate`\n4. Ready to boot the server with `yarn dev`\n5. Acess the REST api endpoint at url `http://localhost:3000` or the port you specified at `.env`\n\n## Stack\n\n- Typescript\n- TypeORM\n- MySQL\n- JWT\n- Class Validator\n\n## Build\n\nAdd the dependencies \u0026 dev-dependencies to the api. Create a typescript configuration to enable compiler options \u0026 strict compilation features.\n\nCreate app \u0026 index server files in src directory. Initiate a starter server in app with base middlewares. Create a server listener in index.\n\nCreate a development server script to watch src directory \u0026 run the server with nodemon. Since ts-node was not a globally installed dependency, modify the script to suit the requirement.\n\nOptional - Add jest \u0026 supertest test dependencies to the build. Create test cases for app \u0026 api modules.\n\nCreate a mysql 8.0.36 local database \u0026 setup the mysql server. Create a data-source config to connect the local database to the application.\n\nCreate corresponding scripts to create/run/show/revert database migrations. Configure the migration-create path and corresponding cmd line arguments.\n\nCreate a new migration:create for authors table. Customize the table columns, types, and other characterstics with base mysql table syntax.\n\nCreate a new CreateTable queryRunner in the migration to create a table with necessary columns with data fields. Create a dropTable queryRunner in the migration to delete the created table. Add a clause to create a new table only if there's no existing table with the same name in the database.\n\nSince the data fields keeps repeating in routes, controllers \u0026 entities for the tables, create constant variables t keep the changes to a singularity. Modify the routes, controller \u0026 entities with constant variables.\n\nCreate a authorController class to create author-based methods to execute the author-related function in the routes. Create a method to get all the authors, and filter the authors based on the input params.\n\nThe getAuthor method throws an exception to their request when unmatched. Create a global exception handler to resolve unnecessary exceptions to handle.\n\nImplement an offset pagination sequence, an database function, for the authors list in the author controller to get the fetched results in a page sequence. Implement the queryBuilder in author controller.\n\nAdd [multer](https://www.npmjs.com/package/multer), a node middleware for handling multipart/form-data, primarily used for uploading. The latest version has multiple discrepancies, unsuitable for mysql database. Add the depricated version@1.4.3\n\nCreate an upload middleware, which checks/create a storage location, encrpyts the filename, apply filters to the filetype and upload the image to the storage.\n\nCreate a author update controller function, with a validation dto for the update fields. Add the controller to the author `put` route to update the author instance, instead of `patch`\n\nCreate a controller function to delete a author row in the table. Create a corresponding route for delete method.\n\n## Running via Docker\n\nTo run Insight via Docker, set the `DB_HOST` environment variable to `\"mysql\"` in the `.env` file. Then run the following command: `docker compose up --build`\n\nhis will build and run the Docker container for the app and the MySQL database. You can then access the app at `http://localhost:3000`.\n\nMake sure that you have Docker installed on your machine before running this command. You can download Docker\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaurusilver7%2Finsight","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaurusilver7%2Finsight","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaurusilver7%2Finsight/lists"}