The Real Estate API is a RESTful service for managing real estate data, such as companies, housing units, promotions, and geographical populations. Built with Spring Boot, it follows a layered architecture to promote clean separation of concerns and maintainability.
- Spring Boot
- Spring MVC
- Spring Data JPA
- **H2
- Swagger / OpenAPI
- Java 17+
- CRUD operations for:
- Companies
- Promotions
- Housing units
- Populations
- Real State
- Entity relationships (e.g. OneToMany, ManyToOne)
- Input validation using annotations
- Exception handling
- Swagger UI for testing and exploring the API
- Java 17+
- Maven 3.6+
- (Optional) MySQL if not using H2
- Clone the Repository
git clone https://github.com/Yannx79/Real-State-API.git
cd real-estate-api
- Configure the Database
# src/main/resources/application.yml
spring.datasource.url=jdbc:h2:mem:testdb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.h2.console.enabled=true
- Run the Application
./mvnw spring-boot:run
Resource | URL | Description |
---|---|---|
Swagger UI | http://localhost:8080/swagger-ui/index.html | Interactive API documentation |
H2 Console | http://localhost:8080/h2-console | In-memory database console (for H2) |
Base API URL | http://localhost:8080 |
Base path for all REST endpoints |
Table PROMOCION {
Codigo_Interno varchar [pk]
Nombre varchar
}
Table INMOBILIARIA {
Codigo_Interno varchar [pk]
Codigo_Em varchar [fk]
Importe decimal
}
Table VIVIENDA {
ID_Vivienda varchar [pk]
Superficie decimal
Numero_Habitaciones integer
Numero_Baños integer
Plano_Vivienda text
Foto text
Precio decimal
Terraza boolean
Jardin_Privado boolean
Piscina boolean
Garaje boolean
Codigo_Interno varchar [fk]
}
Table POBLACION {
Codigo_Poblacion varchar [pk]
Nombre varchar
Planos text
Codigo_Interno varchar [fk]
}
Table EMPRESA {
Codigo_Em varchar [pk]
Nombre varchar
Tipo varchar
Direccion varchar
Telefono varchar
Fax varchar
Email varchar
}
Ref: PROMOCION.Codigo_Interno < VIVIENDA.Codigo_Interno
Ref: PROMOCION.Codigo_Interno < POBLACION.Codigo_Interno
Ref: EMPRESA.Codigo_Em < INMOBILIARIA.Codigo_Em
# Set the Redis password in redis/.env
REDIS_PASSWORD="pass-example"
# Start the Redis container
docker compose -f redis/docker-compose.yml up -d
# Verify that the container is running
docker container ls
# Check the container logs
docker logs <container-id>