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: โ 1/1 PASSED
- Compilation: โ 32/32 Source Files
- Deployment Ready: โ YES
- Java 22+
- Maven 3.8+
- PostgreSQL 17.8+
- Git
# 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.
๐ View Project Summary
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 โ 12 term operation 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 โ 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 |
Base path: all endpoints are served under
/api.
| Endpoint | Purpose |
|---|---|
POST /terms/create |
Create new term |
| Endpoint | Purpose |
|---|---|
PUT /terms/update/{id} |
Full update (all required fields) |
PATCH /terms/update/{id} |
Partial update (optional fields) |
| 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 |
| 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 |
Tests Run: 1/1
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, categories)
- โ 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=active
# Server Configuration
SERVER_PORT=8080
SERVER_SERVLET_CONTEXT_PATH=/api
# Logging
LOGGING_LEVEL=INFOSee src/main/resources/application.properties for detailed configuration.
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