Skip to content

Track Tonic is a cutting-edge fitness app that empowers users to track progress, set goals, and engage with a vibrant community, promoting healthier lifestyles through advanced technology. This is the server side code

Notifications You must be signed in to change notification settings

NabilaFerdousPrapty/Track-Tonic-Server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TrackTonic Fitness Training

TrackTonic Fitness Training is a comprehensive platform that connects fitness trainers with clients, offering a range of features such as trainer profiles, booking, reviews, and a forum for discussions. The backend is built with Node.js, Express, MongoDB, and Stripe for payment processing.

Table of Contents

Setup

To set up the project locally, follow these steps:

  1. Clone the repository:

    git clone https://github.com/yourusername/tracktonic-fitness-training.git
    cd tracktonic-fitness-training
  2. Install dependencies:

    npm install
  3. Set up the environment variables: Create a .env file in the root directory and add the following environment variables:

    PORT=7000
    DB_USER=your_mongodb_username
    DB_PASS=your_mongodb_password
    ACCESS_TOKEN_SECRET=your_jwt_secret
    STRIPE_SECRET_KEY=your_stripe_secret_key
    
  4. Start the server:

    nodemon index.js
  5. Access the application: Open your web browser and navigate to http://localhost:7000 to access the application.

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/tracktonic-fitness-training.git
    cd tracktonic-fitness-training
  2. Install dependencies:

    npm install
  3. Start the server:

    npm start

Environment Variables

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

PORT=7000
DB_USER=your_mongodb_username
DB_PASS=your_mongodb_password
ACCESS_TOKEN_SECRET=your_jwt_secret
STRIPE_SECRET_KEY=your_stripe_secret_key

API Endpoints

Authentication

  • Generate JWT Token: POST /jwt

Reviews

  • Get All Reviews: GET /reviews
  • Get Review by ID: GET /reviews/:id
  • Create Review: POST /reviews
    • Body: { "review": "Great trainer!", "rating": 5 }

Trainers

  • Get All Approved Trainers: GET /trainers
  • Get All Trainers: GET /trainers/all
  • Get Pending Trainers: GET /trainers/pending
  • Get Trainer by ID: GET /trainers/:id
  • Get Trainer by Email: GET /trainers/email/:email
  • Get Rejected Trainers by Email: GET /rejectedTrainers/:email
  • Get Pending Trainers by Email: GET /pendingTrainers/:email
  • Create Trainer: POST /trainers
  • Approve Trainer: PATCH /approveTrainer/:id
  • Reject Trainer: PATCH /rejectTrainer/:id
    • Body: { "reason": "Does not meet criteria" }
  • Update Trainer Role to 'trainer': PATCH /trainers/approve/:email
  • Update Trainer Role to 'member': PATCH /trainers/delete/:email
  • Delete Trainer: DELETE /trainers/remove/:id

Forum Posts

  • Get All Posts with Pagination: GET /posts?page=0&size=10
  • Create Post: POST /posts
    • Body: { "title": "New Post", "content": "This is a new post." }
  • Get Post by ID: GET /posts/:id
  • Upvote Post: PATCH /posts/upvote/:postId
  • Downvote Post: PATCH /posts/downvote/:postId
  • Get Post Count: GET /postsCount

Users

  • Get All Users: GET /users
  • Create User: POST /users
  • Check Admin Role: GET /users/admin/:email
  • Check Trainer Role: GET /users/trainer/:email

Classes

  • Create Class: POST /classes (Admin only)
    • Body: { "class_name": "Yoga", "description": "A relaxing yoga class" }
  • Get All Classes with Pagination and Search: GET /classes?page=0&size=10&search=yoga
  • Get Class Count: GET /classesCount
  • Get Class by ID: GET /classes/:id
  • Get Featured Classes: GET /featuredClasses
  • Book Class: PATCH /bookClass/:id

Payments

  • Create Payment Intent: POST /create_payment_intent
    • Body: { "price": 100 }
  • Record Payment: POST /payments
  • Get All Payments: GET /payments
  • Get Payments by Email: GET /payments/:email

Technologies Used

  • Backend: Node.js, Express.js
  • Database: MongoDB
  • Authentication: JWT
  • Payment Processing: Stripe
  • Environment Variables: dotenv

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

Track Tonic is a cutting-edge fitness app that empowers users to track progress, set goals, and engage with a vibrant community, promoting healthier lifestyles through advanced technology. This is the server side code

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published