Skip to content

The Find a Friend API is a Node.js and TypeScript-based project developed as part of the Rocketseat NodeJS course. Its primary goal is to provide a robust RESTful API with full CRUD operations, user authentication via JWT, and containerization using Docker.

Notifications You must be signed in to change notification settings

thiagohrcosta/Find-A-Friend-API

Repository files navigation

Find A friend API

TypeScript NodeJS Prisma Docker Fastify

Overview

The Find a Friend API is a Node.js and TypeScript-based project developed as part of the Rocketseat NodeJS course. Its primary goal is to provide a robust RESTful API with full CRUD operations, user authentication via JWT, and containerization using Docker.

The Frontend version it's on the following link: Find A Friend Web

Key Technologies

  • NodeJS: The project leverages Node.js for building a high-performance, event-driven server.

  • Typescript: TypeScript is used to enhance code reliability and maintainability.

  • Prisma: Prisma is employed for type-safe and efficient database interactions, eliminating the need for raw SQL.

  • Docker: Docker containerization streamlines deployment and ensures consistent runtime environments.

  • Fastify: Fastify serves as the web framework to deliver a lightweight, high-speed API.

Functionality

The API serves two main user groups:

  1. Company Portal: Organizations and animal shelters can securely log in and add information about animals available for adoption to the database. This facilitates the process of connecting animals with potential owners.

  2. User Portal: Individuals interested in adopting a pet can create user accounts and search for animals available for adoption in their vicinity.

Docker Compose Configuration

To deploy the Find a Friend API, you can utilize Docker Compose with the following configuration:

version: '3'

services:

find-friend-api:

image: bitnami/postgresql

ports:

- 5432:5432

environment:

- POSTGRESQL_USERNAME=docker

- POSTGRESQL_PASSWORD=docker

- POSTGRESQL_DATABASE=findfriendapi

This configuration sets up a PostgreSQL database container for your API.

Environment Configuration

For environment configuration, you can create a .env.example file. Below is an example of the file's content:

NODE_ENV=dev

JWT_SECRET=*********

DATABASE_URL="postgresql://user:password@localhost:5432/findfriendapi?schema=public"  

Fastify JWT

Application Rules

[X] It should be possible to register a pet.

[X] It should be possible to list all pets available for adoption in a city.

[X] It should be possible to filter pets by their characteristics.

[X] It should be possible to view details of a pet for adoption.

[X] It should be possible to register as an organization (ORG).

[X] It should be possible to log in as an organization (ORG).

Business Rules

[X] To list pets, it is mandatory to provide the city.

[X] An organization (ORG) needs to have an address and a WhatsApp number.

[X] A pet must be linked to an organization (ORG).

[X] The user who wants to adopt will contact the organization (ORG) via WhatsApp.

[X] All filters, apart from the city, are optional.

[X] For an organization (ORG) to access the application as an admin, they need to be logged in.

How to run this project

Prisma npx prisma generate npx prisma migrate dev

About

The Find a Friend API is a Node.js and TypeScript-based project developed as part of the Rocketseat NodeJS course. Its primary goal is to provide a robust RESTful API with full CRUD operations, user authentication via JWT, and containerization using Docker.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published