Skip to content

darwinz/books-database

Repository files navigation

Books Database

A full-stack web application for browsing a curated collection of books. Built with a React frontend and a Node.js/Express backend backed by PostgreSQL.

Tech Stack

Layer Technology
Frontend React, React Router
Backend Node.js, Express
Database PostgreSQL
Containerization Docker, Docker Compose

Prerequisites

  • Node.js >= 20.0.0
  • npm >= 10.0.0
  • Docker (for containerized setup)

Getting Started

Docker (Recommended)

The easiest way to run the full stack is with Docker Compose. This starts the React client, Express server, and a PostgreSQL database together.

Start all services:

npm run docker:start

App URLs:

Stop services:

npm run docker:stop

Tear down (including volumes):

npm run docker:down

Local Development

Run the server and client independently without Docker.

Server

cd server
npm install
npm test
npm start

The server runs on http://localhost:5000.

Client

cd client
npm install
npm test
npm start

The client runs on http://localhost:3000.


Docker Dev Mode (Hot Reload)

Run the full stack with file watching enabled so code changes apply automatically — no container rebuilds needed.

npm run docker:dev:start

This enables:

  • Client — React fast refresh via react-scripts
  • Server — automatic restart via nodemon

Stop dev mode:

npm run docker:dev:down

Stream logs:

npm run docker:logs

Database Seeding

On startup, the server automatically creates the books table and seeds it from server/db/seeds/books.json if the table is empty.

To disable auto-seeding, set the environment variable:

BOOKS_AUTO_SEED=false

To seed manually:

cd server
npm run db:seed

API

Method Endpoint Description
GET /books/:id Fetch a book by ID

About

An information database similar to IMDB, but for books

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages