Code Monkey home page Code Monkey logo

evanigwilo / cms-blog Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 651 KB

A Distributed Content Management System (CMS) for a blogging site.

Home Page: https://petstore.swagger.io/?url=https://raw.githubusercontent.com/evanigwilo/cms-blog/main/backend/docs/api-definition.yml

Dockerfile 1.69% JavaScript 0.78% Shell 0.37% TypeScript 95.50% HTML 1.66%
api-rest blog ci-cd content-management-system distributed-systems docker docker-compose mongodb nginx-reverse-proxy nodejs redis-cache state-management test-driven-development typescript ui

cms-blog's Introduction

CMS Blog

Test TypeScript

CMS Blog is a basic version of a Distributed Content Management System (CMS) for a blogging site.

Users can can store, manage, and serve various types of content (primarily text and images).

This solution uses React.js for the UI, Styled-Components for styling, Node.js runtime, Express.js for the API layer, with Redis for cache/session, MongoDB for data like images and posts, and Nginx as a reverse proxy.

You can explore the REST API

Architecture

High-level architecture

This is a high-level view of how the different containers interact with each other.

High-level Architecture


Design Notes

  • A timeline/feed for viewing all posts
  • Ability to create, edit, update and delete posts as a user
  • Design and implemented object models for entities.
  • Schema-based solution to efficiently stores and retrieves content
  • Supports replication, sharding, connection pooling
  • Caching mechanisms to improve response times
  • User authentication and authorization using cookie session
  • Test Driven Development (TDD)
  • CI/CD with GitHub Actions
  • Responsive web design
  • Infinite scroll
  • Easy-to-use UI
  • React context for state management

Screenshots

Technologies used

Authentication/Authorization:

Storage:

  • MongoDB open source NoSQL database management program that manages document-oriented information.
  • Redis in-memory data structure store, used as a distributed, in-memory key–value database, cache and message broker.

CI/CD:

  • GitHub Actions continuous integration and continuous delivery (CI/CD) platform that allows you to automate your build, test, and deployment pipeline.

Networking/Routing:

  • Nginx web server that can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache

Containers:

  • Docker used to automate the deployment of applications in lightweight containers so that applications can work efficiently in different environments.

Forms Validation:

JavaScript library:

  • React.js declarative, efficient, and flexible JavaScript library for building reusable UI components.
  • Styled-components use component-level styles in your applications by the leverage mixture of JavaScript and CSS using a technique called CSS-in-JS.

API Routes

Methods Routes Description
POST /user/authenticate Gets user attributes for the current authenticated user.
POST /user/register Registers and authenticates users.
POST /user/login Logs in and authenticates users.
POST /user/logout Logs out the current authenticated user.
POST /user/update-bio Updates the current user bio.
GET /user/{username} Get a user by username.
POST /post Gets paginated posts
PUT /post/create Creates a post
POST /post/{username} Gets a user posts
DELETE /post/{postId} Delete post by id
GET /image/{username} Gets a user profile image
GET /image/post/{postId} Gets a post image
POST /image/post/{postId} Uploads post image
POST /image Uploads user profile

Requirements

Before getting started, make sure you have the following requirements:

Run The Project

Follow these steps to get your development environment set up:

  1. Clone this repository locally;
# Change to the desired directory
$ cd <desired-directory>

# Clone the repo
$ git clone https://github.com/evanigwilo/cms-blog.git

# Change to the project directory
$ cd cms-blog
  1. Change environmental variables file name in both backend and frontend folder from .env.example to .env

  2. At the root directory cms-blog, run the following command:

# Create external docker volume for the mongo development database
$ docker volume create cms-blog_mongo-db-dev

# Build and run in a development container environment
$ docker-compose --env-file ./backend/.env --env-file ./frontend/.env -p cms-blog-dev-stack -f ./backend/docker-compose.yml -f ./backend/docker-compose.dev.yml -f ./frontend/docker-compose.dev.yml up --build -d
  1. The web-app will be running at http://localhost:80

Useful commands

# Stops development containers and removes containers, networks and volumes
$ docker-compose --env-file ./backend/.env --env-file ./frontend/.env -p cms-blog-dev-stack -f ./backend/docker-compose.yml -f ./backend/docker-compose.dev.yml -f ./frontend/docker-compose.dev.yml up down --remove-orphans

# Show compose configurations
$ docker-compose --env-file ./backend/.env --env-file ./frontend/.env -p cms-blog-dev-stack -f ./backend/docker-compose.yml -f ./backend/docker-compose.dev.yml -f ./frontend/docker-compose.dev.yml config

# Build and run backend tests in a container environment
$ docker-compose --env-file ./backend/.env -p cms-blog-test-stack -f ./backend/docker-compose.yml -f ./backend/docker-compose.test.yml up --build -d

# View logs for backend tests
$ docker-compose --env-file ./backend/.env -p cms-blog-test-stack -f ./backend/docker-compose.yml -f ./backend/docker-compose.test.yml logs -f api-server

# Stops backend tests containers and removes containers, networks and volumes
$ docker-compose --env-file ./backend/.env -p cms-blog-test-stack -f ./backend/docker-compose.yml -f ./backend/docker-compose.test.yml down -v --remove-orphans

References

MongoDB

Diagrams.net

Achieving High Performance with PostgreSQL and Redis

Docker Healthcheck for your Node.js App

Cache management with GitHub Actions

Swagger: API Documentation & Design Tools for Teams

cms-blog's People

Contributors

evanigwilo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.