This project is a backend service built using Spring Boot and Java. It exposes RESTful API endpoints for managing
resources in a PostgreSQL database. The application is containerized using Docker, enabling easy deployment and
scaling.
For Security of endpoints and app, This project implements spring-security. All endpoints (if required) are secured to
be accessed by only authentic users.
- Java:
opne jdk: v22.0. - Spring Boot:
v3.3.3. - PostgreSQL:
v16.0. - Docker: with
docker-compose v3.0. - Maven:
v4.0.0.
- RESTful API endpoints for CRUD operations.
- User authentication and authorization.
- Integration with PostgreSQL for persistent storage.
- Dockerized application for easy deployment.
https://github.com/abhijeet-Bh/hatio-assignment.git./mvnn clean installYou can run the application using Maven or Docker.
-
Download & Install PostgreSQL database
-
Connect to the PostgreSQL database:
Ensure PostgreSQL is running and configured as per
application.properties.spring.application.name=app spring.datasource.url=jdbc:postgresql://localhost:5432/<your-database-name> spring.datasource.username=<your-db-usename> spring.datasource.password=<your-password> spring.datasource.driver-class-name=org.postgresql.Driver ## Hibernate (JPA) Properties spring.jpa.hibernate.ddl-auto=update spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
-
Run the Spring Boot application:
./mvnw spring-boot:run
The application will start on
http://localhost:8080.
-
Build and run the Docker containers:
To run with docker-compose, you just need to setup
.envfile in the root directory as given below# PostgreSQL database configuration for Docker POSTGRES_DB=<your-db-name> POSTGRES_USER=<your-db-user> POSTGRES_PASSWORD=<your-db-password> SPRING_DATASOURCE_URL=jdbc:postgresql://db:5432/<your-db> SPRING_DATASOURCE_USERNAME=<your-db-name> SPRING_DATASOURCE_PASSWORD=<your-db-user> SPRING_JPA_HIBERNATE_DDL_AUTO=update
Now, you can run below command to run
Todoapp :)docker-compose up --build
This command will start the Spring Boot application and PostgreSQL database in Docker containers.
Here’s a list of all API endpoints for the Todo App Backend. These endpoints cover the main functionalities for managing projects, todos, exporting project-summary as gist or downloading it.
These endpoints handle public-related operations such as health-check and login.
| HTTP Method | Endpoint | Description | Access Role |
|---|---|---|---|
| GET | /api/v1/healthz |
Check running status of the backend | OPEN |
| POST | /api/v1/auth/signup |
Create New User Account | OPEN |
| POST | /api/v1/auth/login |
CLogin User with username & password |
OPEN |
These endpoints handle project-related operations for managing the project.
| HTTP Method | Endpoint | Description | Access Role |
|---|---|---|---|
| GET | /api/v1/projects |
Get All Projects | Authenticated |
| POST | /api/v1/projects |
Create New Project | Authenticated |
| PUT | /api/v1/projects |
Update New Project | Authenticated |
| GET | /api/v1/projects/{id} |
Get Project by Id | Authenticated |
| DELETE | /api/v1/projects/{id} |
Delete Project by Id | Authenticated |
These endpoints handle Todo-related operations for managing the project.
| HTTP Method | Endpoint | Description | Access Role |
|---|---|---|---|
| GET | /api/v1/projects/{project-Id}/todos |
Get All Todos of the particular project | Authenticated |
| POST | /api/v1/projects/{project-Id}/todos |
Create New todo for the particular project | Authenticated |
| PATCH | /api/v1/projects/{project-Id}/todos/{todo-Id}/complete |
Mark a todo complete | Authenticated |
| PATCH | /api/v1/projects/{project-Id}/todos/{todo-Id}/pending |
Mark a todo pending | Authenticated |
| PUT | /api/v1/projects/{project-Id}/todos/{todo-Id} |
Update Todo | Authenticated |
| DELETE | /api/v1/projects/{project-Id}/todos/{todo-Id} |
Delete Todo by Id | Authenticated |
These endpoints handle gist-related operations for downloading and exporting the the project-summary.
| HTTP Method | Endpoint | Description | Access Role |
|---|---|---|---|
| GET | /api/v1/projects/{project-Id}/download-summary |
Download project-summary | Authenticated |
| POST | /api/v1/projects/{project-Id}/export-gist?githubToken=your-token |
Export Project Summary to giHub gist | Authenticated |
Gist that i created while developing this project is here
Thanks :)