AutoCRUD is a Spring Boot-based REST API that automatically generates and manages CRUD operations for custom data structures defined by users. It allows users to define custom fields, channels, and entries, and easily manage authentication and ownership checks for secure data manipulation.
Allows users to log in and retrieve a token for subsequent requests.
- Request Body:
LoginRequestDTOcontainingemailandpassword. - Response:
LoginResponseDTOcontaining an authentication token.
Creates a new user with the specified email, password, and optional roles.
- Parameters:
email(required): The email address of the user.password(required): The password for the user.roles(optional): A list of roles for the user. Defaults toROLE_USERif not provided.
Creates a new channel based on the given information.
- Request Body:
ChannelDTOcontaining channel details. - Response:
ChannelDTOrepresenting the created channel.
Fetches the details of a channel by its ID.
- Authorization: Ownership validation is performed.
- Response:
ChannelDTOcontaining channel details.
Updates an existing channel by ID.
- Authorization: Ownership validation is performed.
- Request Body: Updated
ChannelDTOdetails. - Response: Updated
ChannelDTO.
Deletes a channel by its ID.
- Authorization: Ownership validation is performed.
- Response: Deleted
ChannelDTO.
Adds entries linked to a channel.
- Request Body: List of
EntryDTOrepresenting the entries to be added. - Response: List of created
EntryDTO.
Fetches an entry by its ID.
- Authorization: Ownership validation is performed.
- Response:
EntryDTOcontaining entry details.
Updates an entry by ID.
- Authorization: Ownership validation is performed.
- Request Body: Updated
EntryDTOdetails. - Response: Updated
EntryDTO.
Deletes an entry by its ID.
- Authorization: Ownership validation is performed.
Fetches details of a field by its ID.
- Authorization: Ownership validation is performed.
- Response:
FieldDTOcontaining field details.
Updates an existing field by its ID.
- Authorization: Ownership validation is performed.
- Request Body: Updated
FieldDTOdetails. - Response: Updated
FieldDTO.
- Java 21 or newer
- Maven
- MySQL database (can be configured through environment variables)
- Clone the repository.
- Set up a MySQL database and update the database URL, username, and password in
application.propertiesor use environment variables (DB_URL,DB_USERNAME,DB_PASSWORD). - Run the application using Maven:
mvn spring-boot:run
To run the tests, use the following command:
mvn testDB_URL: URL of the MySQL database (default:jdbc:mysql://localhost:3306/autocrud).DB_USERNAME: Username for the database (default:root).DB_PASSWORD: Password for the database (default:root).
- Authentication is required for most endpoints.
- Ownership validation (
@CheckOwnership) ensures that users can only access or modify resources they own.
- Java 21
- Spring Boot (including Spring Security)
- Maven for dependency management
- MySQL for data storage