Skip to main content

Quickstart guide

This guide will get you up and running with the Adoptme API in just a few minutes. You’ll install the API, start the server, and make your first API call.

Prerequisites

Before you begin, ensure you have:
  • Node.js v22 or higher - Download Node.js
  • MongoDB - Running locally or a connection string to MongoDB Atlas
  • Git - For cloning the repository
The Adoptme API requires Node.js v22+. Check your version with node --version

Get started

1

Clone and install

Clone the repository and install dependencies:
git clone https://github.com/GitRepoFabi/coderhouse-backendIII.git
cd coderhouse-backendIII
npm install
2

Configure environment

Create a .env file in the root directory:
PORT=8080
MONGO_URL=mongodb://127.0.0.1:27017
DB_NAME=adoptme
For MongoDB Atlas, use your connection string: mongodb+srv://username:[email protected]
3

Start the server

Start the API server:
npm start
You should see:
Connection successful MongoDB
Listening on 8080
4

Make your first API call

Test the API with a simple request:
curl http://localhost:8080/api/pets
Expected response:
{
  "status": "success",
  "payload": []
}
The response will be empty initially since no pets have been added yet.

Try the interactive documentation

The Adoptme API includes Swagger UI for interactive API exploration:
  1. Open your browser and navigate to: http://localhost:8080/docs
  2. You’ll see all available endpoints
  3. Click on any endpoint to expand it
  4. Click “Try it out” to make requests directly from the browser

Generate mock data

Want to quickly populate your database with test data? Use the mock data endpoint:
curl -X POST "http://localhost:8080/api/mocks/generateData?user=5&pet=10"
This will create:
  • 5 mock users
  • 10 mock pets
  • Random adoption assignments
Now when you call GET /api/pets, you’ll see the generated pets!

What’s next?

Installation guide

Detailed setup instructions and troubleshooting

API reference

Explore all available endpoints

Authentication

Learn about JWT authentication

Mock data

Generate test data for development

Live deployment

Try the live API without installing anything: Base URL: https://coderhouse-backendiii-production.up.railway.app Swagger Docs: https://coderhouse-backendiii-production.up.railway.app/docs
# Example: Get all pets from the live API
curl https://coderhouse-backendiii-production.up.railway.app/api/pets

Build docs developers (and LLMs) love