RareKind is a backend Express.js API that powers a platform where users can showcase their exotic animals and browse collections created by others.
This repository pairs with the RareKind Frontend.
API documentation is available here.
The backend is deployed on Railway, uses MySQL, and integrates Cloudinary for image hosting.
RareKind provides a complete API for:
- User authentication
- Creating and managing collections
- Adding animals into collections
- Retrieving collections including full animal objects
- Image upload support via Cloudinary
The database schema was collaboratively designed using dbdiagram.io
And visualised using MySQL Workbench.
Make sure you have the following installed on your system:
- Node.js (v18 or higher)
- npm (v6 or higher)
- MySQL (v8 or higher)
- MySQL Workbench (optional, for visual DB inspection)
npm installCreate a .env file in the root of your project. Below is the exact format required for this application:
JWT_SECRET=
REFRESH_SECRET=
MYSQL_HOST=
MYSQL_PORT=53093
MYSQL_USER=root
MYSQL_PASSWORD=
MYSQL_DATABASE=railway
CORS_ORIGIN=SQL for creating the database
To start the backend:
npm startOnce the server is running, you can test routes using Postman
- User registration
- Login with JWT
- Hashed passwords (bcrypt)
- Full CRUD operations
- Each collection automatically includes its animals
- Add animals to a collection
- Retrieve all animals in a specific collection
- Includes classification, description, and Cloudinary image URLs
- Frontend receives full objects
- MySQL database hosted on Railway
- Backend deployed via Railway
- Schema drafted in dbdiagram.io
- Database visualised in MySQL Workbench
RareKind follows a clean and scalable Express.js structure:
- Models — handle SQL queries
- Controllers — business logic
- Routes — API endpoints
- Middleware — JWT validation, error handling
- Cloudinary integration — secure image uploads
- Node.js
- Express.js
- mysql2
- dotenv
- cors
- cookie-parser
- jsonwebtoken
- bcryptjs
- Cloudinary
- dbdiagram.io
- MySQL Workbench
- users
- collections
- animals
- classifications
- classification_animal
When testing endpoints we used an extension on VS code called Postman.
The Screenshot below shows testing the endpoint /auth/register
RareKind is deployed on Railway, featuring:
- Backend service
- MySQL production database
- Automatic builds and deploys
- Secure environment variables
Whenever we change database tables, models, controllers, or endpoints, update:
- Database schema /docs/rarekind_db
- models /src/models/
- controllers /src/controllers/
- routes /src/routes/
- API Documentation /docs/RareFind.yaml
- README endpoint Examples
