- Require a session on every route; public routes opt out with @allow_anonymous - Split password hashing and pepper loading into passwords.py - Add a system/light/dark theme toggle backed by light-dark() colors - Ignore stale 401s from an earlier session, PATCH only changed book fields, and block overlapping journal-entry saves - Add bin/start and CoderPad Vite server settings for the pad's start/restart - Rewrite README as a mise onboarding guide; expand .gitignore - Include review-round fixes and tests
72 lines
2.2 KiB
Markdown
72 lines
2.2 KiB
Markdown
# My Library
|
||
|
||
A personal book tracker. You sign up, add the books you own, track how far you are in each one, and keep a
|
||
reading journal for every book. You can search your library by title or author and filter it by genre. Each
|
||
user sees only their own books.
|
||
|
||
It is a Flask (Python) API with a React (TypeScript) frontend, backed by PostgreSQL.
|
||
|
||
## What you need
|
||
|
||
- [mise](https://mise.jdx.dev) – installs the right versions of Python, Node and the other tools for you
|
||
- [Docker](https://www.docker.com) – runs the PostgreSQL database
|
||
|
||
## First-time setup
|
||
|
||
```bash
|
||
mise trust # allow mise to use this project's mise.toml
|
||
mise install # install Python, Node, uv, ruff and biome
|
||
mise run setup # create the Python virtual environment and install all dependencies
|
||
```
|
||
|
||
## Run the app
|
||
|
||
```bash
|
||
mise run dev
|
||
```
|
||
|
||
This starts the database, the API (port 5000) and the web app. Open http://localhost:5173 and create an
|
||
account. Press `Ctrl+C` to stop it.
|
||
|
||
You can also start the parts on their own: `mise run db`, `mise run dev:api` and `mise run dev:web`.
|
||
|
||
To stop the database when you are done, run `docker compose down`.
|
||
|
||
## Run the tests
|
||
|
||
```bash
|
||
mise run test # everything
|
||
mise run test:py # backend only
|
||
mise run test:ts # frontend only, plus the type check
|
||
```
|
||
|
||
The backend tests use a real PostgreSQL database called `books_test`. It is created for you, so the database
|
||
from `mise run db` just needs to be running (the test task starts it).
|
||
|
||
## Lint and format
|
||
|
||
```bash
|
||
mise run format # fix formatting and import order (writes changes)
|
||
mise run lint # check linting, formatting and types without changing files
|
||
```
|
||
|
||
Run `mise run lint` and `mise run test` before you push.
|
||
|
||
## Change backend dependencies
|
||
|
||
Edit `backend/requirements.in`, then run:
|
||
|
||
```bash
|
||
mise run lock # rebuild the pinned backend/requirements.txt
|
||
mise run setup # install the new versions
|
||
```
|
||
|
||
## Settings
|
||
|
||
- `DATABASE_URL` – the PostgreSQL connection string. It defaults to the local Docker database.
|
||
- `PASSWORD_PEPPER` – a secret of at least 32 characters used when storing passwords. If you do not set it,
|
||
a development value is created in `backend/.pepper` and a warning is logged. Always set it outside local
|
||
development.
|
||
|
||
Run `mise tasks` to see every available task.
|