{"id":19596272,"url":"https://github.com/peroxy/pokemon-catch-guide-api","last_synced_at":"2025-07-10T15:34:02.558Z","repository":{"id":124135408,"uuid":"416378649","full_name":"peroxy/pokemon-catch-guide-api","owner":"peroxy","description":"API for the Pokemon Catching Guide website","archived":false,"fork":false,"pushed_at":"2023-06-30T20:08:43.000Z","size":2629,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-26T14:45:57.483Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/peroxy.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":"2021-10-12T14:50:01.000Z","updated_at":"2021-10-31T17:27:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"bc243c91-1451-4063-968c-97644b422938","html_url":"https://github.com/peroxy/pokemon-catch-guide-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/peroxy/pokemon-catch-guide-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peroxy%2Fpokemon-catch-guide-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peroxy%2Fpokemon-catch-guide-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peroxy%2Fpokemon-catch-guide-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peroxy%2Fpokemon-catch-guide-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peroxy","download_url":"https://codeload.github.com/peroxy/pokemon-catch-guide-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peroxy%2Fpokemon-catch-guide-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264599469,"owners_count":23635304,"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-11-11T08:52:38.447Z","updated_at":"2025-07-10T15:34:02.081Z","avatar_url":"https://github.com/peroxy.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pokemon Catching Guide API\n\nPokemon Catching Guide API is a simple REST API built with NodeJS and Express.\n\nIt is used by the frontend website located in the repository [Pokemon Catching Guide Website](https://github.com/peroxy/pokemon-catch-guide-website).\n\nIt serves data generated by the CSV encounter generator ([Pokemon Catch Guide](https://github.com/peroxy/pokemon-catch-guide)). \nThe CSV files are parsed and inserted into a local Sqlite database for easier usage.\n\n## Installation\n\nUse the package manager [npm](https://www.npmjs.com/) to install the API.\n\n```shell\ncd pokemon-catch-guide-api\nnpm install\n```\n\n## Usage\n\nPlease look at the `package.json` scripts section to run a specific script:\n\n```json\n\"scripts\": {\n    \"build\": \"tsc\",\n    \"prestart\": \"npm run build\",\n    \"start\": \"node .\",\n    \"live-reload\": \"nodemon src/app.ts\",\n    \"insert-from-csv-to-database\": \"ts-node ./src/db/csv_data/csv_inserter.ts\"\n  }\n```\n\n- Run the REST API:\n    ```shell\n    npm run start\n    ```\n- Run the REST API with live reload:\n    ```shell\n    npm run live-reload\n    ```\n- Run CSV inserter (inserts CSV data into local sqlite database):\n    ```shell\n    npm run insert-from-csv-to-datbase\n    ```\n  \n### API\n\nThe API runs on port 8080 if environment variable `SERVER_PORT` is not specified.\n\nEvery API route requires a bearer token to be specified in the `Authorization` header. \nFor example, if your `NODE_ENV` environment variable is set to `development` you may use the default token `pokemon`:\n- HTTP Header: `Authorization: Bearer pokemon` \n\nOn `production` environment you will have to specify an environment variable `API_SECRET_HASH` that represents your bcrypt hashed secret. \n\n## Deployment\n```shell\n# ssh into server\n\n# install letsencrypt certificate\nsudo snap install core; sudo snap refresh core\nsudo snap install --classic certbot\nsudo ln -s /snap/bin/certbot /usr/bin/certbot\nsudo certbot certonly --standalone\n# check if renewal works \nsudo certbot renew --dry-run\n\n# update api.conf and docker-compose.yml with correct /etc/letsencrypt path and domain\n\nmkdir pokemon-catch-guide \u0026\u0026 cd pokemon-catch-guide \nwget https://raw.githubusercontent.com/peroxy/pokemon-catch-guide-api/master/docker-compose.yml\nwget https://raw.githubusercontent.com/peroxy/pokemon-catch-guide-api/master/src/db/pokemon.db\nwget https://raw.githubusercontent.com/peroxy/pokemon-catch-guide-api/master/nginx/conf.d/api.conf -O ./nginx/conf.d/api.conf\n\n# create .env file\ntouch .env \u0026\u0026 nano .env \n# insert API_SECRET_HASH='bcrypt encrypted hash' \u003c very important that you take the password and then encrypt it with bcrypt, needs to be the hash!\n\ndocker-compose up -d  \n```\n\n### Troubleshooting \n\n#### PEM_read_bio_X509_AUX() failed (SSL: error:0909006C:PEM routines:get_name:no start line:Expecting: TRUSTED CERTIFICATE)\n\nIf nginx exits and logs this error the docker volume isn't working correctly - but it's probably just docker service being stupid. \n**Restart the server** - docker-compose.yml is 100% correct.\n\n## Contributing\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\n## License\n[Apache License 2.0](http://www.apache.org/licenses/)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperoxy%2Fpokemon-catch-guide-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fperoxy%2Fpokemon-catch-guide-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fperoxy%2Fpokemon-catch-guide-api/lists"}