This is a Fullstack project for displaying and managing quotes. It allows users to view random quotes, search for quotes by various criteria, and manage (create, edit, delete) quotes through an interactive interface.
https://quotes-xi-five.vercel.app/
Follow instructions in the database/seed/README.md file to fill database with quotes and categories.
All necessary database files are located in the database/data.
Main Docker mode uses published Docker Hub images:
serhii5105/quotes-server:latestserhii5105/quotes-client:latest
cd QuotesCopy-Item server/.env.sample server/.envCopy-Item client/.env.sample client/.env- Replace description strings in
server/.envandclient/.envwith real values - For Docker mode set in
server/.env:DB_HOST=postgres - Optional for Adminer convenience:
ADMINER_DEFAULT_SERVER=postgres npm run docker:refresh
Services:
- Client:
http://localhost:4000 - API:
http://localhost:3001 - Adminer:
http://localhost:8080
Notes:
- Postgres is available only inside the Docker network by default.
- In this mode the frontend runs from the published image.
PORTandHOSTNAMEfromclient/.envare used at runtime.NEXT_PUBLIC_API_URLfromclient/.envdoes not rebuild or reconfigure the published image on its own.- If you change frontend env that affects the build, rebuild and push a new
quotes-clientimage first.
To stop containers:
npm run docker:down
To stop containers and remove the database volume:
npm run docker:down:volumes
Development Docker mode uses local Dockerfiles and bind mounts.
cd QuotesCopy-Item server/.env.sample server/.envCopy-Item client/.env.sample client/.env- Replace description strings in
server/.envandclient/.envwith real values - For Docker mode set in
server/.env:DB_HOST=postgres - In
client/.envset:HOSTNAME=0.0.0.0 npm run docker:dev
This mode runs:
- server via
nodemon - client via
next dev - local dev images from
server/Dockerfile.devandclient/Dockerfile.dev
To stop it:
npm run docker:dev:down
Rebuild and push new images after:
- backend or frontend code changes
- dependency updates
- Dockerfile changes
- base image updates
Commands:
docker build -t serhii5105/quotes-server:latest ./server
docker push serhii5105/quotes-server:latest
docker build -t serhii5105/quotes-client:latest ./client
docker push serhii5105/quotes-client:latestThen refresh local containers:
npm run docker:refreshcd serverCopy-Item .env.sample .env- Set local database values such as
DB_HOST=localhost npm installnpm run dev
cd clientCopy-Item .env.sample .envnpm installnpm run dev
app
├── _components # Shared components like buttons and forms
├── _config # Configuration files, including API endpoints
├── _queries # Tanstack queries for fetching data
├── _services # Services for interacting with the API
├── _utils # Utility functions for fetching data and helper functions
└── (routes) # Dynamic routes for handling different pages
├── quotes # Routes related to managing quotes
│ ├── [id] # Routes related to single quote
│ │ └── edit # Route for editing single quote
│ └── create # Route for creating a single quote
├── search # Route related to searching for quotes
├── fonts # Custom font files
├── globals.css # Global CSS styles
├── layout.js # Main layout component
└── page.js # Page for displaying random quotes
└── query-provider.js # Query provider for Tanstack queries
The app interacts with the following backend API endpoints:
- GET
/random: Fetches random quotes. - GET
/quotes: Fetches and searches for quotes (e.g., by text, author, category). - POST
/quotes: Creates a new quote. - GET
/quotes/:id: Fetches a specific quote by its ID. - PATCH
/quotes/:id: Edits an existing quote. - DELETE
/quotes/:id: Deletes a quote.