Skip to content

A pet adoption API built with NestJS, Prisma, and JWT. Utilizing DDD principles. it manages pet registration and adoption

Notifications You must be signed in to change notification settings

DanielF-Cardoso/FindAFriend

Repository files navigation

FindAFriend

TypeScript NestJS Prisma Docker JWT

This repository handles the backend functionalities of FindAFriend, an API designed for pet adoption. The API allows organizations to register and management pets available for adoption. Users can search for pets and find nearby organizations. The backend is built with Domain-Driven Design (DDD) and Clean Architecture principles.

📋 Contents

🛠️ Features

  • Pet Registration and Management: Organizations can register, edit and delete pets available for adoption, including details like breed, age and energy level.

  • Pet Search: Users can search for pets available for adoption based on different criteria (e.g., city, age, breed).

  • Nearby Organizations: Users can search for organizations near them to find pets available for adoption.

  • 🚀 Technologies Used

  • Nest.js - A progressive Node.js framework.

  • Prisma - ORM for database access.

  • Vitest - Unit and e2e testing.

  • Docker - Containerization for execution.

  • JWT - Used for secure user authentication and authorization.

💾 Setup and Installation

  1. Clone the repository:
    https://github.com/DanielF-Cardoso/FindAFriend.git
  2. Run Docker: To use Postgress service with Docker
    docker-compose up -d
  3. Set up environment variables: Create a .env file based on the provided example
    cp .env-example .env
  4. Install dependencies:
    npm install
  5. Set up the database: Ensure Prisma is properly configured and apply migrations
    npx prisma migrate dev

⚙️ How to Run

  • Run the application locally:
    npm run start:dev
  • Run the application in production: Build the project and run it using the compiled files:
    npm run build
    npm run start

📚 API Documentation

The API includes a complete Swagger documentation that can be accessed at the following route after starting the server:

http://localhost:3333/api/docs

🛣️ Application Routes

Organizations

  • POST /orgs
    Register a new organization.

  • POST /orgs/auth
    Authenticate an organization and return a JWT token.

  • GET /orgs/nearby
    Find nearby organizations based on geographic coordinates (latitude and longitude).

  • DELETE /orgs/pets/{id}
    Delete a specific pet belonging to an organization. (Requires authentication)

  • PUT /orgs/pets/{id}
    Update details of a specific pet belonging to an organization. (Requires authentication)

  • POST /orgs/pets
    Register a new pet for adoption. (Requires authentication)


Pets

  • GET /pet/{id}
    Retrieve details of a specific pet.

  • GET /pets/search
    Search for pets based on criteria such as city, age, or breed.

🧪 Running Tests

  • Run the Unit test:
    npm run test
  • Run the Unit tests in watch mode:
    npm run test:watch
  • Run the Unit tests with coverage:
    npm run test:cov
  • Run end-to-end tests:
    npm run test:e2e
  • Run end-to-end tests in watch mode:
    npm run test:e2e:watch

About

A pet adoption API built with NestJS, Prisma, and JWT. Utilizing DDD principles. it manages pet registration and adoption

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published