Giter VIP home page Giter VIP logo

james-langridge / personal-trainer-planner Goto Github PK

View Code? Open in Web Editor NEW
11.0 1.0 4.0 3.11 MB

Scheduling and management app for personal trainers made with Next.js 13 (App Router), RSC, Redux Toolkit, RTK Query, Prisma, PostgreSQL, NextAuth, Tailwind CSS, and shadcn/ui.

Home Page: https://personal-trainer-planner.vercel.app

License: MIT License

TypeScript 94.13% JavaScript 4.39% CSS 0.58% PLpgSQL 0.68% Shell 0.21%
nextjs personal-trainers postgresql prisma react tailwindcss typescript vercel redux-toolkit rtk-query

personal-trainer-planner's Introduction

Tests

About The Project

A client management and scheduling app for personal trainers and their clients, made in collaboration with a real personal trainer (PT), with the new Next.js 13 features like the App Router and React Server Components.

Warning This app is a work in progress, and uses new Next.js 13 and React 18 features that could be unstable.

Features

Client in this context means the customer of the PT.

  • Shared calendar between PT and each client, editable by PT only.
  • Three event types:
    • Workouts, which clients can check as done.
    • Appointments, with fees for billing.
    • Bootcamps, which clients can check to confirm attendance.
  • Appointment attendance and fee data is viewable in a monthly table.
  • Invoices can be generated and emailed to clients with a button click.
  • Mobile-friendly calendar list-view for clients with infinite scroll.
  • Password-less login via email magic link.
  • Custom forms via Contentful CMS, emailed to the PT when the client completes them.
  • Authentication using NextAuth.js.
  • ORM using Prisma.
  • Database on Railway.
  • Styled using Tailwind CSS, Meraki UI, and shadcn/ui (Radix UI, TanStack Table).
  • State management with Redux Toolkit and RTK Query.
  • Written in TypeScript.

Screenshots

Run it locally

Prerequisites

  • You will need a PostgreSQL database.
    • With Railway go to https://railway.app/new and click Provision PostgreSQL, then click on the new Postgres project, and grab the DATABASE_URL from the Connect tab.
    • Assuming you have PostgreSQL installed, you could instead create a local database for development with this command:
      • createdb mydatabase
      • Then you can connect to it: DATABASE_URL=postgresql://postgres:[YOUR_PASSWORD]@localhost:5432/mydatabase
    • Assuming you have Docker installed, you could run Postgres in a Docker container:
      • docker run --name some-postgres -e POSTGRES_PASSWORD=mysecretpassword -e POSTGRES_DB=mydatabase -p 5432:5432 -d postgres
      • Then you can connect to it: DATABASE_URL=postgresql://postgres:mysecretpassword@localhost:5432/mydatabase
  • You will need to set up an email account to work with NextAuth.js. I used Gmail. See the NextAuth.js docs and the nodemailer docs.
  • The app uses Contentful as a CMS for the personal trainer to create forms for their clients, which are emailed to the PT on completion. To use this feature you will need a Contentful account.

Installation

  1. Clone the repo
    git clone https://github.com/james-langridge/personal-trainer-planner.git
  2. Install NPM packages
    npm install
  3. Copy the environment variable files and update the variables.
    cp .env.example .env
    cp .env.local.example .env.local
  4. Once you have a Postgres DB running somewhere, and the DATABASE_URL env var set, run the Prisma Migrate command:
    npx prisma migrate dev
  5. Change the emails in prisma/seed.ts so you will be able to log into the app.
  6. Seed the database:
    npx prisma db seed
  7. You can check seeding the database worked with this command:
    npx prisma studio
    You can also edit data using this UI in the browser if needed.
  8. Start the development server:
    npm run dev
  9. Open up http://localhost:3000 in a browser and log in. You must have set up an email account and set the environment variables before you can log in. See the NextAuth.js docs and the nodemailer docs. You will be admin and can create other users. The seed script added demo workouts etc to your admin account.
  10. As a Next.js app, deploying to Vercel is simple: https://vercel.com/new

Deploy your own

You should be able to clone and deploy this project on Vercel using the button below, provided you have completed the prerequisites above (database and email).

Deploy with Vercel

Check the deployed project has all the required environment variables, as the button generator says there cannot be more than 10 Environment Variables per project, so you will need to manually add the ones from the .env.example that are missing.

See the Next.js deployment documentation for more details.

License

Distributed under the MIT License.

personal-trainer-planner's People

Contributors

james-langridge avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

personal-trainer-planner's Issues

users/[id] route

  • Add tabs to the individual users/[id] route, so can switch between viewing different data tables for one user: workouts, appointments, bootcamps, invoices. Credits history.
  • Add link to edit page
  • Add delete button

TypeError: Cannot read properties of null (reading '_location')

Tests pass but the process exits with this error, seemingly related to the mswjs or jsdom libraries:

  npm run test:ci
  shell: /usr/bin/bash -e {0}

> [email protected] test:ci
> jest

- warn You have enabled experimental feature (serverComponentsExternalPackages) in next.config.js.
- warn Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.

PASS __tests__/components/WorkoutItem.test.tsx
PASS __tests__/components/Calendar.test.tsx

Test Suites: 2 passed, 2 total
Tests:       9 passed, 9 total
Snapshots:   0 total
Time:        2.13 s
Ran all test suites.
/home/runner/work/personal-trainer-planner/personal-trainer-planner/node_modules/jsdom/lib/jsdom/browser/Window.js:376
      return idlUtils.wrapperForImpl(idlUtils.implForWrapper(window._document)._location);
                                                                              ^

TypeError: Cannot read properties of null (reading '_location')
    at Window.get location [as location] (/home/runner/work/personal-trainer-planner/personal-trainer-planner/node_modules/jsdom/lib/jsdom/browser/Window.js:376:79)
    at FetchInterceptor.<anonymous> (/home/runner/work/personal-trainer-planner/personal-trainer-planner/node_modules/@mswjs/interceptors/src/interceptors/fetch/index.ts:52:9)
    at step (/home/runner/work/personal-trainer-planner/personal-trainer-planner/node_modules/@mswjs/interceptors/lib/interceptors/fetch/index.js:59:23)
    at Object.next (/home/runner/work/personal-trainer-planner/personal-trainer-planner/node_modules/@mswjs/interceptors/lib/interceptors/fetch/index.js:40:53)
    at fulfilled (/home/runner/work/personal-trainer-planner/personal-trainer-planner/node_modules/@mswjs/interceptors/lib/interceptors/fetch/index.js:31:58)

Node.js v18.16.0
Error: Process completed with exit code 1.

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.