GymPass API in Node.js + TypeScript that applies SOLID concepts and has unit and E2E tests.
- It must be possible to register;
- It must be possible to authenticate;
- It must be possible to get the profile of a logged in user;
- It must be possible to obtain the number of check-ins performed by the logged in user;
- It must be possible for the user to obtain their check-in history.
- It should be possible for the user to search for nearby gyms up to 10km away;
- It should be possible for the user to search for gyms by name;
- User must be able to check into a gym.
- It must be possible to validate a user's check-in;
- It must be possible to register a gym;
- The user must not be able to register with a duplicate email;
- The user cannot make 2 check-ins on the same day;
- User cannot check-in if they are not near (100m) the gym;
- Check-in can only be validated up to 20 minutes after creation;
- The check-in can only be validated by administrators;
- The academy can only be registered by administrators;
- User password must be encrypted;
- The application data must be persisted in a PostgresSQL database;
- All data lists need to be paginated with 20 items per page;
- The user must be identified by a JWT (Json Web Token);
Run the PostgreSQL container:
$ docker-compose up -d
Create an .env
file:
$ cp .env.example .env
Edit this file and set the values for the requested environment variables, example:
# Node
NODE_ENV="development"
#Auth
JWT_SECRET="your-secret"
# Database
DATABASE_URL="postgresql://docker:docker@localhost:5432/solidapi?schema=public"
$ npm run dev
$ npm run build
Run unit tests
$ npm run test
Run E2E tests
$ npm run test:e2e
Generate coverage
$ npm run test:coverage