Skip to content

majarovtar/workout_tracker

Repository files navigation

Workout Tracker App

A full-stack workout tracking application built with the MERN stack (MongoDB, Express, React, Node.js).

Features

  • User authentication (signup/login)
  • Create, view, and manage workout entries
  • JWT-based authentication
  • Responsive React frontend
  • RESTful API backend

Prerequisites

Before running this application, ensure you have the following installed:

  • Node.js (v14 or higher)
  • npm or yarn
  • MongoDB (local or cloud instance)

Installation

  1. Clone the repository:
git clone <repository-url>
cd wt
  1. Install backend dependencies:
npm install
  1. Install frontend dependencies:
cd frontend
npm install
cd ..
  1. Set up environment variables:
cp .env.example .env

Edit the .env file with your configuration:

  • PORT: Server port (default: 4000)
  • MONGODB_URI: Your MongoDB connection string
  • JWT_SECRET: Secret key for JWT token generation

Running the Application

Development Mode

  1. Start the backend server:
npm run dev
  1. In a new terminal, start the frontend:
cd frontend
npm start

The backend server will run on http://localhost:4000 (or your configured PORT) The frontend will run on http://localhost:3000

Production Build

  1. Build the TypeScript backend:
npm run build
  1. Build the React frontend:
cd frontend
npm run build

API Endpoints

Authentication

  • POST /user/signup - Create a new user account
  • POST /user/login - Login with existing credentials

Workouts

  • GET /workouts - Get all workouts (requires authentication)
  • POST /workouts - Create a new workout (requires authentication)
  • GET /workouts/:id - Get a specific workout
  • PATCH /workouts/:id - Update a workout
  • DELETE /workouts/:id - Delete a workout

Technologies Used

Backend

  • Node.js & Express.js
  • MongoDB with Mongoose
  • JWT for authentication
  • bcrypt for password hashing
  • TypeScript support

Frontend

  • React 18
  • React Router for navigation
  • Context API for state management
  • date-fns for date formatting
  • Proxy configuration for API calls

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors