Skip to content

leandrolimadeveloper/gym-pass-app

Repository files navigation

Gym Pass Style API

📌 Description

The GymPass Style API is an application designed to facilitate access to and management of gyms, allowing users to check in, track their history, and find nearby gyms. The system features secure authentication and a range of functionalities.

🛠️ Technologies

TypeScript
Fastify
PostgreSQL
Prisma
Vitest
Docker

📦 Installation

  1. Clone the repository:
git clone https://github.com/leandrolimadeveloper/gym-pass-app.git
  1. Navigate to the project folder:
cd gym-pass-app
  1. Install dependencies:
npm install
  1. Generate database tables:
    First, set the DATABASE_URL in the .env file: DATABASE_URL=postgresql://janedoe:mypassword@localhost:5432/mydb

Configure your database_url based on the credentials contained in the docker-compose file, located in the root folder of the project.

Then, to reset the migrations and generate the Prisma Client:

npx prisma migrate reset

To test the Prisma Connection and its models, execute:

npx prisma studio    // Open Prisma Client

Connection with the Database

The project has a Docker compose file to download the image and run the PostgreSQL locally. Create your own database credential or use the credentials contained in the file, then having Docker installed in your machine, execute the following command in the root project folder:

docker compose up

or

docker compose up -d    # execute docker in detached mode

After installed all dependencies, and to have PostgreSQL running in a container, you can run the project:

npm run start:dev

To open Prisma client, execute:

npx prisma studio

Now you can do HTTP requests using a Client REST.

🧪 Running Tests

To run unit tests, use the following command:

npm run test

To run end-to-end tests, use the following command:

npm run test:e2e

🚀 Functional Requirements, Non-Functional Requirements, and Business Rules — ENG

FRs (Functional Requirements)

  • It must be possible to register;
  • It must be possible to authenticate;
  • It must be possible to obtain the profile of a logged-in user;
  • It must be possible to retrieve the number of check-ins made by the logged-in user;
  • It must be possible for the user to access their check-in history;
  • It must be possible for the user to search for nearby gyms (within 10 km);
  • It must be possible for the user to search for gyms by name;
  • It must be possible for the user to check in at a gym;
  • It must be possible to validate a user’s check-in;
  • It must be possible to register a gym;

BRs (Business Rules)

  • A user must not be able to register with a duplicate email;
  • A user cannot perform two check-ins on the same day;
  • A user cannot check in unless they are near (within 100m) the gym;
  • A check-in can only be validated within 20 minutes after being created;
  • A check-in can only be validated by administrators;
  • A gym can only be registered by administrators;

NFRs (Non-Functional Requirements)

  • The user’s password must be encrypted;
  • The application’s data must be stored in a PostgreSQL database;
  • All data lists must be paginated with 20 items per page;
  • The user must be identified by a JWT (JSON Web Token);

📖 Endpoints Documentation

For more details, visit Endpoint Documentation - ENG

Contributors 2

  •  
  •