A Laravel-based API for a healthy food marketplace, Nutrilicious. The API allows users to browse and purchase products from various companies, manage their cart, and enables company administrators to manage their products.
-
User Authentication: Authentication is implemented using Laravel Breeze for session-based authentication and Sanctum for API token authentication, providing secure access to the API endpoints.
-
Product Management: Users can view, search, and purchase products from various companies. Company administrators can add, update, and delete their products.
-
Cart Management: Users can add products to their cart, view the contents of their cart, update quantities, remove products, and clear their cart.
-
Twilio Integration: Upon successful purchase, users receive a WhatsApp message confirming their order, implemented using the Twilio API.
The project structure is organized as follows:
- Controllers: Contains controllers for handling user, company, and admin operations.
- Models: Contains model classes representing database entities like users, products, orders, etc.
- Database Migrations and Seeds: Database migrations and seeds for setting up the database schema and initial data.
- Routes: Contains API routes for various endpoints.
- Middleware: Custom middleware for authorization and other operations.
- Tests: Contains PHPUnit tests for testing API endpoints.
-
Clone the repository:
git clone https://github.com/NathaRuiz/P10-Nutricilious_BackEnd.git
-
Navigate to the project directory:
cd project-directory
-
Install dependencies using Composer:
composer install
-
Install frontend dependencies using npm:
npm install
-
Set up the environment variables:
- Copy the
.env.example
file to.env
and configure the database connection, Twilio credentials, and other environment variables as needed.
- Copy the
-
Run the migrations to set up the database:
php artisan migrate
-
Seed the database with sample data (optional):
php artisan db:seed
-
Start the development server:
php artisan serve
- Register an account or log in using the provided authentication routes.
- Browse products, add them to your cart, and proceed to purchase.
- Company administrators can manage their products by adding, updating, or deleting them.
- Upon successful purchase, users will receive a WhatsApp message confirming their order.
- Laravel Breeze: Provides simple and minimalistic authentication views and routes.
- Laravel Sanctum: Provides a lightweight authentication system for APIs.
- Twilio SDK: Allows sending WhatsApp messages for order confirmation.
- Other Laravel dependencies: Axios, Illuminate/Support, Illuminate/Http, Illuminate/Database, etc.
Contributions are welcome! Please fork the repository, make your changes, and submit a pull request.
This project is licensed under the MIT License.