3 min read

Bookshelf API

Bookshelf API is a simple RESTful API for managing book data. It supports the basic CRUD flow: listing books, viewing a single book, adding a new book, updating a book, and deleting a book.

The project was built as a backend learning project using the Hapi framework on Node.js, with a focus on understanding API routing, request handling, and resource-based endpoint design.

Overview

The API exposes a /books resource for bookshelf data. Each endpoint follows a straightforward REST pattern, making the project easy to test with tools like Postman or other API clients.

This project is intentionally small and focused. It is useful as a foundation for learning API structure before moving into larger systems with authentication, database persistence, validation layers, and deployment workflows.

Problem

Learning backend development requires more than writing isolated functions. A developer needs to understand how HTTP methods map to actions, how route parameters work, and how a server responds to client requests.

The goal of this project was to implement those fundamentals through a simple bookshelf API.

Role

I implemented the API routes, request handling, response behavior, and project documentation.

The project includes setup instructions and external API documentation for testing the endpoints.

Stack

  • Node.js for the runtime
  • Hapi for the HTTP API framework
  • JavaScript for the implementation
  • npm for dependency management
  • Postman for endpoint testing and documentation

Features

  • List all books
  • View a book by ID
  • Add a new book
  • Update an existing book
  • Delete a book by ID
  • Test endpoints through an API client

API Design

The API uses a simple REST structure:

MethodEndpointPurpose
GET/booksRetrieve all books
GET/books/{bookId}Retrieve a specific book by ID
POST/booksAdd a new book
PUT/books/{bookId}Update a book by ID
DELETE/books/{bookId}Delete a book by ID

This route structure keeps the resource model clear and easy to understand.

Implementation Notes

The project focuses on API fundamentals: route definition, HTTP method handling, path parameters, request payloads, and JSON responses.

Because it is a learning-focused API, the implementation is intentionally direct. It can be extended later with persistent storage, input validation, authentication, pagination, and better error handling.

Outcome

The result is a compact REST API that demonstrates the core workflow of resource management with Hapi and Node.js.

It works well as an introductory backend project and as a reference for building a predictable CRUD API structure.