A comprehensive, enterprise-grade REST API for managing an encyclopedia of terms with advanced categorization, relationships, and multi-status support.
- 🎯 Overview
- 🚀 Quick Start
- 📚 Documentation
- ✨ Features
- 🏗️ Architecture
- 📊 Project Structure
- 🔌 API Endpoints
- 💾 Technology Stack
- 🧪 Testing & Quality
- 📈 Future Enhancements
- 📝 License
Imperial Pedia API is a production-ready REST API built with Spring Boot for managing a comprehensive encyclopedia database. It provides full CRUD operations with advanced features including multi-status workflows, automatic categorization, and intelligent term relationships.
Project Status: ✅ COMPLETE AND FULLY FUNCTIONAL
- Build Status: ✅ SUCCESS (0 Errors, 0 Warnings)
- Test Coverage: ✅ 58/58 PASSED (8 Test Classes)
- Compilation: ✅ 32/32 Source Files
- Deployment Ready: ✅ YES
- Java 22+
- Maven 3.8+
- PostgreSQL 17.8+
- Git/GitHub
# Clone the repository
git clone https://github.com/Sumit0ubey/ImperialPediaAPI
cd imperialpedia_api
# Build the project
mvn clean install
# Run the application
mvn spring-boot:runThe API will be available at http://localhost:8080/api
Comprehensive endpoint documentation with request/response examples, validation rules, and error scenarios.
Detailed project overview, features, architecture, and completion status.
Project overview and quick reference guide.
|
|
|
|
|
|
┌─────────────────────────────────────┐
│ HTTP / REST Controllers │
├─────────────────────────────────────┤
│ Business Logic Layer │
│ (Services + Interfaces) │
├─────────────────────────────────────┤
│ Data Access Layer │
│ (Repositories + Entities) │
├─────────────────────────────────────┤
│ Utility & Infrastructure │
│ (Utils, Config, Exception) │
└─────────────────────────────────────┘
- Separation of Concerns: Each layer has a single responsibility
- Dependency Injection: Loose coupling through Spring DI
- DRY (Don't Repeat Yourself): Utility classes for common operations
- SOLID Principles: Interface-based design and dependency inversion
src/main/java/com/imperialpedia/api/
│
├── 🎮 controller/
│ ├── DefaultController.java │ System info endpoint
│ ├── TermController.java │ Term operation endpoints
│ └── CategoryController.java │ Category retrieval and CRUD endpoints
│
├── ⚙️ service/
│ ├── TermService.java │ Core business logic
│ └── CategoryService.java │ Category operations
│
├── 💾 repository/
│ ├── TermRepository.java │ Term data access
│ └── CategoryRepository.java │ Category data access
│
├── 📦 dto/
│ ├── termdto/
│ │ ├── AddTerm.java │ Create/Update request
│ │ ├── TermDetailResponse.java │ Detail response
│ │ ├── TermListResponse.java │ List response
│ │ ├── RelatedTermResponse.java │ Related term info
│ │ └── Categories.java │ Category DTO
│ └── InfoResponse.java │ API info response
│
├── 🗂️ entity/
│ └── term/
│ ├── Term.java │ Main entity
│ ├── Category.java │ Category entity
│ ├── RelatedTerm.java │ Relationship entity
│ └── TermStatus.java │ Status enum
│
├── ⚠️ exception/
│ ├── GlobalExceptionHandler.java │ Centralized error handling
│ ├── ArgumentException.java │ Input validation errors
│ ├── ResourceNotFoundException.java │ 404 errors
│ ├── ResourceAlreadyExistsException.java │ 409 errors
│ ├── IntegrityViolationException.java │ Data integrity errors
│ └── TooManyRequestsException.java │ 429 errors
├── 🚦 filter/
│ └── RateLimitFilter.java │ Request throttling
│
├── 📤 response/
│ └── ApiResponse.java │ Response wrapper
│
├── 🛠️ util/
│ └── TermInputUtils.java │ Pure utility functions
│
├── ⚙️ configuration/
│ ├── ModelMapperConfig.java │ DTO mapping config
│ ├── OpenApiConfig.java │ Swagger/OpenAPI setup
│ ├── AppData.java │ App metadata
│ └── RateLimitProperties.java │ Rate-limit rule config
│
└── 📋 interfaces/
├── TermServiceInterface.java │ Term service contract
└── CategoryServiceInterface.java │ Category service contract
| Endpoint | Purpose |
|---|---|
GET /terms/letter/{letter} |
Published terms starting with letter |
GET /terms/archived?letter=X |
Archived terms (optional letter filter) |
GET /terms/draft?letter=X |
Draft terms (optional letter filter) |
GET /terms/slug/{slug} |
Term by slug |
GET /terms/{id} |
Term by UUID |
GET /addCategories[?letter=X] |
Categories (all or by starting letter) |
Base path: all endpoints are served under
/api.
| Endpoint | Purpose |
|---|---|
POST /terms/create |
Create new term |
POST /addCategories/create |
Create new category |
| Endpoint | Purpose |
|---|---|
PUT /terms/update/{id} |
Full update (all required fields) |
PATCH /terms/update/{id} |
Partial update (optional fields) |
PUT /addCategories/update/{id} |
Full category update |
PATCH /addCategories/update/{id} |
Partial category update |
| Endpoint | Purpose |
|---|---|
PUT /terms/publish/{id} |
Publish term |
PUT /terms/draft/{id} |
Move to draft |
PUT /terms/archive/{id} |
Archive term |
| Endpoint | Purpose |
|---|---|
DELETE /terms/delete/{id} |
Delete term |
DELETE /addCategories/delete/{id} |
Delete category |
| Endpoint | Purpose |
|---|---|
GET / |
API info & uptime |
| Category | Technology | Version |
|---|---|---|
| Language | Java | 22 |
| Framework | Spring Boot | 4.0.4 |
| ORM | Hibernate / JPA | 7.2.7 |
| Database | PostgreSQL | 17.8 |
| Build Tool | Apache Maven | Latest |
| Mapping | ModelMapper | Latest |
| Validation | Jakarta Validation API | Latest |
| API Docs | SpringDoc / OpenAPI | Latest |
| Logging | SLF4J | Latest |
Test Classes: 8
Test Methods: 58
Tests Run: 58/58
Failures: 0
Errors: 0
Success Rate: 100%
Compilation: 32/32 ✅
Warnings: 0
- ✅ Compilation: 0 errors, 0 warnings
- ✅ Code Organization: Clean layered architecture
- ✅ Error Handling: Centralized with GlobalExceptionHandler
- ✅ Validation: Comprehensive input validation
- ✅ Null Safety: Proper null-checks throughout
- ✅ Naming: Java/Spring best practices
- ✅ Dependencies: All properly resolved
All endpoints return consistent ApiResponse<T> wrapper:
{
"success": true,
"statusCode": 200,
"message": "Operation successful",
"data": { /* response data */ },
"timestamp": "2026-03-22T11:13:15"
}| Code | Meaning | When |
|---|---|---|
| 200 | OK | GET, PUT, PATCH success |
| 201 | Created | POST success |
| 204 | No Content | DELETE success |
| 400 | Bad Request | Validation failed |
| 404 | Not Found | Resource missing |
| 409 | Conflict | Duplicate slug |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Server Error | Unexpected error |
All inputs validated for:
- ✅ Null/blank checks
- ✅ Type validation
- ✅ Length constraints
- ✅ Pattern validation (slug format)
- ✅ Uniqueness checks (slugs, addCategories)
- ✅ Reference existence (related terms)
- ✅ Self-reference prevention
- ✅ Automatic normalization (lowercase, trim, deduplicate)
Priority enhancements for future versions:
- 🔐 Authentication & Authorization (Spring Security)
- 📄 Pagination (for list endpoints)
- 🔍 Full-Text Search (Elasticsearch)
- 💾 Caching Layer (Redis)
- 📊 Audit Trail (request logging)
- 🔄 Soft Delete (instead of hard delete)
- 🏷️ API Versioning (v1, v2, etc.)
- 📱 GraphQL Support (alternative to REST)
- 🧪 Integration Tests (expanded test suite)
Create .env file in project root (not included in Git):
# Database Configuration
DATABASE_HOST=localhost:5432
DATABASE_NAME=imperialpedia
DATABASE_USERNAME=postgres
DATABASE_PASSWORD=your_password
# App Metadata
APP_NAME="ImperialPedia API"
APP_DESCRIPTION="Backed service for ImperialPedia platform"
APP_VERSION=1.0.0
APP_ENVIRONMENT=local
APP_STATUS=UP
# CORS Configuration
CORS_ALLOWED_ORIGINS=http://localhost:3000
CORS_ALLOWED_ORIGIN_PATTERNS=
CORS_ALLOWED_METHODS=GET,POST,PUT,PATCH,DELETE,OPTIONS
CORS_ALLOWED_HEADERS=*
CORS_EXPOSED_HEADERS=X-Rate-Limit-Remaining,Retry-After
CORS_ALLOW_CREDENTIALS=true
CORS_MAX_AGE=3600
# Server Configuration
SERVER_PORT=8080
SERVER_SERVLET_CONTEXT_PATH=/api
# Logging
LOGGING_LEVEL=INFOSee src/main/resources/application.properties for detailed configuration.
- CORS settings are fully configurable using
cors.*properties (orCORS_*env variables). - When credentials are enabled, wildcard
*is not valid for origins/patterns. - Default local origin is
http://localhost:3000.
FROM openjdk:22-jdk-slim
COPY target/*.jar app.jar
ENTRYPOINT ["java", "-jar", "/app.jar"]# Build JAR
mvn clean package
# Run JAR
java -jar target/api-0.0.1-SNAPSHOT.jarPlease report issues with:
- Detailed description
- Steps to reproduce
- Expected vs actual behavior
- Environment details
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Development Team: Full Stack Development Project Lead: Architecture & Design Last Updated: March 23, 2026
- Spring Framework Team
- PostgreSQL Community
- Hibernate Team
- Open Source Contributors
Made with ❤️ for Excellence