Giter Site home page Giter Site logo

dantecodex / daily-quote Goto Github PK

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

A web application that provides users with daily motivational quotes. Features user authentication, customizable delivery times, and automated email notifications using cron jobs. Built with Node.js, Express, MongoDB, and EJS for a seamless user experience.

JavaScript 29.58% CSS 51.81% EJS 18.61%

daily-quote's Introduction

Daily Quote Web Application

Overview

The Daily Quote Web Application is designed to provide users with daily motivational quotes. Users can sign up, log in, and configure their settings to receive quotes at a specified time each day. The application uses cron jobs to automate the delivery of these quotes via email.

Features

  • User Authentication: Sign up, log in, and log out functionality.
  • User Settings: Configure the time to receive daily quotes and choose whether to receive them.
  • Dashboard: Displays user information and settings.
  • Daily Quotes: Receive motivational quotes via email at the specified time.
  • Error Handling: Graceful handling of errors with appropriate messages.
  • Responsive Design: Mobile-friendly interface.

Functionality

Cron Jobs

The application uses node-cron to schedule and send daily quotes to users via email.

  • Load Email Data: The loadEmailData function retrieves all users who have opted to receive daily quotes and schedules a cron job for each user based on their specified time.
  • Time to Cron Expression: Converts user-specified times to cron expressions for scheduling.
  • Refresh Users and Quotes: A cron job runs every 6 hours to refresh the list of users and quotes, ensuring that new users or updated settings are accounted for.

Technologies Used

  • Frontend: HTML, CSS, EJS (Embedded JavaScript)
  • Backend: Node.js, Express.js
  • Database: MongoDB
  • Authentication: JWT (JSON Web Tokens)
  • Email Service: Nodemailer
  • Task Scheduling: node-cron

Setup and Installation

  1. Clone the repository:

    git clone https://github.com/dantecodex/daily-quote.git
    cd daily-quote
  2. Install dependencies:

    npm install
  3. Environment Variables: Create a .env file in the project root directory and add the necessary environment variables. Refer to the envExample.txt file for the required variables.

  4. Run the application:

    npm start
  5. Access the application: Access the application in your web browser at http://localhost:PORT, where PORT is the port number specified in your .env file.

File Structure

project_root/
│
├── controllers/
│   ├── quote_controller.js
│   └── user_controller.js
│
├── middleware/
│   ├── checkAuth.js
│   └── globalErrorHandler.js
│
├── models/
│   ├── quote_model.js
│   └── user_model.js
│
├── routes/
│   ├── quote_route.js
│   ├── static_route.js
│   └── user_route.js
│
├── utils/
│   ├── asyncErrorHandler.js
│   ├── customError.js
│   └── email.js
│
├── public/
│   ├── css/
│   │   ├── dashboard.css
│   │   ├── index.css
│   │   ├── login.css
│   │   ├── page404.css
│   │   └── signup.css
│   │
│   └── scripts/
│       └── dashboard.js
│
├── views/
│   ├── dashboard.ejs
│   ├── error.ejs
│   ├── index.ejs
│   ├── login.ejs
│   ├── page404.ejs
│   └── signup.ejs
│
├── extra/
│   └── quote.json
│
├── app.js
├── server.js
├── sendQuote.js
├── .env
└── package.json

Gallery

Screenshot 1 Screenshot 2 Screenshot 3 Screenshot 4 Screenshot 5 Screenshot 6

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

Connect with Me

Feel free to connect with me on LinkedIn:

LinkedIn

daily-quote's People

Contributors

dantecodex 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.