{"id":20535041,"url":"https://github.com/mmallikarjun2312/twitter_clone","last_synced_at":"2026-04-06T09:32:27.877Z","repository":{"id":236495848,"uuid":"792722414","full_name":"MMALLIKARJUN2312/Twitter_Clone","owner":"MMALLIKARJUN2312","description":"Twitter_Clone_ExpressJs_Application created using NodeJS, ExpressJS , SQLite in this API's Authenticated users can only perform CRUD operation's in Database. JWT Tokens are used for verification and only he can perform CRUD operations on the database. Middleware functions are used to authenticate if it's a Valid User.","archived":false,"fork":false,"pushed_at":"2024-04-27T11:49:18.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-03T13:42:40.538Z","etag":null,"topics":["apis","authentication-middleware","bcrypt-hashing-library","crud-api","databases","express-js","javascript","middleware","node-js","sqlite3","token-based-authentication","twitter-clone"],"latest_commit_sha":null,"homepage":"","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/MMALLIKARJUN2312.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-27T11:43:32.000Z","updated_at":"2024-04-27T14:50:33.000Z","dependencies_parsed_at":"2024-04-27T12:45:30.701Z","dependency_job_id":null,"html_url":"https://github.com/MMALLIKARJUN2312/Twitter_Clone","commit_stats":null,"previous_names":["mmallikarjun2312/twitter_clone"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MMALLIKARJUN2312/Twitter_Clone","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MMALLIKARJUN2312%2FTwitter_Clone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MMALLIKARJUN2312%2FTwitter_Clone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MMALLIKARJUN2312%2FTwitter_Clone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MMALLIKARJUN2312%2FTwitter_Clone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MMALLIKARJUN2312","download_url":"https://codeload.github.com/MMALLIKARJUN2312/Twitter_Clone/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MMALLIKARJUN2312%2FTwitter_Clone/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31466613,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-06T08:36:52.050Z","status":"ssl_error","status_checked_at":"2026-04-06T08:36:51.267Z","response_time":112,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["apis","authentication-middleware","bcrypt-hashing-library","crud-api","databases","express-js","javascript","middleware","node-js","sqlite3","token-based-authentication","twitter-clone"],"created_at":"2024-11-16T00:29:06.912Z","updated_at":"2026-04-06T09:32:27.861Z","avatar_url":"https://github.com/MMALLIKARJUN2312.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Twitter\n\nGiven an `app.js` file and a database file `twitterClone.db` consisting of five tables `user`, `follower`, `tweet`, `reply`, and `like`.\n\nWrite APIs to perform operations on the tables `user`, `follower`, `tweet`, `reply`, and `like` containing the following columns,\n\n**User Table**\n\n| Column   | Type    |\n| -------- | ------- |\n| user_id  | INTEGER |\n| name     | TEXT    |\n| username | TEXT    |\n| password | TEXT    |\n| gender   | TEXT    |\n\n**Follower Table**\n\n| Column              | Type    |\n| ------------------- | ------- |\n| `follower_id`       | INTEGER |\n| `follower_user_id`  | INTEGER |\n| `following_user_id` | INTEGER |\n\nHere, if user1 follows user2 then,\n\n`follower_user_id` is the user ID of user1 and `following_user_id` is the user ID of user2.\n\n**Tweet Table**\n\n| Column    | Type     |\n| --------- | -------- |\n| tweet_id  | INTEGER  |\n| tweet     | TEXT     |\n| user_id   | INTEGER  |\n| date_time | DATETIME |\n\n**Reply Table**\n\n| Column    | Type     |\n| --------- | -------- |\n| reply_id  | INTEGER  |\n| tweet_id  | INTEGER  |\n| reply     | TEXT     |\n| user_id   | INTEGER  |\n| date_time | DATETIME |\n\n**Like Table**\n\n| Column    | Type     |\n| --------- | -------- |\n| like_id   | INTEGER  |\n| tweet_id  | INTEGER  |\n| user_id   | INTEGER  |\n| date_time | DATETIME |\n\n#### Sample Valid User Credentials\n\n```\n{\n  \"username\":\"JoeBiden\",\n  \"password\":\"biden@123\"\n}\n```\n\n\u003cSection id=\"section1\" \u003e\n\n### API 1\n\n#### Path: `/register/`\n\n#### Method: `POST`\n\n**Request**\n\n```\n{\n  \"username\": \"adam_richard\",\n  \"password\": \"richard_567\",\n  \"name\": \"Adam Richard\",\n  \"gender\": \"male\"\n}\n```\n\n- **Scenario 1**\n\n  - **Description**:\n\n    If the username already exists\n\n  - **Response**\n    - **Status code**\n      ```\n      400\n      ```\n    - **Body**\n      ```\n      User already exists\n      ```\n\n- **Scenario 2**\n\n  - **Description**:\n\n    If the registrant provides a password with less than 6 characters\n\n  - **Response**\n    - **Status code**\n      ```\n      400\n      ```\n    - **Body**\n      ```\n      Password is too short\n      ```\n\n- **Scenario 3**\n\n  - **Description**:\n\n    Successful registration of the registrant\n\n  - **Response**\n\n    - **Status code**\n\n      ```\n      200\n      ```\n\n    - **Body**\n      ```\n      User created successfully\n      ```\n\n\u003c/Section\u003e\n\n\u003cSection id=\"section2\"\u003e\n\n### API 2\n\n#### Path: `/login/`\n\n#### Method: `POST`\n\n**Request**\n\n```\n{\n  \"username\":\"JoeBiden\",\n  \"password\":\"biden@123\"\n}\n```\n\n- **Scenario 1**\n\n  - **Description**:\n\n    If the user doesn't have a Twitter account\n\n  - **Response**\n    - **Status code**\n      ```\n      400\n      ```\n    - **Body**\n      ```\n      Invalid user\n      ```\n\n- **Scenario 2**\n\n  - **Description**:\n\n    If the user provides an incorrect password\n\n  - **Response**\n    - **Status code**\n      ```\n      400\n      ```\n    - **Body**\n      ```\n      Invalid password\n      ```\n\n- **Scenario 3**\n\n  - **Description**:\n\n    Successful login of the user\n\n  - **Response**\n\n    Return the JWT Token\n\n    ```\n    {\n      \"jwtToken\": \"ak2284ns8Di32......\"\n    }\n    ```\n\n\u003c/Section\u003e\n\n\u003cSection id=\"authToken\"\u003e\n\n### Authentication with JWT Token\n\nWrite a middleware to authenticate the JWT token.\n\n- **Scenario 1**\n\n  - **Description**:\n\n    If the JWT token is not provided by the user or an invalid JWT token is provided\n\n  - **Response**\n    - **Status code**\n      ```\n      401\n      ```\n    - **Body**\n      ```\n      Invalid JWT Token\n      ```\n\n- **Scenario 2**\n  - After successful verification of JWT token, proceed to next middleware or handler\n\n\u003c/Section\u003e\n\n\u003cSection id=\"section3\"\u003e\n\n### API 3\n\n#### Path: `/user/tweets/feed/`\n\n#### Method: `GET`\n\n#### Description:\n\nReturns the latest tweets of people whom the user follows. Return 4 tweets at a time\n\n#### Response\n\n```\n [\n   {\n      username: \"SrBachchan\",\n      tweet: \"T 3859 - do something wonderful, people may imitate it ..\",\n      dateTime: \"2021-04-07 14:50:19\"\n   },\n   ...\n ]\n```\n\n\u003c/Section\u003e\n\n\u003cSection id=\"section4\"\u003e\n\n### API 4\n\n#### Path: `/user/following/`\n\n#### Method: `GET`\n\n#### Description:\n\nReturns the list of all names of people whom the user follows\n\n#### Response\n\n```\n[\n  {\n    \"name\": \"Narendra Modi\"\n  },\n  ...\n]\n```\n\n\u003c/Section\u003e\n\n\u003cSection id=\"section5\"\u003e\n\n### API 5\n\n#### Path: `/user/followers/`\n\n#### Method: `GET`\n\n#### Description:\n\nReturns the list of all names of people who follows the user\n\n#### Response\n\n```\n[\n  {\n    \"name\": \"Narendra Modi\"\n  },\n  ...\n]\n```\n\n\u003c/Section\u003e\n\n\u003cSection id=\"section6\"\u003e\n\n### API 6\n\n#### Path: `/tweets/:tweetId/`\n\n#### Method: `GET`\n\n- **Scenario 1**\n\n  - **Description**:\n\n    If the user requests a tweet other than the users he is following\n\n  - **Response**\n    - **Status code**\n      ```\n      401\n      ```\n    - **Body**\n      ```\n      Invalid Request\n      ```\n\n- **Scenario 2**\n\n  - **Description**:\n\n    If the user requests a tweet of the user he is following, return the tweet, likes count, replies count and date-time\n\n  - **Response**\n    ```\n    {\n       \"tweet\": \"T 3859 - do something wonderful, people may imitate it ..\",\n       \"likes\": 3,\n       \"replies\": 1,\n       \"dateTime\": \"2021-04-07 14:50:19\"\n    }\n    ```\n\n\u003c/Section\u003e\n\n\u003cSection id=\"section7\"\u003e\n\n### API 7\n\n#### Path: `/tweets/:tweetId/likes/`\n\n#### Method: `GET`\n\n- **Scenario 1**\n\n  - **Description**:\n\n    If the user requests a tweet other than the users he is following\n\n  - **Response**\n    - **Status code**\n      ```\n      401\n      ```\n    - **Body**\n      ```\n      Invalid Request\n      ```\n\n- **Scenario 2**\n\n  - **Description**:\n\n    If the user requests a tweet of a user he is following, return the list of usernames who liked the tweet\n\n  - **Response**\n    ```\n    {\n       \"likes\": [\"albert\", ]\n    }\n    ```\n\n\u003c/Section\u003e\n\n\u003cSection id=\"section8\"\u003e\n\n### API 8\n\n#### Path: `/tweets/:tweetId/replies/`\n\n#### Method: `GET`\n\n- **Scenario 1**\n\n  - **Description**:\n\n    If the user requests a tweet other than the users he is following\n\n  - **Response**\n    - **Status code**\n      ```\n      401\n      ```\n    - **Body**\n      ```\n      Invalid Request\n      ```\n\n- **Scenario 2**\n\n  - **Description**:\n\n    If the user requests a tweet of a user he is following, return the list of replies.\n\n  - **Response**\n\n        ```\n        {\n           \"replies\": [\n             {\n               \"name\": \"Narendra Modi\",\n               \"reply\": \"When you see it..\"\n              },\n            ...]\n        }\n        ```\n\n    \u003c/Section\u003e\n\n\u003cSection id=\"section9\"\u003e\n\n### API 9\n\n#### Path: `/user/tweets/`\n\n#### Method: `GET`\n\n#### Description:\n\nReturns a list of all tweets of the user\n\n#### Response\n\n```\n[\n  {\n    \"tweet\": \"Ready to don the Blue and Gold\",\n    \"likes\": 3,\n    \"replies\": 4,\n    \"dateTime\": \"2021-4-3 08:32:44\"\n  },\n  ...\n]\n```\n\n\u003c/Section\u003e\n\n\u003cSection id=\"section10\"\u003e\n\n### API 10\n\n#### Path: `/user/tweets/`\n\n#### Method: `POST`\n\n#### Description:\n\nCreate a tweet in the tweet table\n\n#### Request\n\n```\n{\n   \"tweet\": \"The Mornings...\"\n}\n```\n\n#### Response\n\n```\nCreated a Tweet\n```\n\n\u003c/Section\u003e\n\n\u003cSection id=\"section11\"\u003e\n\n### API 11\n\n#### Path: `/tweets/:tweetId/`\n\n#### Method: `DELETE`\n\n- **Scenario 1**\n\n  - **Description**:\n\n    If the user requests to delete a tweet of other users\n\n  - **Response**\n    - **Status code**\n      ```\n      401\n      ```\n    - **Body**\n      ```\n      Invalid Request\n      ```\n\n- **Scenario 2**\n\n  - **Description**:\n\n    If the user deletes his tweet\n\n  - **Response**\n    ```\n    Tweet Removed\n    ```\n\n\u003c/Section\u003e\n\n\u003cbr/\u003e\n\nUse `npm install` to install the packages.\n\n**Export the express instance using the default export syntax.**\n\n**Use Common JS module syntax.**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmallikarjun2312%2Ftwitter_clone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmmallikarjun2312%2Ftwitter_clone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmallikarjun2312%2Ftwitter_clone/lists"}