This project is of DevChallenge-Twitter-Clone
NOTE: This repository is an example to explain 'how to implement DDD architecture on a Typescritps web application'. If you will to use this as a reference, add your implementation of authentication and security before deploying to the real world!!
Directory structure based on Domain driver design
.
├── src
│ ├── user
│ │ ├── application
│ │ ├── domain
│ │ └── infrastructure
│ ├── tweet
│ │ ├── application
│ │ ├── domain
│ │ └── infrastructure
│ ├── reply
│ │ ├── application
│ │ ├── domain
│ │ └── infrastructure
│ └── shared
│ ├── application
│ ├── domain
│ └── infrastructure
├── app.ts
├── containers.ts
├── index.ts
├── types.ts
└── test
To represent an User Model
export class UserModel {
constructor(
public readonly id: UuidVO,
public username: UsernameVO,
public email: EmailVO,
public password: PasswordVO,
) { }
}
To represent a Value Object UuidVO
.
export class UuidVO extends ValueObject<string> {
public assertIsValid(value: string): void {
if (!validate(value)) {
throw new VOFormatException(UuidVO.name, value)
}
}
public equals(valueObject: UuidVO) {
return this.value === valueObject.value
}
}
- Clone the repository:
git clone https://github.com/Joeldev1021/Tweeter-backend.git
- Install dependencies ⛏️
npm install
- Environments .env :
PORT=3500
JWT_SECRET_KEY='YOU_SECRET_KEY'
MONGODB_HOSTNAME='localhost'
MONGODB_PORT='27017'
MONGODB_USER='root'
MONGODB_PASSWORD='root'
MONGODB_DATABASE_NAME='name'
MONGODB_URI=mongodb://root:root@localhost:27017/name?authSource=admin
- Docker componse:
npm run docker:up
npm run docker:down
- Run Backend 🔥 :
npm run dev
-
User story: I can see my profile or others' profile
-
User story: When I am on a profile, I can see Tweets and Retweets. I can also filter by Tweets, Tweets and replies, Media and Likes
-
User story: When I am on a profile, I can see followers and following
-
User story: When I am on a profile, I can see follow or unfollow the user
-
User story: I can navigate between Home, Explore and Bookmarks
-
User story: I can navigate to My Profile, Group Chat (optional), Setting/Authentication App.
-
User story: When I am on Home, I can post a new Tweet
-
User story: When I post a new Tweet, I can choose to upload an image and set the Tweet to be public or only-follower
-
User story: When I am on Home, I can see Tweets of people who I follow
-
User story: I can Comment, Retweet, Like or Save a Tweet
-
User story: I can Comment with image and I can like a comment
-
User story: I can see the posted time of the Comments and Tweets
-
User story: When I am on Home, I can see the most popular hashtags and people I should follow (it's up to you how to implement this)
-
User story: When I am on Explore, I can see the Top, Latest Tweet, or Tweet with Media. I can also choose to see the most popular people
-
User story: When I am on Bookmarks, I can see the Saved Tweet
-
User story(optional): I can search for a group