This is a REST API built with Java Spring Boot for managing a back-office application with Orders, Customers, Products, Categories, and Users.
- Java 17 or higher
- Maven 3.6 or higher
- PostgreSQL 12 or higher
- Install PostgreSQL if you haven't already
- Create a database named backoffice_db:
# Login to PostgreSQL
psql -U postgres
# Create database
CREATE DATABASE backoffice_db;
# Exit
\q- Update database credentials in src/main/resources/application.propertiesif needed:- Default username: postgres
- Default password: postgres
- Default database: backoffice_db
 
- Default username: 
# On Linux/Mac
./mvnw spring-boot:run
# On Windows
mvnw.cmd spring-boot:run# Clean and install dependencies
mvn clean install
# Run the application
mvn spring-boot:run# Build the JAR file
mvn clean package
# Run the JAR
java -jar target/backoffice-api-1.0.0.jarThe API will be available at: http://localhost:8080
- POST /api/auth/login- Login with email and password
- GET /api/users- Get all users
- GET /api/users/{id}- Get user by ID
- POST /api/users- Create new user
- PUT /api/users/{id}- Update user
- DELETE /api/users/{id}- Delete user
- GET /api/categories- Get all categories
- GET /api/categories/{id}- Get category by ID
- POST /api/categories- Create new category
- PUT /api/categories/{id}- Update category
- DELETE /api/categories/{id}- Delete category
- GET /api/products- Get all products
- GET /api/products/{id}- Get product by ID
- POST /api/products- Create new product
- PUT /api/products/{id}- Update product
- DELETE /api/products/{id}- Delete product
- GET /api/customers- Get all customers
- GET /api/customers/{id}- Get customer by ID
- POST /api/customers- Create new customer
- PUT /api/customers/{id}- Update customer
- DELETE /api/customers/{id}- Delete customer
- GET /api/orders- Get all orders
- GET /api/orders/{id}- Get order by ID
- POST /api/orders- Create new order
- PUT /api/orders/{id}- Update order
- DELETE /api/orders/{id}- Delete order
After the first run, a default admin user will be created:
- Email: admin@backoffice.com
- Password: admin123
The application uses Flyway for database migrations. The initial migration script is located at:
src/main/resources/db/migration/V1__create_initial_tables.sql
Migrations will run automatically when the application starts.
- Java 17
- Spring Boot 3.2.0
- Spring Data JPA
- Spring Security
- PostgreSQL
- Flyway (Database Migration)
- JWT (Authentication)
- Lombok
- Maven
src/main/java/com/backoffice/api/
├── config/          # Configuration classes (Security, CORS)
├── controller/      # REST Controllers
├── domain/          # Entity classes (JPA)
├── dto/             # Data Transfer Objects
├── repository/      # JPA Repositories
├── security/        # Security components (JWT)
└── service/         # Business logic services
If port 8080 is already in use, change it in application.properties:
server.port=8081- Make sure PostgreSQL is running
- Verify database credentials in application.properties
- Ensure the database backoffice_dbexists
# Clean Maven cache and rebuild
mvn clean install -U