A RESTful API for a social network application similar to Twitter, built with Node.js, TypeScript, Fastify, and MongoDB. This API supports user authentication, posts, timelines, lists, bookmarks, favourites, follows, mutes, blocks, and more.
- User Authentication: Sign up, sign in, JWT-based authentication, refresh/revoke tokens, password reset, email verification.
- Posts: Create, update, delete, reply, quote, repeat, vote, attach media, polls, hashtags, mentions, and location.
- Timeline & Activity: Personalized timeline, activity feed, top posts, hashtag search, and nearby posts.
- Lists: Create, update, delete lists, add/remove members, fetch list posts and members.
- Bookmarks & Favourites: Bookmark and favourite posts.
- Follows & Requests: Follow/unfollow users, handle follow requests for protected accounts.
- Mutes & Blocks: Mute/block users, posts, and words; manage muted/blocked lists.
- User Settings: Manage timeline, activity, profile, and UI settings.
- Swagger/OpenAPI: API documentation available at
/swagger(in non-production). - File Uploads: Media uploads (images/videos) via Cloudinary.
- Node.js + TypeScript
- Fastify (web framework)
- MongoDB with Mongoose (ODM)
- Cloudinary (media storage)
- JWT (authentication)
- Formzilla (file uploads)
- Swagger (API docs)
- Node.js (v18+ recommended)
- MongoDB instance
- Cloudinary account (for media uploads)
-
Clone the repository:
git clone <repo-url> cd quip-api-v2
-
Install dependencies:
npm install
-
Configure environment variables:
-
Copy
environment.configto.envand fill in the required values:NODE_ENV=development DB_CONNECTION=mongodb://localhost:27017/quip JWT_AUTH_SECRET=your_jwt_auth_secret JWT_REFRESH_SECRET=your_jwt_refresh_secret ALLOW_ORIGINS=http://localhost:3000; CLOUD_BUCKET=your_cloudinary_cloud_name CLOUD_API_KEY=your_cloudinary_api_key CLOUD_API_SECRET=your_cloudinary_api_secret SMTP_HOST=your_smtp_host SMTP_PORT=your_smtp_port SMTP_USER=your_smtp_user SMTP_KEY=your_smtp_key
-
-
Development:
npm run dev
-
Production:
npm run build npm start
- Swagger UI is available at
/swaggerwhen not in production mode.
POST /auth/sign-up— Register a new userPOST /auth/sign-in— LoginPOST /auth/refresh-token— Refresh JWTGET /auth/revoke-token/:token— Revoke refresh token
GET /users/:handle— Get user profileGET /users/:handle/posts— User's postsGET /users/:handle/followers— FollowersGET /users/:handle/following— FollowingGET /users/:handle/favourites— FavouritesGET /users/:handle/bookmarks— BookmarksGET /users/:handle/mentions— MentionsGET /users/:handle/topmost/:period?— Top postsGET /users/follow/:handle— Follow userGET /users/unfollow/:handle— Unfollow userGET /users/block/:handle— Block userGET /users/unblock/:handle— Unblock userGET /users/mute/:handle— Mute userGET /users/unmute/:handle— Unmute user
POST /posts/create— Create postPOST /posts/update/:postId— Update postDELETE /posts/delete/:postId— Delete postPOST /posts/quote/:postId— Quote postPOST /posts/reply/:postId— Reply to postGET /posts/:postId— Get postGET /posts/:postId/quotes— Get quotesGET /posts/:postId/replies— Get repliesGET /posts/:postId/parent— Get parent postGET /posts/favourite/:postId— Favourite postGET /posts/unfavourite/:postId— Unfavourite postGET /posts/bookmark/:postId— Bookmark postGET /posts/unbookmark/:postId— Unbookmark postGET /posts/repeat/:postId— Repeat postGET /posts/unrepeat/:postId— Unrepeat postGET /posts/mute/:postId— Mute postGET /posts/unmute/:postId— Unmute postGET /posts/vote/:postId— Vote on poll
GET /lists/— Get user listsPOST /lists/create— Create listPOST /lists/update— Update listDELETE /lists/delete/:name— Delete listPOST /lists/add-member— Add memberPOST /lists/remove-member— Remove memberGET /lists/:name/members— List membersGET /lists/:name/posts— List posts
GET /timeline— User timelineGET /activity/:period?— User activityGET /topmost/:period?— Top postsGET /hashtag/:name— Posts by hashtagGET /search/posts— Search postsGET /search/users— Search usersGET /search/nearby— Search nearby posts
GET /settings/— Get user settingsPOST /settings/— Update user settingsPOST /settings/mute— Mute wordPOST /settings/unmute— Unmute wordGET /settings/blocked— Blocked usersGET /settings/muted/users— Muted usersGET /settings/muted/posts— Muted postsGET /settings/muted/words— Muted wordsGET /settings/pin/{postId}— Pin postGET /settings/unpin— Unpin postPOST /settings/update-email— Update emailPOST /settings/change-password— Change passwordGET /settings/deactivate— Deactivate accountGET /settings/activate— Activate accountDELETE /settings/delete— Delete account
This project is licensed under the ISC License.
For more details, see the source code and the /swagger endpoint for live API documentation.