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
-
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.
The API serves two main user groups:
-
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.
-
User Portal: Individuals interested in adopting a pet can create user accounts and search for animals available for adoption in their vicinity.
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.
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"
[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).
[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.
Prisma npx prisma generate npx prisma migrate dev