{"id":16112540,"url":"https://github.com/abdulsametileri/personal-code-search-nextjs","last_synced_at":"2025-08-22T05:38:35.571Z","repository":{"id":81890211,"uuid":"363067754","full_name":"Abdulsametileri/personal-code-search-nextjs","owner":"Abdulsametileri","description":"Categorize all your favorite code snippets and search them with predefined tags on your own.","archived":false,"fork":false,"pushed_at":"2022-03-12T06:03:44.000Z","size":412,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-02T14:03:27.600Z","etag":null,"topics":["firebase","firebase-auth","gmail","heroku","mongodb","mongoose","nextjs","s3","snippets-collection"],"latest_commit_sha":null,"homepage":"https://personal-code-search.herokuapp.com/","language":"JavaScript","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/Abdulsametileri.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":"2021-04-30T07:52:45.000Z","updated_at":"2023-09-08T18:21:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"004c4773-9998-41cf-8059-6e880eb2f81d","html_url":"https://github.com/Abdulsametileri/personal-code-search-nextjs","commit_stats":{"total_commits":35,"total_committers":2,"mean_commits":17.5,"dds":0.05714285714285716,"last_synced_commit":"6ce1b4c831ccaf3c78c0a346bfb6472c1ab30afa"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Abdulsametileri/personal-code-search-nextjs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abdulsametileri%2Fpersonal-code-search-nextjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abdulsametileri%2Fpersonal-code-search-nextjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abdulsametileri%2Fpersonal-code-search-nextjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abdulsametileri%2Fpersonal-code-search-nextjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Abdulsametileri","download_url":"https://codeload.github.com/Abdulsametileri/personal-code-search-nextjs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abdulsametileri%2Fpersonal-code-search-nextjs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271592497,"owners_count":24786597,"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-08-22T02:00:08.480Z","response_time":65,"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":["firebase","firebase-auth","gmail","heroku","mongodb","mongoose","nextjs","s3","snippets-collection"],"created_at":"2024-10-09T20:08:20.345Z","updated_at":"2025-08-22T05:38:35.549Z","avatar_url":"https://github.com/Abdulsametileri.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Motivation\n\nIf you are preparing tech interviews you should solve the algorithm problems in \nhackerrank, leetcode and so on (what platform you prefer). Some questions and solutions \ngives you really good point. Also you may learn new things to use by looking the other \nsolutions. Sometimes you want to remember the code snippets seen before. \n\n**This project may give you a solution.**\n\n### Tech Stack\n\n- Next js\n- Firebase Authentication (Gmail)\n- Heroku\n- MongoDB Atlas (Mongoose for ORM)\n- Amazon S3 (via CloudFront)\n\n### Demo\n\nAll snippets in the site uploaded by me. Possibly you don't interested in.\nSo you can fork the project build on your own.\n\n[Demo](https://personal-code-search.herokuapp.com)\n\nYou can search `bitwise`, `tree` or `sql` for see filtering functionality.\n\nCode snippets is displayed `perPage = 5` as default. \nYou can use pagination functionality at the bottom of the page.\n\n**You cannot add the code snippet with `Add Code Snippets` link because \nyou don't have authentication. This is just a demo for you.** \n\n`Add Code Snippets` is a basic post page. This is what its look like.\n![](images/addCodeSnippet.png)\n\n### Build on your own\n\nYou can follow to `.env.example` set your own credentials.\n\n``` \nPCS_AWS_ACCESS_KEY=\nPCS_AWS_SECRET_KEY=\nPCS_AWS_REGION=\nPCS_AWS_BUCKET_NAME=\n\nMONGODB_USER_NAME=\nMONGODB_PASSWORD=\nMONGODB_DATABASE=\n\nPCS_MONGODB_URI=mongodb+srv://$MONGODB_USER_NAME:$MONGODB_PASSWORD@cluster0.jew2r.mongodb.net/$MONGODB_DATABASE?retryWrites=true\u0026w=majority\n\nNEXT_PUBLIC_FIREBASE_API_KEY=\nNEXT_PUBLIC_FIREBASE_PROJECT_ID=\nNEXT_PUBLIC_FIREBASE_SENDER_ID=\nNEXT_PUBLIC_FIREBASE_APP_ID=\n\n# Allowed email list for the google authentication\n# You must split with ',' like email@gmail.com,email2@gmail.com\nNEXT_PUBLIC_ALLOW_EMAILS=\n```\n\nMeaning of `PCS_` prefix is abbrevation of Personal Code Search.\n\n### Model\n\n```javascript\nconst CodeSchema = new mongoose.Schema({\n  imageUrl: {\n    /* The snippet image url of the specified code in s3 */\n    type: String,\n  },\n  rawText: {\n    /* The snippet raw text of the specified code */\n    type: String,\n  },\n  tag: {\n    /* Snippet tag for searching purposes */\n    type: String,\n    required: [true, 'Tag can\\'t be empty']\n  },\n  description: {\n    /* Snippet description to understand better */\n    type: String,\n  },\n})\n\nexport default mongoose.models['Code'] || mongoose.model('Code', CodeSchema);\n```\n\nThe main idea of \nthe `tag` field is searching and \nthe `description` field is to provide better understanding \nfor the snippet.\n\nIf you want to upload the code as `rawText` not the image you can leave blank the\n`imageUrl` and fill `rawText`.\n\nYou can look the paginaton and filtering at pages/api/paginateCodeSnippets.js\n\n``` javascript\nlet filter = {}\n\nif (keyword !== \"\") {\n  const rgx = (pattern) =\u003e new RegExp(`.*${pattern}.*`);\n  const searchRgx = rgx(keyword);\n  filter = {\n    $or: [\n      {tag: {$regex: searchRgx, $options: \"i\"}},\n      {description: {$regex: searchRgx, $options: \"i\"}},\n    ],\n  }\n}\n\nconst codeSnippets = await Code.find(filter)\n  .skip((curPage - 1) * perPage)\n  .limit(perPage)\n  .sort({\"_id\": -1})\n```\n\nRun continiously\n```sleep\nfor i in {1..100}; do echo $i \u0026\u0026 curl \"https://personal-code-search.herokuapp.com/\" \u003e\u003e /tmp/output.log \u0026\u0026 sleep 300; done\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabdulsametileri%2Fpersonal-code-search-nextjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabdulsametileri%2Fpersonal-code-search-nextjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabdulsametileri%2Fpersonal-code-search-nextjs/lists"}