PropSync is a property management application built using Spring Boot. It provides a backend API for managing properties with features such as user authentication, and CRUD operations for properties.
- Features
- Technologies Used
- Getting Started
- Configuration
- Usage
- Endpoints
- Development
- Contributing
- License
- User authentication (Login/Logout)
- CRUD operations for properties (View, Create, Update, Delete)
- Spring Boot
- Spring Data JPA
- Hibernate
- MySQL (or H2 for development)
- Lombok
- Spring DevTools
- Java 8 or higher
- Maven
- MySQL (for production) or H2 (for development)
-
Clone the repository:
git clone https://github.com/your-username/prop-sync.git
-
Navigate to the project directory:
cd prop-sync
-
Build the project:
mvn clean install
-
Run the application:
mvn spring-boot:run
Configure the application properties in src/main/resources/application.properties
or src/main/resources/application.yml
according to your database and application requirements.
# Database Configuration
spring.datasource.url=jdbc:mysql://localhost:3306/propsync
spring.datasource.username=root
spring.datasource.password=password
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.jpa.hibernate.ddl-auto=update
# Development Configuration
spring.h2.console.enabled=true
spring.h2.console.path=/h2-console
-
Login: Use the
/login
endpoint with valid credentials to authenticate and receive a token.POST /login Content-Type: application/json { "username": "your-username", "password": "your-password" }
Response:
{ "token": "your-access-token" }
-
Logout: Use the
/logout
endpoint to logout and invalidate the token.POST /logout Authorization: Bearer your-access-token
-
Create Property: Use the
/api/v1/properties
endpoint with a POST request to create a new property.POST /api/v1/properties Content-Type: application/json Authorization: Bearer your-access-token { "name": "Property Name", "description": "Property Description", "price": 100000 }
-
Update Property: Use the
/api/v1/properties/{propertyId}
endpoint with a PUT request to update an existing property.PUT /api/v1/properties/{propertyId} Content-Type: application/json Authorization: Bearer your-access-token { "name": "Updated Property Name", "description": "Updated Property Description", "price": 120000 }
-
Delete Property: Use the
/api/v1/properties/{propertyId}
endpoint with a DELETE request to delete a property.DELETE /api/v1/properties/{propertyId} Authorization: Bearer your-access-token
-
View Properties: Use the
/api/v1/properties
endpoint with a GET request to retrieve a list of all properties.GET /api/v1/properties Authorization: Bearer your-access-token
-
Authentication:
POST /login
: Authenticate and receive an access token.POST /logout
: Logout and invalidate the access token.
-
Property Management:
POST /api/v1/properties
: Create a new property.PUT /api/v1/properties/{propertyId}
: Update an existing property.DELETE /api/v1/properties/{propertyId}
: Delete a property.GET /api/v1/properties
: Retrieve a list of all properties.
For development, H2 database is used by default. Access the H2 console at http://localhost:8080/h2-console
with JDBC URL jdbc:h2:mem:testdb
, username sa
, and an empty password.
If you'd like to contribute, please fork the repository and create a pull request. We appreciate your contributions!
This project is licensed under the MIT License.
Feel free to customize this README.md
according to your specific requirements and add more details as needed.