The project consists of an API designed to facilitate the adoption of animals by connecting individuals interested in adopting pets with organizations that offer animals for adoption.
- It must be possible to register a pet.
- It must be possible to list all pets available for adoption in a city.
- It must be possible to filter pets by their characteristics.
- It must be possible to view details of a pet available for adoption.
- It must be possible to register as an organization (ORG).
- It must be possible to log in as an organization (ORG).
- To list pets, it is mandatory to provide the city.
- An ORG needs to have an address and a WhatsApp number.
- A pet must be associated with an ORG.
- Users who want to adopt a pet will contact the ORG via WhatsApp.
- All filters, other than the city, are optional.
- For an ORG to access the application as an admin, they must be logged in.
To run the application, follow these steps:
-
Start Docker Compose:
docker-compose up
-
Set Environment Variables:
Create a
.env
file or configure environment variables with the following values:NODE_ENV=dev PORT=3333 DATABASE_URL=postgresql://docker:docker@localhost:5432/find-a-friend-db?schema=public JWT_SECRET=henrique
-
Install Dependencies:
pnpm install
-
Generate Prisma Client:
npx prisma generate
-
Run Prisma Migrations:
npx prisma migrate dev
-
Start the Server in Development Mode:
pnpm run start:dev
The application should now be running and accessible at the specified port. You can interact with the API according to your requirements.
-
Compile TypeScript to JavaScript:
pnpm run build
-
Start the Compiled Server:
pnpm start
To run tests, follow these steps:
-
Execute Unit Tests:
pnpm run test
-
Execute Integration Tests:
pnpm run test:e2e
-
Generate Test Coverage Report:
pnpm run test:coverage
The tests will ensure the functionality and reliability of the project.
@fastify/cors
,fastify
: Framework for Node.js API development.@prisma/client
: Prisma client for interacting with the database.bcryptjs
: Library for password hashing.dotenv
: Environment variable loading.supertest
: Library for integration testing.tsup
: TypeScript compiler.vitest
: Testing framework.zod
: Data validation library. 🐶
If you're interested in deploying the application, you can learn how to do it here. It's quick and easy! 🚀
Luiz Henrique - Software Developer