A simple RESTful API built with Laravel for managing recipes and categories. It supports searching, category filtering, and JWT-based authentication for protected actions.
- 🔐 JWT Authentication
- 📄 CRUD for Recipes and Categories
- 🔎 Search recipes by name, category, or ingredients
- 🗂️ Filter recipes by category
- ✅ API Documentation via Swagger
http://your-domain.com/api
git clone https://github.com/VitorVieira20/Recipes-API.git
cd Recipes-API
composer install
cp .env.example .env
php artisan key:generate
# Configure your database (.env)
php artisan migrate
php artisan serveAll POST, PUT and DELETE requests require authentication via JWT.
Send your token in the Authorization header:
Authorization: Bearer YOUR_TOKEN
In your .env file, make sure to define your secret token key used for signing the JWT:
API_SECRET_TOKEN=your_secret_key_hereEnsure your application uses this key for running successfull tests. You can access it in your code with:
$secret = env('API_SECRET_TOKEN');Returns all recipes.
Search for recipes by name, category, or ingredients.
Get recipes belonging to a specific category.
Get a specific recipe by ID.
Create a new recipe.
Request body example:
{
"name": "Chocolate Cake",
"image": "https://example-image.com",
"description": "Some description",
"ingredients": ["2 eggs", "1 cup flour", "200g chocolate"],
"instructions": "Mix everything and bake.",
"category_id": 1,
}Update a recipe.
Request body example:
{
"name": "Updated Recipe Name",
"ingredients": ["New Ingredient 1", "New Ingredient 2"]
}Delete a recipe.
List all categories.
Create a new category.
Request body example:
{
"name": "Desserts"
}Update a category.
Delete a category.
php artisan testThe tests will automatically adapt based on the DB driver (MySQL or PostgreSQL).
This project uses OpenAPI annotations. You can generate the docs with:
php artisan l5-swagger:generateAccess the documentation at:
http://your-domain.com/api/documentation
- Laravel
- PostgreSQL / MySQL
- JWT Authentication
- OpenAPI (Swagger) for docs
This project is licensed under the MIT license.