Giter Site home page Giter Site logo

nueluzoma / fitness-plus Goto Github PK

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

Fitness-plus offers gym memberships with various billing structures. This backend system manages memberships, including annual and monthly billing, as well as optional add-on services.

JavaScript 4.50% TypeScript 95.50%
nestjs postgresql typeorm typescript

fitness-plus's Introduction

Fitness-plus Membership Backend API

Overview

Fitness-plus offers gym memberships with various billing structures. This backend system manages memberships, including annual and monthly billing, as well as optional add-on services such as personal training sessions and towel rentals. The API also handles invoicing for new members, sends email reminders for upcoming payments, and includes a cron job to check for upcoming membership fees.

Features

  • Manage memberships with annual and monthly billing.
  • Handle optional add-on services with separate monthly charges.
  • Combine the annual membership fee with the first month's add-on service charges for new members.
  • Send email reminders for upcoming payments.
  • Cron job to check for upcoming membership fees and send reminders.

Technologies Used

Prerequisites

  • Node.js and npm installed
  • PostgreSQL database setup
  • Gmail account for sending emails

Installation

  1. Clone the repository:

    git clone https://github.com/NuelUzoma/fitness-plus.git
    cd fitness-plus
  2. Install dependencies:

    npm install
  3. Set up environment variables:

    Create a .env file in the root directory and add the following variables:

    DB_HOST=localhost
    DB_PORT=5432
    DB_USERNAME=your_db_username
    DB_PASSWORD=your_db_password
    DB_DATABASE=fitness_plus
    MAIL_HOST=smtp.gmail.com
    MAIL_PORT=587
    MAIL_USER=your_gmail_username
    MAIL_PASS=your_gmail_password
  4. Run the database migration to set up the database schema:

    npm run typeorm migration:run

Running the Application

  1. Start the Nest.js server:

    npm run start

Usage

Endpoints

Memberships

  • Create a new membership

    POST /api/memberships

    Request Body:

    {
      "firstName": "Kelechi",
      "lastName": "Ogu",
      "membershipType": "Annual Basic",
      "email": "[email protected]",
      "isFirstMonth": true
    }

    Response:

    {
      "firstName": "Kelechi",
      "lastName": "Ogu",
      "membershipType": "Annual Basic",
      "email": "[email protected]",
      "isFirstMonth": true,
      "startDate": "2024-06-11T20:16:26.217Z",
      "dueDate": "2025-06-10T23:00:00.000Z",
      "totalAmount": 500,
      "id": 22
    }
  • Get all memberships

    GET /api/memberships
  • Update membership details

    PUT /api/memberships

Add-On Services

  • Create a new add-on service

    POST /api/addons

    Request Body:

    {
      "serviceName": "Personal Training"
    }

    Response:

    {
      "serviceName": "Personal Training",
      "dueDate": "2024-07-10T23:00:00.000Z",
      "monthlyAmount": 100,
      "id": 21
    }
  • Get all add-on services

    GET /api/addons

Email Notifications

Emails are sent using NodeMailer configured with a Gmail SMTP server. Ensure that your Gmail account allows less secure apps or generate an app-specific password for better security.

Cron Job

A cron job runs daily at midnight to check for upcoming membership fees and send reminders.

fitness-plus's People

Contributors

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