Backend API for Yo using Nest framework (NodeJS + TypeScript + MySQL)
Yo is a Twitter Clone.
-
Generate Presigned URL
Backend provides a presigned S3 URL and object key for secure direct image upload. -
Upload Image
Frontend uses the URL to upload the image directly to S3 via a PUT request. -
Save Image Key
The S3 object key is saved in the database as the user's avatar reference. -
Access Avatar
The avatar can later be accessed using a signed URL generated by the backend.
-
Kafka Config Setup
Kafka broker and client settings are loaded viaConfigServiceand made globally available. Broker connects to multiple topics dynamically. -
Kafka Producer/Consumer Modules
Services use Kafka client to emit and consume events (e.g., user created). -
Microservice Communication
Kafka enables decoupled communication between services for handling async operations.
$ npm install# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:covcreate database yoodb;
create user yooadmin with password 'yoopass';
grant all privileges on database yoodb to yooadmin;-
auth-
POST /auth/login
-
-
users-
GET /users📃 -
GET /users/@{username} -
GET /users/{userid} -
POST /users -
PATCH /users/{userid}🔒 -
PUT /users/{userid}/follow🔒 -
DELETE /users/{userid}/follow🔒 -
GET /users/{userid}/followers📃 -
GET /users/{userid}/followees📃
-
-
posts-
GET /posts📃- filter by author
- filter by replyTo
- filter by origPosts
- full-text-search on post content
-
GET /posts/{postid} -
POST /posts🔒- simple posts
- reply to a post
- repost / quote post
- #hashtags
- @mentions
-
DELETE /posts/{postid}🔒 -
PUT /posts/{postid}/like🔒 -
DELETE /posts/{postid}/like🔒
-
-
hashtags-
GET /hashtags📃 -
GET /hashtags/{tag}/posts📃
-