This project is an API built using Java, Java Spring, Flyway Migrations, PostgresSQL as the database, and Spring Security for authentication control.
The API simulates the functionality of a food delivery platform like iFood and Zé Delivery. Users can register themselves into the app, and logged-in users can search for nearby restaurant partners, while ADMIN users can register new partners in the API.
- Clone the repository:
git clone https://github.com/your-username/project-name.git
-
Install dependencies with Maven
-
Install PostgresSQL
-
Install Postgis Extension
- Start the application with Maven
- The API will be accessible at http://localhost:8080
The API provides the following endpoints:
GET /partners - Retrieve a list of all partners.
GET /partners/{partnerId} - Retrieve a specific partner by ID.
POST /partners - Register a new partner (ADMIN access required).
GET /partners/search - Search for partners near a specified location.
POST /auth/login - Login into the App
POST /auth/register - Register a new user into the App
The API uses Spring Security for authentication control. The following roles are available:
ROLE_USER - Standard user role for logged-in users.
ROLE_ADMIN - Admin role for managing partners (registering new partners).
To access protected endpoints as an ADMIN user, provide the appropriate authentication credentials in the request header.
The project utilizes PostgresSQL as the database. The necessary database migrations are managed using Flyway.
Also, this project is using the PostgresSQL extension Postgis to store coordinates in GeoJson pattern.
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request to the repository.
When contributing to this project, please follow the existing code style, commit conventions, and submit your changes in a separate branch.