My First Project with DDD — Planning

Seok Jun Hong
Seok Jun Hong
Published in
5 min readApr 15, 2021
Project Slide

Hello, I am a sophomore college student who is actively learning backend development. I have started to learn about web development in Nov 2020 and had finished my first web development project using React.js, Node.js + Express, and MySQL in Jan 2021.

In my very first project, I faced many problems not only technical problems but also architectural problems. I had no idea about refactoring and organizing the codes.

This is the structure of my first project.

.
└── Backend
├── model
├── middlewares
│ ├── passsport
│ └── upload
├── migrations
├── server
├── routes/api
│ ├── auth
│ ├── storage
│ └── viewer
├── static
└── config
└── Frontend
├── public
└── src
├── components
└── pages

I knew that there is something to improve, but I was short on knowledge to improve it further.

You can check out what I did in my first project. It was my first time using React.js, Node.js, and MySQL, so there are many sloppy parts in the project.

Anyway, that was my first project on web development. From Jan 2021, I joined one of the IT clubs in Korea named DnD to interact with other people. With two designers, two frontend developers, and two backend developers including myself, our team started to make the drink review application. And I was first introduced to Domain-Driven Design (DDD) by Si Heum, a junior backend developer in my team.

Here is what I first introduced from the project.

  • Planing the project by specifying the features of the application with team members.
  • Using DDD architecture to separate the application in terms of domains.

The concepts of DDD are hard to understand, and I cannot tell that I fully understand DDD. Terms such as Domain, Aggregate, Bounded Context, and Context map made me so confused at first. However, as I read through articles and develop the project, I started to feel the essence of the DDD architecture.

  • The strategy to write a repository as an interface and use it for infrastructure implementation.
  • Writing test codes for all layers of the domain; domain layer, infrastructure layer, application layer, and external interface. Using Mocking to decouple the layers.
  • Using Buddy, Docker, and GCP for CI/CD.

This story will cover the very beginning of our project; Planning and Deciding. Next story, I will cover how we implemented our project using DDD.

1. Gathering Ideas and Planning

We

  • Voted on the ideas that came out, and specified targets of our application. We decided to make a drink review application for drink lovers to share their information and drink novices to get information about drinks.
  • Prioritized the features of the application since we only have 2 months to implement the project. The top priorities were user authentication(duh) and CRUD features on users’ drink reviews.
  • Based on the result, I designed the User Flow Diagram.
user flow diagram of drink review application (draw.io)
  • With the user flow diagram, we specified HTTP request and response structure, status code, and API endpoints.

As we developed the project, we had found missing items in documentations, so we had to keep modify the structure. I realized the significance of being precise when planning the application. If you miss something important, you might have to change everything.

Next, we had to decide what technology stacks to use when developing the application.

2. Deciding Technology Stacks

a. Frameworks

We decided to use Python, and there are several frameworks to use with Python in Backend Development. Here are some of the options that we considered.

  • Django: As we all know Django is great for developing server applications. However, we thought that Django is too heavy, and we wanted to develop every part of our application by ourselves.
  • Flask: Flask is a good choice when considering microframework. Since it is a microframework, it will not provide many handy implementations, however, it gives full freedom to developers. Flask was definitely one of our top choices, but we wanted to use something new since this was a side project.
  • FastAPI: I guess some people might not know what FastAPI is. It is a pretty new Python framework with high performance. The great thing about FastAPI is that it automatically generates interactive API documentation in Swagger UI. Since we planned to finish the project in 2 months, we liked the features of FastAPI, and since we had planned to use DDD, we did not need extensive framework features.

We had decided to use FastAPI as a framework.

b. Authentication Methods

  • OAuth 2.0: OAuth 2.0 is a powerful authentication tool for applications. We can implement Google Login, Facebook Login with OAuth 2.0, and it is considered safe. However, we were more focused on implementing the main features of the application and applying Domain Driven Design to our application. We may consider it later, but decided not to use it for now.
  • ID + PW authentication with JWT on [Authentication] Header: JSON Web Token(JWT) allows us to easily generate an encrypted access token. When a user enters ID and PW, the server would authenticate the user based on the JWT on the Authentication header. It is not a great way to make a secured application, but it is simple enough to use.

We had decided to use ID + PW with JWT on [Authentication] Header as authentication method.

c. DevOps

We have decided most except CI/CD tool for this pipeline;
GitHub + ? + Docker + GCP/AWS.

  • Jenkins: Jenkins is an open-source tool for automated test, build, and deploy cycles. It offers various features and used my significant developers. However, it has a learning curve, and none of our team members knew how to use it.
  • Buddy: Buddy is CI/CD tool with GUI. You can set CI/CD pipeline by simply adding each step using GUI tools. It is not free, but we were ok with a free trial since we only had 2 months.

We had decided to use GitHub + Buddy + Docker + GCP for DevOps.

Here is the overview of the Backend Technology stack and Architecture of our project.

Project Tech Stacks and Architecture

You can find out our completed project here

Thank you for reading the story of a novice programmer!

--

--

Seok Jun Hong
Seok Jun Hong

I have a wide range of interests in software development. I want to tell the story of my journey of software development to guide beginners just like me.