Frontend application for the Library project.
This part contains the Vue/Vite user interface for authentication, browsing books, authors and categories, reading books, managing profile data, purchases, and admin purchase workflows.
- Vue 3
- Vite
- TypeScript
- Vue Router
- Pinia
- Axios
- Nginx for the Docker production image
frontend/
|-- src/
| |-- app/ # Root app component
| |-- components/ # Reusable and feature components
| |-- pages/ # Route-level views
| |-- router/ # Vue Router setup
| `-- shared/
| |-- api/ # Axios client, endpoint paths, API modules
| |-- config/ # Runtime environment parsing
| |-- lib/ # Shared helpers
| `-- stores/ # Pinia stores
|-- public/
|-- Dockerfile
|-- docker-compose.yml
|-- nginx.conf
|-- package.json
`-- .env.example
Create a local environment file before running the frontend:
cp .env.example .envImportant variables:
FRONTEND_HOSTandFRONTEND_PORTconfigure the Docker service.VITE_API_PREFIXandVITE_API_VERSIONbuild the relative API base path used by the browser.VITE_API_URLis used only by the local Vite dev proxy target and defaults tohttp://localhost:8000.VITE_APP_NAMEcontrols the displayed application name.VITE_AUTH_MODEcontrols auth mode. The current app supportscookieandtoken.VITE_AUTH_TOKEN_COOKIE_NAMEconfigures the cookie name used for admin bearer fallback.VITE_CSRF_COOKIE_NAMEandVITE_CSRF_HEADER_NAMEmust match backend CSRF settings.VITE_S3_PUBLIC_URLpoints to public MinIO/S3 assets.VITE_PAGE_SIZE,VITE_FREE_LIMIT, andVITE_PROFILE_PAGE_SIZEcontrol pagination and display defaults.
The frontend API client builds requests from:
VITE_API_PREFIX + VITE_API_VERSION
With the example environment this becomes:
/api/v1
In Docker, nginx proxies /api/ requests to the backend container.
In local npm run dev, the Vite dev server proxies /api/ requests to VITE_API_URL.
From the repository root, start the whole project:
docker compose up -d --buildFrom this directory, start only the frontend service:
docker compose up -d --buildDefault local URL from .env.example:
http://localhost:3000
Install dependencies:
npm installRun the dev server:
npm run devBuild for production:
npm run buildPreview the production build locally:
npm run preview- Root component:
src/app/App.vue - Routes:
src/router/index.ts - Pages:
src/pages/ - Layout components:
src/components/layout/ - Book components:
src/components/books/ - Shared API client:
src/shared/api/api.ts - Endpoint paths:
src/shared/api/paths.ts - Environment parsing:
src/shared/config/env.ts - Pinia stores:
src/shared/stores/
- Axios is configured with
withCredentials: true. - CSRF headers are added automatically for unsafe HTTP methods.
- A refresh request is attempted automatically after a
401response, except on the refresh endpoint itself. - Admin requests attach the
Authorizationheader from the configured auth token cookie.