A complete demo application using Spring Boot 3, Gradle, MyBatis-Plus, PostgreSQL, GraphQL, and Vue 3.
backend: Spring Boot 3 application with GraphQL API (Java)frontend: Vue 3 application with Apollo Client
- JDK 17+
- PostgreSQL
- Node.js 16+
- npm or yarn
- Create a PostgreSQL database:
CREATE DATABASE graphql_demo;- Then import the PostgreSQL database by running the
sql/graphql_demo.sql.
-
Configure the database connection in
src/main/resources/application.ymlif needed. -
Build and run the Spring Boot application:
./gradlew bootRunThe GraphQL API will be available at http://localhost:8080/graphql The GraphiQL interface will be available at http://localhost:8080/graphiql
- Navigate to the frontend directory:
cd frontend- Install dependencies:
npm install
# or
yarn install- Run the development server:
npm run dev
# or
yarn devThe Vue application will be available at http://localhost:5173
- Create, read, update, and delete tasks
- Mark tasks as completed
- GraphQL API with GraphiQL interface for testing
- Responsive Vue 3 frontend with Apollo Client
-
Backend:
- Spring Boot 3
- Gradle
- MyBatis-Plus
- PostgreSQL
- GraphQL Java
- Java 17
-
Frontend:
- Vue 3
- Apollo Client
- Vite
type Task {
id: ID!
title: String!
description: String
completed: Boolean!
createdAt: String!
updatedAt: String
}
type Query {
tasks: [Task]!
task(id: ID!): Task
}
type Mutation {
createTask(input: TaskInput!): Task!
updateTask(input: TaskUpdateInput!): Task
deleteTask(id: ID!): Boolean!
}