Online auction platform
Prettier is configured to format the staged files and commit. using husky pre-commit hook
to skip the formatting use the git commit
with -n
or --no-verify
flag also add files to .prettierignore file to ignore the formatting
- Java 21
- Maven
- Docker
- Change directory to backend
cd backend
- Start the docker container for the database
docker compose up
- Run the backend
./mvnw spring-boot:run
### without wrapper
mvn spring-boot:run
Flyway is used to manage the database migrations in AuctiX application.
The migrations are stored in the backend/src/main/resources/db/migration
directory.
The migrations should be created in the following format:
V{version}__{description}.sql
Example:
-
V1__create_user_table.sql
CREATE TABLE user ( id SERIAL PRIMARY KEY, username VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL );
-
V2__add_profile_pic_url_col_to_user_table.sql
ALTER TABLE user ADD COLUMN profile_pic_url VARCHAR(255);
The migrations will be applied to the database when the application is started.
Endpoint:
POST /api/auth/register
Request Body:
{
"email": "[email protected]",
"username": "exampleUser",
"password": "securePassword",
"role": "SELLER"
}
Response:
200 OK → User registered successfully
400 Bad Request → Invalid request
Endpoint:
POST /api/auth/login
Request Body:
{
"email": "[email protected]",
"password": "securePassword"
}
Response:
200 OK → Returns JWT token
401 Unauthorized → Email or password incorrect
Include the token in the Authorization header for protected routes.
Example:
Authorization: Bearer <your-jwt-token>