A Node.js API that simulates a GymPass-like system for managing gym check-ins and user access. This project was built using modern technologies and best practices for backend development.
- Node.js
- Fastify - Fast and low overhead web framework
- TypeScript - For type safety and better development experience
- PostgreSQL - Relational database
- Prisma - Modern database ORM
- Docker - For containerization
- Vitest - Unit and E2E testing
- JWT - For authentication
- Zod - For data validation
- Node.js (v16 or higher)
- Docker and Docker Compose
- PostgreSQL
- Yarn or npm
- Clone the repository
git clone <repository-url>
cd API-Gym-Pass- Install dependencies
yarn install- Set up environment variables
# Create a .env file based on .env.example
cp .env.example .env- Start the database using Docker
docker-compose up -d- Run database migrations
yarn migration- Start the development server
yarn devyarn dev- Start development serveryarn build- Build for productionyarn start- Start production serveryarn test- Run unit testsyarn test:e2e- Run end-to-end testsyarn test:coverage- Generate test coverage reportyarn migration- Run database migrationsyarn studio- Open Prisma Studioyarn generate- Generate Prisma client
- User registration
- Authentication
- User profile retrieval
- Check-in count tracking
- Check-in history
- Nearby gym search (within 10km)
- Gym search by name
- Check-in functionality
- Check-in validation
- Gym registration
- No duplicate email registrations
- One check-in per day limit
- Proximity check for check-ins (within 100m)
- 20-minute window for check-in validation
- Admin-only check-in validation
- Admin-only gym registration
- Password encryption
- PostgreSQL data persistence
- Paginated data lists (20 items per page)
- JWT authentication
src/
├── http/ # HTTP routes and controllers
├── use-cases/ # Business logic
├── repositories/ # Data access layer
└── utils/ # Helper functions and utilities
The API uses JWT (JSON Web Token) for authentication. Protected routes require a valid JWT token in the Authorization header:
Authorization: Bearer <your-token>
This project is licensed under the ISC License.
This project was developed as a personal study and portfolio piece.