Application for registration and check-in at gyms
GoGym is a modern and efficient gym check-in management application built with Node.js and Fastify. It allows gym owners to manage their facilities and users to easily check in with a seamless experience.
- User Register: Members can be registered on application.
- User Check-in: Members can check in to gyms quickly and securely.
- Gym Management: Owners can manage gym locations, memberships, and check-ins.
- Node.js (Backend Runtime)
- Fastify (Web Framework)
- Zod (Schema Validation)
- dotenv (Environment Variables)
- Prisma (Serverless architecture ORM)
- BCryptjs (Hashing lib for passwords)
- Vitest (Unit tests enviroment)
go-gym-api/
├── prisma/
│ ├── migrations # stored migration history
│ └── schema.prisma # Database tables schemas
├── src/
│ ├── @types/ # Store globals interfaces on project
│ ├── env/
│ │ └── index.ts # Enviroment vars validation
│ ├── http/
│ │ ├── controllers/ # Handler of request response
│ │ └── middlewares # Functions to interact between controllers and endpoints
│ ├── lib/
│ │ └── prisma.ts # Prisma client config
│ ├── repositories/ # Layer for database manipulation tools
│ │ ├── in-memory/
│ │ ├── prisma/
│ │ ├── check-ins-repository.ts # Check-ins Interface
│ │ ├── gyms-repository.ts # Check-ins Interface
│ │ └── users-repository.ts # Users Interface
│ ├── use-cases/ # Use cases layer for entities
│ │ ├── errors/ # Use case error messages
│ │ └── factories/ # Use case factories for instances
│ ├── utils/ # Application utility functions
│ │ └── test/ # Utility functions for tests
│ ├── app.ts # Fastify app setup
│ └── server.ts # Server setup config
├── env.example # Enviroment variables example
├── .eslintrc.json # ESLint Config
├── .gitignore
├── .npmrc # NPM config libs control
├── docker-compose.yml
├── LICENSE
├── package.json
├── tsconfig.json
├── vite.config.ts # Unit test config file
└── README.md
-
Clone the repository:
git clone https://github.com/DevAnseSenior/gogym-api.git cd go-gym-api
-
Install dependencies:
npm install
-
Set up environment variables (create .env file):
NODE_ENV="your_env" ("dev", "test", "production") PORT=3333 DATABASE_URL=
-
Run the application:
docker compose up -d # Start the services npx prisma migrate dev # Execute migrations npm run start:dev # Run application on development mode
The API will be available at http://localhost:3333
-
Run tests:
docker compose up -d # Start the services npm run test # Run the unit tests suits npm run test:e2e # Run the tests e2e suits npm run test:watch # Run the tests on watch mode npm run test:coverage # Verify the tests coverage (open index.html from dir coverage/) npm run test:ui # Execute the test client of vitest
- POST /users → Register new user.
- POST /sessions → Authenticate (login).
- GET /me → Get logged user info.
- POST /gyms → Create a new gym.
- GET /gyms/search → Search gym by title.
- GET /gyms/nearby → Search nearby user localization gyms.
- POST /gyms/:gymId/check-ins → Check-in.
- PATCH /check-ins/:checkInId/validate → Gym validations check-in.
- GET /check-ins/history → Get check-ins history.
- GET /check-ins/metrics → Get check-ins count of logged user.
This project is licensed under MIT License.
Made with 💪 by Anderson Coelho 🚀 Powered by Fastify & Node.js