Giter VIP home page Giter VIP logo

cat-adoption's Introduction

Cat Adoption Application

Welcome to the Cat Adoption Application! This full-stack application is built with NestJS for the backend and Vite React for the frontend.

Installation ✨

To get started with the development environment, follow these steps:

1. Clone this repository to your local machine:

git clone https://github.com/iamsrikanthnani/cat-adoption.git

2. Install dependencies for both the backend and frontend:

npm install

3. Set up environment variables for backend, do cd backend and then:

  • Copy the .env.example file and rename it to .env.
cp .env.example .env
  • Open the .env file in a text editor and fill in the following variables:
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_USER=[Your PostgreSQL Username]
POSTGRES_PASSWORD=[Your PostgreSQL Password]
POSTGRES_DB=[Your PostgreSQL Database Name]
JWT_SECRET_KEY=[Your JWT Secret Key]

Make sure to replace the values with appropriate ones based on your PostgreSQL configuration and desired JWT secret key.

4. Set up environment variables for frontend, do cd frontend and then:

  • Copy the .env.example file and rename it to .env.
cp .env.example .env
  • Open the .env file in a text editor and fill in the following variables:
VITE_API_URL=http://localhost:3000/[ADD BACKEND API URL]

Make sure to add the backend API URL to the frontend .env.

5. Start the development servers for both the backend and frontend:

npm run start

This will start both the backend server (NestJS) and frontend server (Vite React) concurrently.

Development Scripts ✨

  • npm run backend: Starts the backend server in development mode.
  • npm run frontend: Starts the frontend server in development mode.
  • npm start: Starts both the backend and frontend servers concurrently.
  • npm run install: Installs dependencies for both backend and frontend.
  • npm run clean: Cleans up dependencies and lock files for both backend and frontend.

Backend Endpoints ✨

Authentication 🌐

  • POST /auth/register: Register a new user and return a JWT.
  • POST /auth/login: Authenticate a user and return a JWT.

Cat Management 🌐

  • GET /cats: Retrieve a list of all cats.
  • POST /cats: Create a new cat profile (admin only).
  • GET /cats/{id}: Retrieve a cat profile by ID.
  • PUT /cats/{id}: Update a cat profile by ID (admin only).
  • DELETE /cats/{id}: Delete a cat profile by ID (admin only).
  • POST /favorites/add: Add a cat to favorites.
  • DELETE /favorites/remove: Remove a cat from favorites.
  • GET /favorites: Retrieve all favorite cats of the authenticated user.

Entity Relations ✨

In this project, I have established several entity relations to organize and manage data effectively. Below are the details of the entity relations:

👤 User to 🐱 Cat Relation

  • Description: Enables each user to have multiple cats associated with them.
  • Purpose: Facilitates better organization and management of cat data per user.
  • Implementation: This relation is established through a one-to-many association, where each user can have multiple cats.

👤 User to ⭐ Favorite Relation

  • Description: Enables each user to have multiple favorites associated with them.
  • Purpose: Allows users to save and manage their favorite cats effectively.
  • Implementation: This relation is established through a one-to-many association, where each user can have multiple favorites.

These entity relations play a crucial role in structuring the data and enhancing the functionality of the application.

Backend Test Results ✨

The following test suites have been meticulously executed and all tests have passed successfully:

  • (PASS ✅) src/auth/auth.service.spec.ts
  • (PASS ✅) src/auth/auth.controller.spec.ts
  • (PASS ✅) src/users/users.service.spec.ts
  • (PASS ✅) src/users/users.controller.spec.ts
  • (PASS ✅) src/cats/cats.service.spec.ts
  • (PASS ✅) src/cats/cats.controller.spec.ts
  • (PASS ✅) src/favorites/favorites.service.spec.ts
  • (PASS ✅) src/favorites/favorites.controller.spec.ts

All test suites passed successfully.

  • Test Suites: 8 passed, 8 total ✅
  • Tests: 52 passed, 52 total ✅
  • Snapshots: 0 total ✅
  • Time: 4.773s ✅

cat-adoption's People

Contributors

iamsrikanthnani avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.