An open API service indexing awesome lists of open source software.

https://github.com/aditya-620/todo-web-application-springboot

๐Ÿ“ A simple Todo Web Application built with Spring Boot, Spring Security, Spring Data JPA, and H2. Features include user authentication, CRUD operations, validation, and a responsive Bootstrap UI.
https://github.com/aditya-620/todo-web-application-springboot

bootstrap h2-database jpa jsp spring-boot spring-data-jpa spring-mvc spring-security

Last synced: about 2 months ago
JSON representation

๐Ÿ“ A simple Todo Web Application built with Spring Boot, Spring Security, Spring Data JPA, and H2. Features include user authentication, CRUD operations, validation, and a responsive Bootstrap UI.

Awesome Lists containing this project

README

          

# ๐Ÿ“ Todo Web Application - Spring Boot

This is a simple **Todo Web Application** built using **Spring Boot**. It allows users to manage their tasks with features like adding, updating, and deleting todos. The project leverages **Spring MVC**, **Spring Security**, **Spring Data JPA**, and an **H2 in-memory database** for fast and easy development.

---

## ๐Ÿš€ Features

- ๐Ÿ” **User Authentication**: Secured login with in-memory user details via Spring Security.
- ๐Ÿ“‹ **CRUD Operations**: Create, Read, Update, and Delete todos.
- โœ… **Validation**: Form validation for cleaner user input.
- ๐Ÿ“ฑ **Responsive UI**: Designed with Bootstrap for a modern and responsive layout.
- ๐Ÿ—ƒ๏ธ **In-Memory Database**: Uses H2 for rapid setup and testing.
- ๐Ÿ“… **Date Picker**: Bootstrap-integrated date picker for selecting target dates.

---

## ๐Ÿ“‚ Project Structure

### ๐Ÿ“ Controllers
- `WelcomeController`: Manages the welcome page and user session.
- `TodoControllerJpa`: Handles todo-related CRUD operations using JPA.
- `SayHelloController`: Demonstrates simple Spring MVC functionality.

### โš™๏ธ Services
- `TodoService`: Contains business logic for managing todos (non-JPA implementation).

### ๐Ÿ—ƒ๏ธ Repositories
- `TodoRepository`: Interface for data access using Spring Data JPA.

### ๐Ÿ“ฆ Entities
- `Todo`: Represents the todo model with fields such as `id`, `username`, `description`, `targetDate`, and `done`.

---

## โœ… Prerequisites

- Java 17 or higher
- Maven (or use the Maven Wrapper)

---

## ๐Ÿ› ๏ธ Getting Started

### 1. Clone the Repository

```bash
git clone
cd Todo-Web-Application-SpringBoot
```

### 2. Build the Project
```bash
./mvnw clean install
```

### 3. Run the Application
```bash
./mvnw spring-boot:run
```

- Maven (or use the Maven Wrapper)

---

## ๐ŸŒ Application Endpoints

### ๐Ÿ”“ Public Endpoints

- `GET /say-hello`
Returns a simple `"Hello"` message.

- `GET /say-hello-html`
Returns a basic HTML page.

- `GET /say-hello-jsp`
Renders a JSP page.

---

### ๐Ÿ” Secured Endpoints (require login)

- `GET /`
Welcome page after login.

- `GET /list-todos`
View the list of todos.

- `GET /add-todo`
Add a new todo item.

- `POST /update-todo?id={id}`
Update an existing todo with the specified ID.

- `POST /delete-todo?id={id}`
Delete a todo with the specified ID.

---

## ๐Ÿ’พ Database

This application uses an **H2 in-memory database** for development and testing.

- **H2 Console:** [http://localhost:8080/h2-console](http://localhost:8080/h2-console)

---

## ๐Ÿงฐ Technologies Used

- **Spring Boot** โ€“ Core framework
- **Spring MVC** โ€“ Web layer and controller routing
- **Spring Security** โ€“ Handles authentication and authorization
- **Spring Data JPA** โ€“ ORM and data persistence abstraction
- **H2 Database** โ€“ Lightweight in-memory DB for quick development
- **Bootstrap** โ€“ Frontend styling and responsive design
- **JSP** โ€“ View rendering on the server side

---

## โš™๏ธ Configuration

### `application.properties`

```properties
# View resolver settings
spring.mvc.view.prefix=/WEB-INF/jsp/
spring.mvc.view.suffix=.jsp

# H2 database configuration
spring.datasource.url=jdbc:h2:mem:testdb

# Date formatting
spring.mvc.format.date=yyyy-MM-dd
---
## ๐Ÿงช Running Tests

To run all tests, use the following command:

```bash
./mvnw test
```
---
## ๐Ÿ“ Folder Structure
```
Todo-Web-Application-SpringBoot/
โ”œโ”€โ”€ src/
โ”‚ โ”œโ”€โ”€ main/
โ”‚ โ”‚ โ”œโ”€โ”€ java/
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ com.adityarastogi.springboot.Todo_Web_Application_SpringBoot/
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ todo/ # Todo-related logic
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ login/ # Login and welcome logic
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ hello/ # Basic Spring MVC examples
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ security/ # Spring Security configuration
โ”‚ โ”‚ โ”œโ”€โ”€ resources/
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ META-INF/resources/WEB-INF/jsp/ # JSP views
โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ application.properties # App config
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ data.sql # Initial data
โ”‚ โ””โ”€โ”€ test/ # Unit tests
โ”œโ”€โ”€ pom.xml # Maven config
โ””โ”€โ”€ README.md # Project documentation
```
---
## ๐Ÿ“ฌ Contact

- Feel free to open an issue or submit a pull request if you find bugs or want to contribute improvements!
---