A full-stack todo list application built with React, Redux Toolkit, RTK Query for the frontend, and Java Spring Boot for the backend.
-
Frontend (React + Redux Toolkit):
- Redux Toolkit for state management
- RTK Query for API calls with automatic caching
- Custom middleware for action logging
- Todo CRUD operations (Create, Read, Update, Delete)
- Filter todos by status (All, Active, Completed)
- Responsive UI with inline styles
-
Backend (Spring Boot):
- RESTful API with CRUD endpoints
- JPA/Hibernate for database operations
- H2 in-memory database
- CORS configuration for frontend integration
.
├── backend/ # Spring Boot backend
│ ├── src/
│ │ └── main/
│ │ ├── java/com/example/todoapp/
│ │ │ ├── TodoAppApplication.java
│ │ │ ├── config/
│ │ │ │ └── WebConfig.java
│ │ │ ├── controller/
│ │ │ │ └── TodoController.java
│ │ │ ├── model/
│ │ │ │ └── Todo.java
│ │ │ └── repository/
│ │ │ └── TodoRepository.java
│ │ └── resources/
│ │ └── application.properties
│ └── pom.xml
└── frontend/ # React frontend
├── public/
│ └── index.html
├── src/
│ ├── components/
│ │ ├── AddTodo.js
│ │ ├── TodoItem.js
│ │ └── TodoList.js
│ ├── features/todos/
│ │ ├── todosApi.js # RTK Query API
│ │ └── todosSlice.js # Redux slice with actions/reducers
│ ├── store/
│ │ └── store.js # Redux store with middleware
│ ├── App.js
│ ├── index.js
│ └── index.css
└── package.json
- Java 17 or higher
- Maven 3.6+
- Node.js 14+ and npm
-
Navigate to the backend directory:
cd backend -
(Optional) Configure CORS in
src/main/resources/application.properties:cors.allowed.origins=http://localhost:3000 -
Build and run the Spring Boot application:
mvn spring-boot:run
The backend will start on
http://localhost:8080 -
(Optional) Access H2 Console:
- URL:
http://localhost:8080/h2-console - JDBC URL:
jdbc:h2:mem:tododb - Username:
sa - Password: (leave empty)
- URL:
-
Navigate to the frontend directory:
cd frontend -
(Optional) Configure API URL in
.envfile:REACT_APP_API_URL=http://localhost:8080/api -
Install dependencies:
npm install
-
Start the development server:
npm start
The frontend will start on
http://localhost:3000
GET /api/todos- Get all todosGET /api/todos/{id}- Get a specific todoPOST /api/todos- Create a new todoPUT /api/todos/{id}- Update a todoDELETE /api/todos/{id}- Delete a todo
The Redux store is configured with:
- todosSlice: Manages filter state
- todosApi: RTK Query API slice for server communication
- Custom Middleware: Logs all dispatched actions and state changes
RTK Query automatically handles:
- Caching and invalidation
- Loading states
- Error handling
- Refetching on focus/reconnect
- setFilter: Action to change the filter (all/active/completed)
- Reducer automatically updates the filter state
- React 18.2
- Redux Toolkit 1.9.7
- RTK Query
- React Redux 8.1.3
- Spring Boot 3.1.5
- Spring Data JPA
- H2 Database
- Maven
Backend:
cd backend
mvn testFrontend:
cd frontend
npm testBackend:
cd backend
mvn clean package
java -jar target/todoapp-0.0.1-SNAPSHOT.jarFrontend:
cd frontend
npm run buildThis project is open source and available under the MIT License.