{"id":15190480,"url":"https://github.com/thund3rhawk/auth_api","last_synced_at":"2026-01-22T11:31:53.713Z","repository":{"id":234584889,"uuid":"788487808","full_name":"Thund3rHawk/Auth_API","owner":"Thund3rHawk","description":"Auth API: Register users with email/password, validate via OTP, store data, login with JWT, retrieve user info securely.","archived":false,"fork":false,"pushed_at":"2024-05-05T16:56:09.000Z","size":101,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-16T02:22:26.452Z","etag":null,"topics":["becrypt","dotenv","expressjs","jsonwebtoken","mongodb","mongoosejs","nodejs","nodemailer","prettier","typescript"],"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/Thund3rHawk.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-04-18T14:09:06.000Z","updated_at":"2024-05-21T09:15:33.000Z","dependencies_parsed_at":"2024-04-19T23:26:32.128Z","dependency_job_id":"991a799e-0965-4827-8f79-9cfe6d147be9","html_url":"https://github.com/Thund3rHawk/Auth_API","commit_stats":null,"previous_names":["swadhin2001/monter-assignment","swadhin2001/auth_api","thund3rhawk/auth_api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thund3rHawk%2FAuth_API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thund3rHawk%2FAuth_API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thund3rHawk%2FAuth_API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Thund3rHawk%2FAuth_API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Thund3rHawk","download_url":"https://codeload.github.com/Thund3rHawk/Auth_API/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248576391,"owners_count":21127384,"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":["becrypt","dotenv","expressjs","jsonwebtoken","mongodb","mongoosejs","nodejs","nodemailer","prettier","typescript"],"created_at":"2024-09-27T20:40:15.051Z","updated_at":"2026-01-22T11:31:53.705Z","avatar_url":"https://github.com/Thund3rHawk.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Auth_API Documentation\r\n\r\nRegister users with email/password, validate via OTP, store data, login with JWT, retrieve user info securely.\r\n\r\n## Folder Structure\r\n\r\n```\r\n.\r\n├── src --------- Source code root\r\n│   ├── controllers --------- Route specific application logic.\r\n│   │   ├──info.controller.ts\r\n│   │   ├──login.controller.ts\r\n│   │   ├──signup.controller.ts\r\n│   │   ├──user.controller.ts\r\n│   │   └──verify.controller.ts\r\n│   ├── db --------- Reusable components related to database\r\n│   │   └──index.ts\r\n│   ├── routes --------- Reusable components for routing\r\n│   │   └──index.ts\r\n│   ├── schema --------- Reusable components related to data schema definitions\r\n│   │   └──user.model.ts\r\n│   ├── utils --------- Global utility functions\r\n│   │   ├── asyncHandler.ts ------ Utility functions for handling asynchronous operations.\r\n│   │   ├── nodemailerConfig.ts ------ Configuration settings for nodemailer\r\n│   │   └── verifyToken.ts --- Function for verifying tokens\r\n│   └index.ts\r\n├── .env\r\n├── package.json\r\n├── README.md\r\n└── tsconfig.json ----- TypeScript configuration file\r\n```\r\n\r\n### 1. User Registration\r\n\r\n#### Endpoint:\r\n```\r\nPOST /signup\r\n```\r\n\r\n#### Description:\r\nAllows users to register on the website using their email and password.\r\n\r\n#### Request Body:\r\n```json\r\n{\r\n  \"email\": \"user@example.com\",\r\n  \"password\": \"password123\"\r\n}\r\n```\r\n\r\n#### Response:\r\n- `200 OK`: User registered successfully.\r\n- `400 Bad Request`: Invalid request or user already exists.\r\n\r\n---\r\n\r\n### 2. Email Verification\r\n\r\n#### Endpoint:\r\n```\r\nPOST /verify\r\n```\r\n\r\n#### Description:\r\nSends an OTP (One-Time Password) to the user's email for account validation.\r\n\r\n#### Request Body:\r\n```json\r\n{\r\n  \"email\": \"user@example.com\",\r\n  \"otp\": \"123456\"\r\n}\r\n```\r\n\r\n#### Response:\r\n- `200 OK`: User Verified.\r\n- `400 Bad Request`: Invalid request or user not found.\r\n\r\n---\r\n\r\n### 3. User Information Update\r\n\r\n#### Endpoint:\r\n```\r\nPOST /info\r\n```\r\n\r\n#### Description:\r\nAllows users to validate their account using the OTP received and update additional information like location, age, and work details.\r\n\r\n#### Request Body:\r\n```json\r\n{\r\n  \"email\": \"user@example.com\",\r\n  \"location\": \"New York\",\r\n  \"work_details\": \"Software Engineer\"\r\n}\r\n```\r\n\r\n#### Response:\r\n- `200 OK`: User details added successfully.\r\n- `400 Bad Request`: Invalid request or user not found.\r\n\r\n---\r\n\r\n### 4. User Login and JWT Token Generation\r\n\r\n#### Endpoint:\r\n```\r\nPOST /login\r\n```\r\n\r\n#### Description:\r\nAllows users to log in using their email and password and generates a JWT (JSON Web Token) for authentication.\r\n\r\n#### Request Body:\r\n```json\r\n{\r\n  \"email\": \"user@example.com\",\r\n  \"password\": \"password123\"\r\n}\r\n```\r\n\r\n#### Response:\r\n- `200 OK`: Login successful. JWT token generated.\r\n- `401 Unauthorized`: Invalid email or password.\r\n\r\n---\r\n\r\n### 5. Retrieve User Information\r\n\r\n#### Endpoint:\r\n```\r\nGET /user\r\n```\r\n\r\n#### Description:\r\nRetrieves all information of the logged-in user using the JWT token.\r\n\r\n#### Request Header:\r\n```\r\nAuthorization: Bearer \u003cJWT token\u003e\r\n```\r\n\r\n#### Response:\r\n- `200 OK`: User information retrieved successfully.\r\n- `401 Unauthorized`: Invalid or expired JWT token.\r\n\r\n---\r\n\r\nThese are the endpoints provided by the Auth API for user registration, validation, login, and information retrieval. Please make sure to include appropriate error handling and security measures in the implementation.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthund3rhawk%2Fauth_api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthund3rhawk%2Fauth_api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthund3rhawk%2Fauth_api/lists"}