Skip to content

AhmedSaladin/Blog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Project overview

This blog application was created to practice new tools and techniques.

Table of content

Database Design

database digram

Project folders structure

├── app                   ---contain application logger configuration and application full routes.
├── config                ---contain database connection configuration.
├── controllers           ---contain all application logic. 
├── coverage              ---contain code test coverage. 
├── db design             ---contain database design digram.  
├── logs                  ---contain logs files to recored all application faulties and informations.
├── middlewares           ---contain all middleware used in application.
├── models                ---contain all database schemes used in application. 
├── routes                ---contain all application routes and link routes with their function in controllers folder.
├── tests                 ---contain all application tests.
└── utility               ---contain all helper functions used in application.

Environment Variables

All environment variables are needed to run this project.

  • Token:

    • SECRET this variable responsible for JWT secret configure to decode and encode payload data into a token.
  • Database: this project use sequelize ORM to connect to the database and handle all database operation database used for this project is MySQL.

    • USER_NAME for database username.
    • PASSWORD for database username password.
    • DATABASE_NAME for database name.
    • HOST for database hostname.
    • DATABASE_TYPE for database connection type.
  • Application:

    • PORT this variable setting up the port number to let the server listen, if it is not defined then the server by default listens on port 3000.
    • NODE_ENV this variable is for the environment identity to let the application know what environment runs it, if it runs in production the server logger will be disabled from the console and stored into files else logs show in the console to trace actions in the application. I recommend creating a .env file in the project home directory and listing these variables in it.

Usage

This section depend on "environment variables section" if you don't setup your enviroment varible or read "environment variables section" please, check it out to run project without any issues.

To run this project in your machine you need this requirements:

  • Node.js 14.13.1
  • NPM 6.14.8

After install requirments you need to preform these commands:

  • npm install to install project dependenc.
  • npm run dev-test and to run this command with no issue you need to be certain you have nodemon installed globally in your machine if not install it by this command npm install -g nodemon or for this project only run npm install -d nodemon if you don't know nodemon or what it used for? click here.
  • npm start for run project with node and it for prodution configuration.
  • npm test run all application tests with jest.

Project Goals

  • Follow Node Best Practices Guide
  • Learning PostgreSQL
  • Learn TDD
  • Work with WebSocket
  • Work with email service and Worker threads
  • Logging and error handling best practice
  • Build frontend using react
  • Work with git actions
  • Practice docker

API Document

This Section is for APIs documentation for each route under this project and contain each request and response and failure response if something went wronge or request missing some data and it hosted and tested via Postman.

Reference

This Section is for books or articles I have been reading or try to follow when I develop and design this project.