hamza-cskn / blog-services

Blog and comment services for personal blog website. Written with Nest.js.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

logo of website

Blog Services

This repository contains microservices to store blogs, comments and render them. Measures various metrics and visualizes them. Aims of the repository is having testable, scalable, maintainable and fully Dockerized architecture.

Architecture

Here is the tech stack used in this project:

  1. Fully Dockerized, see docker-compose.yml for more details.
  2. Uses Restful API.
  3. Uses API tokens for security.
  4. Uses MongoDB as database.
  5. Uses Nginx as reverse proxy, cache and for ssl verification.
  6. Scraps Nginx and MongoDB metrics via Prometheus.
  7. Uses Grafana to visualize metrics.
  8. Uses Jest for unit testing.
  9. Uses Svelte & TailwindCSS for frontend.
  10. Renders HTML pages on server-side using SvelteKit.
  11. Uses GitHub Actions for CI/CD.
  12. Add docker compose build support.
  13. Postman collection for the API

architecture

How to run

  1. Clone the repository: git clone git@github.com:hamza-cskn/blog-services.git
  2. Go the repository directory: cd blog-services
  3. Build the docker images: docker compose build
  4. Configure the docker-compose.yml and other configuration files as you want.
  5. Run the docker containers: docker compose up -d
  6. Visit https://localhost to see the front-end.

How to test

  1. Just run npm run test --prefix <service-name>. Enjoy.

How to use API

  1. Get API token from docker-compose.yml file.
    • Frontend, Blog and Comment services must have same API token.
    • So, each service can access each other using the token as key.
    • Tokens are passed as Token header in HTTP requests.
    • Tokens are stored in API_TOKEN environment variable.
  2. Send HTTP request to Blog or Comment services with the token.
    • You can use curl or Postman to send HTTP requests.
    • API Documentation can be found below.

Postman Collection

The repository has ready-to-use Postman collection. Check blog-app.postman_collection.json file or visit the documentation page.

If you know Turkish, feel free to read my Rest API blog.

Screenshots

Click to expand image image image image image image image image image

About

Blog and comment services for personal blog website. Written with Nest.js.


Languages

Language:Svelte 61.7%Language:TypeScript 20.8%Language:CSS 9.1%Language:JavaScript 7.3%Language:Dockerfile 0.7%Language:HTML 0.4%