A modern, full-stack bookstore application built with Spring Boot, Jimmer ORM, and Vue.js. This project demonstrates a complete e-commerce solution with user authentication, book management, social features, and a responsive web interface.
- Book Management: Browse, search, and manage books with detailed information
- Author System: Comprehensive author profiles and book-author relationships
- Publisher/Issuer Management: Track book publishers and their catalogs
- User Authentication: Secure JWT-based authentication system
- User Profiles: Personal profiles with contact information
- Comments & Reviews: Multi-level comment system for books, authors, and publishers
- Voting System: Like/dislike functionality for various content types
- Favorites: Save and organize favorite books, authors, and publishers
- Tagging System: Categorize books with custom tags
- Image Upload: Support for book covers and comment images
- Announcements: System-wide announcements and notifications
- Moderation: Role-based access control (User/Moderator)
- Responsive Design: Modern UI built with Naive UI components
- Real-time Updates: TanStack Query for efficient data fetching
- Type Safety: Full TypeScript support with generated API types
- Modern Styling: WindiCSS utility classes for consistent design
- Spring Boot 3.x: Core application framework
- Jimmer ORM: Type-safe SQL with Kotlin DSL
- PostgreSQL: Primary database
- Spring Security: Authentication and authorization
- JWT: Token-based authentication
- Kotlin: Primary programming language
Jimmer is a revolutionary ORM (Object-Relational Mapping) framework that brings type-safe SQL to Kotlin and Java applications. This project showcases Jimmer's powerful features:
- Type-Safe SQL: Write SQL queries with full compile-time type checking
- Kotlin DSL: Natural Kotlin syntax for building complex queries
- Auto-Generated Types: Automatic TypeScript client generation for frontend integration
- Spring Boot Integration: Seamless integration with Spring Boot applications
- Database Agnostic: Support for PostgreSQL, MySQL, Oracle, and more
The bookstore application leverages Jimmer's capabilities:
// Example: Type-safe query with Jimmer
val books = sqlClient
.createQuery(Book::class) {
where(table.price gt 50.0)
orderBy(table.name.asc())
select(table)
}
.execute()Jimmer automatically generates:
- TypeScript Types: Full type definitions for frontend consumption
- API Clients: Type-safe HTTP client code
- OpenAPI Documentation: Interactive API documentation
- Developer Experience: IntelliSense support and compile-time error detection
- Performance: Optimized SQL generation and execution
- Maintainability: Type-safe queries reduce runtime errors
- Productivity: Auto-generated code reduces boilerplate
To further enhance the Jimmer development experience, we strongly recommend installing the JimmerBuddy IntelliJ plugin
- Vue 3: Progressive JavaScript framework
- TypeScript: Type-safe development
- Naive UI: Component library
- TanStack Query: Data fetching and caching
- Vue Router: Client-side routing
- Pinia: State management
- WindiCSS: Utility-first CSS framework
- Vite: Build tool and dev server
- Gradle: Build system for backend
- Vite: Frontend build tool
- Prettier: Code formatting
- TypeScript: Static type checking
Before running this project, ensure you have:
- Java 21+: For Spring Boot backend
- Node.js 18+: For Vue.js frontend
- PostgreSQL 12+: Database server
- Git: Version control
git clone <repository-url>
cd jimmer-example-bookstore- Install PostgreSQL and create a database:
CREATE DATABASE postgres;
CREATE SCHEMA bookstore;- Run the DDL script to create tables:
psql -d postgres -f api/src/main/resources/ddl.sql- Navigate to the API directory:
cd api- Configure database connection in
src/main/resources/application.properties:
spring.datasource.url=jdbc:postgresql://localhost:5432/postgres?currentSchema=bookstore
spring.datasource.username=your_username
spring.datasource.password=your_password- Run the Spring Boot application:
./gradlew bootRunThe backend will start on http://localhost:8080
- Navigate to the web directory:
cd web- Install dependencies:
bun install- Start the development server:
bun run devThe frontend will start on http://localhost:5173
jimmer-example-bookstore/
├── api/ # Backend Spring Boot application
│ ├── src/main/kotlin/
│ │ └── cn/enaium/bookstore/
│ │ ├── controller/ # REST API controllers
│ │ ├── service/ # Business logic services
│ │ ├── model/ # Entity models and DTOs
│ │ ├── config/ # Configuration classes
│ │ ├── error/ # Custom error handling
│ │ └── utility/ # Utility classes
│ └── src/main/resources/
│ ├── application.properties
│ └── ddl.sql # Database schema
├── web/ # Frontend Vue.js application
│ ├── src/
│ │ ├── view/ # Page components
│ │ ├── layout/ # Layout components
│ │ ├── common/ # Shared components
│ │ ├── composables/ # Vue composables
│ │ ├── store/ # Pinia stores
│ │ └── router/ # Vue Router configuration
│ └── src/__generated/ # Auto-generated API types
└── README.md
Key configuration options in api/src/main/resources/application.properties:
# Database
spring.datasource.url=jdbc:postgresql://localhost:5432/postgres?currentSchema=bookstore
spring.datasource.username=root
spring.datasource.password=root
# JWT
jwt.secret=your-secret-key
jwt.expiration=86400000
# Jimmer ORM
jimmer.show-sql=true
jimmer.pretty-sql=true
jimmer.client.ts.mutable=true
# File uploads
bookstore.image.dir=imagesThe frontend automatically connects to the backend API. Update the API base URL in web/src/common/Api.ts if needed.
Jimmer automatically generates comprehensive API documentation and client code. Once the backend is running, you can access:
- OpenAPI Documentation:
http://localhost:8080/docs/openapi.html- Interactive API explorer - TypeScript Client:
http://localhost:8080/docs/ts.zip- Download auto-generated TypeScript types - OpenAPI Spec:
http://localhost:8080/docs/openapi.yml- Raw OpenAPI specification
The web/src/__generated/ directory contains all the auto-generated code from Jimmer:
- API Services: Type-safe HTTP client methods
- Type Definitions: Complete TypeScript interfaces
- Error Handling: Typed error responses
- Request/Response Models: Full type safety for API communication
cd api
./gradlew bootRun # Run server
./gradlew test # Run tests
./gradlew build # Build JARcd web
bun run dev # Start dev server
bun run build # Build for productionThe project uses Jimmer's code generation for TypeScript types:
cd web
./scripts/generate.ps1 # Generate API typesThe application uses a comprehensive database schema with the following main entities:
- Books: Core product information with editions and pricing
- Authors: Author profiles with gender and name information
- Issuers: Publisher/publishing company information
- Accounts: User authentication and profiles
- Comments: Multi-level comment system
- Votes: Like/dislike functionality
- Favourites: User favourite system
- Tags: Categorization system
- Images: File management for book covers and comments
The application uses JWT-based authentication with two user roles:
- USER: Standard user with basic permissions
- MODERATOR: Administrative user with additional privileges
The frontend uses a consistent design system with:
- Naive UI: Professional component library
- WindiCSS: Utility-first styling
- Vue Icons: Fluent icon set
- Build the JAR file:
cd api
./gradlew build- Run the application:
java -jar build/libs/jimmer-example-bookstore-0.0.1-SNAPSHOT.jar- Build the production bundle:
cd web
bun run build- Deploy the
distfolder to your web server
This project is licensed under the MIT License - see the LICENSE file for details.
- Jimmer ORM: For type-safe SQL with Kotlin
- Spring Boot: For robust backend framework
- Vue.js: For progressive frontend framework
- Naive UI: For beautiful UI components
Happy coding! 📚✨













