{"id":24510234,"url":"https://github.com/fokaaas/comments-system","last_synced_at":"2025-10-05T01:57:19.391Z","repository":{"id":223701332,"uuid":"758925515","full_name":"fokaaas/comments-system","owner":"fokaaas","description":"System for leaving comments with auth","archived":false,"fork":false,"pushed_at":"2024-02-21T14:42:21.000Z","size":659,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-15T09:30:07.372Z","etag":null,"topics":["api","auth","comments","docker","jwt"],"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/fokaaas.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}},"created_at":"2024-02-17T13:37:06.000Z","updated_at":"2024-03-19T16:40:20.000Z","dependencies_parsed_at":"2024-02-21T16:57:06.448Z","dependency_job_id":"f8e24ab0-4561-4991-bddf-00688fcacf2f","html_url":"https://github.com/fokaaas/comments-system","commit_stats":null,"previous_names":["fokaaas/comments-system"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fokaaas/comments-system","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fokaaas%2Fcomments-system","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fokaaas%2Fcomments-system/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fokaaas%2Fcomments-system/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fokaaas%2Fcomments-system/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fokaaas","download_url":"https://codeload.github.com/fokaaas/comments-system/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fokaaas%2Fcomments-system/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278399689,"owners_count":25980332,"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-04T02:00:05.491Z","response_time":63,"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":["api","auth","comments","docker","jwt"],"created_at":"2025-01-22T00:27:59.954Z","updated_at":"2025-10-05T01:57:19.349Z","avatar_url":"https://github.com/fokaaas.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Comments System\n\nThis application is powerful and scalable REST API for commenting.\n\nCheck out **Swagger Documentation**: https://comments-system-zlpi.onrender.com/api\n\n**Tech Stack**:\n- NestJS\n- PostgreSQL\n- Prisma ORM\n- JWT\n- Passport.js\n- Docker\n- Swagger\n\n## How to set up it locally?\n\nFirstly, clone this repo:\n\n```bash\ngit clone https://github.com/fokaaas/comments-system.git\n```\n\nThen install **pnpm** globally:\n\n```bash\nnpm install -g pnpm\n```\n\nInstall dependencies in project directory:\n\n```bash\npnpm install\n```\n\nCreate .env file with environment variables, that has this structure:\n\n```dotenv\nDATABASE_URL=\nPORT=\n\nSMTP_HOST=\nSMTP_USERNAME=\nSMTP_PASSWORD=\n\nSECRET=\nACCESS_TTL=\nREFRESH_TTL=\n\nFRONT_BASE_URL=\n```\n\nApply schema to your database:\n\n```bash\npnpm dlx prisma migrate\n```\n\nRun application:\n\n```bash\npnpm start:dev\n```\n\n## Database Schema\n\n```prisma\ngenerator client {\n  provider = \"prisma-client-js\"\n}\n\ndatasource db {\n  provider = \"postgresql\"\n  url      = env(\"DATABASE_URL\")\n}\n\nenum State {\n  PENDING\n  APPROVED\n  DECLINED\n}\n\nenum TokenType {\n  EMAIL\n  PASSWORD\n  REFRESH\n}\n\nenum FileType {\n  PICTURE\n  TXT\n}\n\nmodel User {\n  id                  String         @id @default(uuid())\n  username            String         @unique\n  email               String         @unique\n  password            String\n  avatar              String\n  state               State          @default(PENDING)\n  homepage            String?\n  lastPasswordUpdated DateTime       @default(now()) @map(\"last_password_updated\")\n  createdAt           DateTime       @default(now()) @map(\"created_at\")\n  tokens              Token[]\n  comments            Comment[]\n  savedComments       SavedComment[]\n\n  @@map(\"users\")\n}\n\nmodel Token {\n  value     String    @unique\n  user      User      @relation(fields: [userId], references: [id], onDelete: Cascade)\n  userId    String    @map(\"user_id\")\n  type      TokenType\n  createdAt DateTime  @default(now()) @map(\"created_at\")\n\n  @@map(\"tokens\")\n}\n\nmodel Comment {\n  id        String         @id @default(uuid())\n  user      User?          @relation(fields: [userId], references: [id], onDelete: SetNull)\n  userId    String?        @map(\"user_id\")\n  parentId  String?        @map(\"parent_id\")\n  parent    Comment?       @relation(\"CommentRelation\", fields: [parentId], references: [id], onDelete: Cascade)\n  responses Comment[]      @relation(\"CommentRelation\")\n  text      String\n  createdAt DateTime       @default(now()) @map(\"created_at\")\n  saves     SavedComment[]\n  files     File[]\n\n  @@map(\"comments\")\n}\n\nmodel File {\n  id        String   @id @default(uuid())\n  link      String\n  type      FileType\n  comment   Comment  @relation(fields: [commentId], references: [id], onDelete: Cascade)\n  commentId String   @map(\"comment_id\")\n\n  @@map(\"files\")\n}\n\nmodel SavedComment {\n  user      User     @relation(fields: [userId], references: [id], onDelete: Cascade)\n  userId    String   @map(\"user_id\")\n  comment   Comment  @relation(fields: [commentId], references: [id], onDelete: Cascade)\n  commentId String   @map(\"comment_id\")\n  createdAt DateTime @default(now()) @map(\"created_at\")\n\n  @@id([userId, commentId])\n  @@map(\"saved_comments\")\n}\n```\n\n## Auth Model\n\n![image](https://github.com/fokaaas/comments-system/assets/114052215/95b9c3ff-e1e6-43da-9816-39be8b3f9dcd)\n\n## File Saving \u0026 Storing\n\nAll files are stored locally on the server using a hash in their name. A certain type of file has its own static folders.\n\n**static/images** for images and **static/txt** for txt files\n\nYou can then access these files by following the link. (ex: http://127.0.0.1:3000/images/name.png or http://127.0.0.1:3000/txt/name.png)\n\nBut currently the **current host doesn't support it** because it's free.\n\n## Dockerization\n\nCheck out **Dockerfile** to create image.\nAlso project have **github workflows**.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffokaaas%2Fcomments-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffokaaas%2Fcomments-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffokaaas%2Fcomments-system/lists"}