Skip to content

Implementing DDD on birthday email service using Fastify and TypeScript

Notifications You must be signed in to change notification settings

MAgungHKM/fastify-birthday-email-service

Repository files navigation

Getting Started with Fastify-CLI

This project was bootstrapped with Fastify-CLI.

What Is This

This project was intended to be a simple implementation of Domain Driven Design according to my knowladge which I learned from Dicky Arinal——albeit an inconsiderable amount. As described in the first part of this README, this project is built with Fastify framework with node-tap as its test framework. Prisma is also used as its ORM. PostgreSQL is the preferred DB of choice, other than having in memory as well for testing purposes. Swagger 2.0 is used to generate the API docs.

Initial setup

Local

  1. Copy or move the .env.example to .env and update the value as necessary
  2. Install the packages using your package installer of choice (I uses pnpm, hence the project lock file) by running the following code
    pnpm install
    
  3. To run the app as is, you need to make sure your db is set up properly, and the db.sql file in db directory is imported to your db. If you don't want to use the db you can replace the injected repository to use in memory at src/plugins/boot.ts file.
  4. You can access the api at http://localhost:11111.

Docker

  1. Copy or move the .env.example to .env and update the value as necessary
  2. Run the following command to start the docker containers
    docker-compose up
    
  3. You can access the db at port 5432 of your localhost and the api at http://localhost:3000

Available Scripts

In the project directory, you can run (you can run this with npm as well):

pnpm dev

To start the app in dev mode.
Open http://localhost:11111 to view it in the browser.

pnpm start

For production mode

pnpm test

Run the test cases.

pnpm test:report

Run the test cases and generate coverage report while also opening in at your browser.

Learn More

To learn Fastify, check out the Fastify documentation.

About

Implementing DDD on birthday email service using Fastify and TypeScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages