TechBookStore is a working sample application for a technical bookstore:
- Backend: Spring Boot 2.3.12 (Java 8 target) REST API
- Frontend: React 16 + Material‑UI 4 single‑page app
- Data: H2 in-memory database for local development (seeded), PostgreSQL/Redis for staging/production-like profiles
- I18n: Japanese / English UI
This repository intentionally uses an older stack to serve as a realistic “legacy baseline” for experimentation.
- Browse/search a book catalog and view/edit book details
- Manage inventory operations (receive/sell/adjust, alerts, rotation/analysis)
- Manage customers and orders
- Explore dashboards and reports (sales/inventory/trends)
- Switch UI language (JA/EN)
backend/: Spring Boot APIfrontend/: React UIstart-app.sh: start backend + frontend together (writes logs and PID files to/tmp)status-app.sh: check process + health statusstop-app.sh: stop processes (optionally--clean-logs)Dockerfile: builds a single container image (frontend build + backend jar)
- JDK (Java 8 recommended; project compiles to Java 8 bytecode)
- Node.js (older versions work best with Create React App 4; the Docker build uses Node 12)
- npm
If you use a newer Node.js and see ERR_OSSL_EVP_UNSUPPORTED, set NODE_OPTIONS=--openssl-legacy-provider.
Start everything (backend + frontend):
./start-app.shCheck status:
./status-app.shStop:
./stop-app.shNotes:
-
The scripts write logs to:
/tmp/techbookstore_backend.log/tmp/techbookstore_frontend.log
-
The scripts store PIDs in:
/tmp/techbookstore_backend.pid/tmp/techbookstore_frontend.pid
-
start-app.shexpects the repository to be available at/workspace.- If you are not using a Dev Container / containerized workspace, use Option B below (manual start).
Backend (Spring Boot):
cd backend
./mvnw spring-boot:runFrontend (React):
cd frontend
npm install
npm start-
Frontend: http://localhost:3000
-
Backend health: http://localhost:8080/actuator/health
-
Swagger UI (Springfox): http://localhost:8080/swagger-ui.html
-
H2 Console (dev profile): http://localhost:8080/h2-console
- JDBC URL:
jdbc:h2:mem:testdb - Username:
sa - Password: (empty)
- JDBC URL:
Frontend (React) calls the backend via HTTP:
- Frontend dev server runs on
:3000 - Frontend
proxyforwards API calls tohttp://localhost:8080(seefrontend/package.json) - Backend exposes REST endpoints under
/api/v1/*
Data and caching:
- Dev profile (
SPRING_PROFILES_ACTIVE=dev, default): H2 in-memory DB and optional Redis (defaults to hostredis) - Staging profile: local PostgreSQL (
jdbc:postgresql://localhost:5432/techbookstore) - Prod profile: expects environment variables for PostgreSQL and Redis (see
backend/src/main/resources/application.yml)
Backend profiles are defined in backend/src/main/resources/application.yml.
Common environment variables:
SPRING_PROFILES_ACTIVE:dev(default),staging,prodCORS_ALLOWED_ORIGINS: defaulthttp://localhost:3000
Dev profile (Redis is optional):
REDIS_HOST(default:redis)REDIS_PORT(default:6379)
If you do not have Redis available locally, force an in-memory cache with:
SPRING_CACHE_TYPE=simple(equivalent tospring.cache.type=simple)
Staging profile (PostgreSQL):
DB_USERNAME(default:postgres)DB_PASSWORD(default:postgres)
Prod profile variables are currently named with an AZURE_* prefix (from the original deployment setup):
AZURE_POSTGRESQL_HOST,AZURE_POSTGRESQL_DATABASE,AZURE_POSTGRESQL_USERNAME,AZURE_POSTGRESQL_PASSWORDAZURE_REDIS_HOST,AZURE_REDIS_KEY
In the default dev profile, the database is created on startup and seeded from:
backend/src/main/resources/data.sql
High-level API groups (all under /api/v1):
/books: book catalog operations/inventory: inventory operations and analytics/reports: dashboards and reporting endpoints
API docs are exposed via Springfox (Swagger 2) at /swagger-ui.html.
Backend:
cd backend
./mvnw testFrontend:
cd frontend
npm testCI-style frontend tests:
cd frontend
npm run test:ciI18n validation helper:
validate-i18n.shexists, but it is currently hardcoded for a GitHub Actions runner path and may not work locally without adjustment.
The root Dockerfile builds:
- the frontend static build, then
- the backend jar, and
- runs the backend on port
8080.
Important:
- The container sets
SPRING_PROFILES_ACTIVE=prodby default. - In
prod, the backend expects PostgreSQL/Redis environment variables (see “Configuration”).
This repository is a sample app.
- Some configuration (including security) is intentionally simplified for demo and local use.
- Review and harden settings before using it as a production template.
Released under the MIT license
- GitHub: https://github.com/shinyay
- Twitter: https://twitter.com/yanashin18618
- Mastodon: https://mastodon.social/@yanashin