A streamlined pet adoption search application using the Petfinder API to find cats, dogs, and other adoptable pets without advertisements.
- Simple, Clean Interface: Focus on what matters - the pets available for adoption
- Responsive Design: Works on desktop, tablet, and mobile devices
- Advanced Filtering: Filter by animal type, gender, age, and distance
- Detailed Information: View comprehensive details about each pet
- Local Caching: Reduces API usage and improves performance
- Organization Details: Learn about the adoption agencies and shelters
- Node.js (v14 or higher)
- Petfinder API credentials (obtain from Petfinder's Developer Portal)
-
Clone this repository:
git clone https://github.com/yourusername/pspsps.git cd pspsps -
Create a
.envfile in the root directory with your Petfinder API credentials:PETFINDER_API_KEY=your_api_key PETFINDER_API_SECRET=your_api_secret -
Run the start script to install dependencies and start the Netlify development server:
./start-dev.shThis will:
- Install the required dependencies
- Start the Netlify Dev server on port 8888
- Set up the serverless function for API proxying
Alternatively, you can run these steps manually:
npm install cd netlify/functions && npm install && cd ../.. npx netlify dev -
Open your browser and navigate to:
http://localhost:8888
This application implements a client-side caching mechanism to reduce API requests and improve performance:
- Search Results Caching: Searches with the same location and filters are cached
- Pet Details Caching: Individual pet details are cached by ID
- Organization Caching: Shelter/rescue information is cached
- Cache Expiration: All cached data expires after 24 hours
- Storage Management: Automatically clears oldest entries when storage is full
The application uses a Netlify serverless function to proxy requests to the Petfinder API, which handles:
- Authentication with the Petfinder API
- Token refreshing
- Error handling
- Rate limiting protection
/js: Main application JavaScript files/netlify/functions: Serverless functions for API proxying/images: Application images and assets/styles.css: Main stylesheet
If you encounter issues with the API proxy:
-
Test the API connection directly:
node debug-api.jsThis will verify if the Petfinder API is working correctly with your credentials.
-
Test the serverless function:
node test-serverless.jsThis tests the serverless function directly without going through Netlify Dev.
-
Common issues:
- Make sure your API requests go to
/.netlify/functions/petfinder-proxy/... - Check browser console for detailed error messages
- Verify your .env file has the correct API credentials
- Try clearing your browser cache if you see stale data
- Make sure your API requests go to
- Push your repository to GitHub
- Log in to Netlify and create a new site from your GitHub repository
- Add the following environment variables in the Netlify dashboard:
PETFINDER_API_KEY: Your Petfinder API keyPETFINDER_API_SECRET: Your Petfinder API secret
- Deploy your site
Netlify will automatically detect the netlify.toml configuration and deploy the site with the serverless function.
See the LICENSE file for details.
- Petfinder API for providing pet data
- All the animal shelters and rescues doing the important work of caring for animals in need

