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