https://github.com/leandrolimadeveloper/gym-pass-app
Gym Check-in API
https://github.com/leandrolimadeveloper/gym-pass-app
design-patterns docker end-to-end-testing fastify prisma-orm solid typescript unit-testing vitest
Last synced: 7 months ago
JSON representation
Gym Check-in API
- Host: GitHub
- URL: https://github.com/leandrolimadeveloper/gym-pass-app
- Owner: leandrolimadeveloper
- Created: 2024-05-05T03:14:50.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-06T00:15:08.000Z (7 months ago)
- Last Synced: 2025-03-06T01:24:55.940Z (7 months ago)
- Topics: design-patterns, docker, end-to-end-testing, fastify, prisma-orm, solid, typescript, unit-testing, vitest
- Language: TypeScript
- Homepage:
- Size: 194 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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:
```sh
git clone https://github.com/leandrolimadeveloper/gym-pass-app.git
```
2. Navigate to the project folder:
```sh
cd gym-pass-app
```
3. Install dependencies:
```sh
npm install
```
4. 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:
```sh
npx prisma migrate reset
```To test the Prisma Connection and its models, execute:
```sh
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:```sh
docker compose up
```
or
```sh
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:
```sh
npm run start:dev
```To open Prisma client, execute:
```sh
npx prisma studio
```**Now you can do HTTP requests using a Client REST.**
## đź§Ş Running Tests
To run unit tests, use the following command:
```sh
npm run test
```
To run end-to-end tests, use the following command:
```sh
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](https://imgix.cosmicjs.com/0a951520-f896-11ef-97be-337de38c2241-Gym-Pass-API-Endpoints-Doc---English.pdf)