Welcome to the Cat Adoption Application! This full-stack application is built with NestJS for the backend and Vite React for the frontend.
To get started with the development environment, follow these steps:
git clone https://github.com/iamsrikanthnani/cat-adoption.git
npm install
- 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.
- 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
.
npm run start
This will start both the backend server (NestJS) and frontend server (Vite React) concurrently.
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.
POST /auth/register:
Register a new user and return a JWT.POST /auth/login:
Authenticate a user and return a JWT.
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.
In this project, I have established several entity relations to organize and manage data effectively. Below are the details of the entity relations:
- 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.
- 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.
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 ✅