Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"YoavBls.pretty-ts-errors",
"bradlc.vscode-tailwindcss"
"bradlc.vscode-tailwindcss",
"yzhang.markdown-all-in-one"
]
}
11 changes: 10 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
{
"js/ts.preferences.importModuleSpecifier": "non-relative"
"js/ts.preferences.importModuleSpecifier": "non-relative",
"cSpell.words": [
"configtest",
"enconf",
"enmod",
"Goodreads",
"ntnu",
"Readr",
"usermod"
]
}
32 changes: 31 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
# Contributing to Readr
# Contributing to Readr <!-- omit in toc -->

- [Overview](#overview)
- [Git usage](#git-usage)
- [Commits](#commits)
- [Branches](#branches)
- [Creating issues](#creating-issues)
- [Code style](#code-style)
- [Function definitions](#function-definitions)
- [Exports](#exports)
- [Generated files](#generated-files)
- [Lucide icons](#lucide-icons)
- [SQL Code](#sql-code)
- [Components](#components)
- [Folder structure](#folder-structure)
- [Definitions](#definitions)
- [VS Code Extensions](#vs-code-extensions)
- [Documentation tables of contents](#documentation-tables-of-contents)
- [Pull requests](#pull-requests)
- [Checklist beforehand](#checklist-beforehand)
- [Creating a pull request](#creating-a-pull-request)
- [Working in this repository](#working-in-this-repository)

## Overview

Thank you for contributing to the project!
We appreciate all issues, pull requests and other comments regarding the project.
Expand Down Expand Up @@ -220,10 +243,17 @@ Recommended extensions (in alphabetical order):
- [Auto Rename Tag](https://marketplace.visualstudio.com/items?itemName=formulahendry.auto-rename-tag)
- [Code Spell Checker](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker)
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
- [Markdown All in One](https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one)
- [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
- [Pretty TypeScript Errors](https://marketplace.visualstudio.com/items?itemName=yoavbls.pretty-ts-errors)
- [Tailwind CSS IntelliSense](https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss)

### Documentation tables of contents

The table of contents of a documentation file MUST be updated when its headings change. Markdown All in One does this when you save the file, so installing it is RECOMMENDED.

Headings that should not be in the table of contents, such as the page title, SHOULD be marked with `<!-- omit in toc -->`.

## Pull requests

### Checklist beforehand
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ Check out [CONTRIBUTING.md](./CONTRIBUTING.md) for further details regarding cod
- Tech stack and tool choices, discussions and reasoning behind the decisions
- [Infrastructure](./docs/infrastructure.md)
- Describes our infrastructure and how it works in practice
- [Deployment](/docs/deployment.md)
- [Deployment](./docs/deployment.md)
- How the app is deployed on the provided VM
- [Sustainability](/docs/sustainability.md)
- [Sustainability](./docs/sustainability.md)
- More about how we've kept sustainability in mind when developing the application
- [Accessibility](/docs/accessibility.md)
- [Accessibility](./docs/accessibility.md)
- What steps we've taken to make the app accessible to everyone
- [AI documentation](/docs/ai-documentation.md)
- [AI documentation](./docs/ai-documentation.md)
- How AI was used during development
28 changes: 21 additions & 7 deletions backend/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
# Readr - backend
# Readr - backend <!-- omit in toc -->

- [Getting started](#getting-started)
- [Installing PostgreSQL](#installing-postgresql)
- [Linux](#linux)
- [Windows](#windows)
- [MacOS](#macos)
- [Set the environment variables](#set-the-environment-variables)
- [Download the dataset](#download-the-dataset)
- [Set up the database](#set-up-the-database)
- [Use the database](#use-the-database)
- [After changing the database schema](#after-changing-the-database-schema)
- [Run the backend](#run-the-backend)
- [Testing the API](#testing-the-api)
- [GraphQL types](#graphql-types)

## Getting started

Expand Down Expand Up @@ -46,7 +60,7 @@ The simplest way to install Postgres on MacOS is to use [homebrew](https://brew.
brew install postgresql@18
```

### Setting the environment variables
### Set the environment variables

Start by copying the [.env.example](./.env.example) to `.env`:

Expand All @@ -64,7 +78,7 @@ Proceed to do the following:
- Create and insert the Discord client ID and client secret:
- This can be done by creating an application in [Discord's Developer Portal](https://discord.com/developers/applications)

### Downloading the book dataset
### Download the dataset

The book dataset is quite large (~70 MB), so we prefer to not keep it inside the Git repository.

Expand All @@ -85,7 +99,7 @@ After downloading:

Now you're ready to insert the data to the database!

### Setting up the database
### Set up the database

Copy the `.env.example` file and create your own, private and gitignored version:

Expand All @@ -96,7 +110,7 @@ cp .env.example .env

The default values work fine for local development.

### Using the database
### Use the database

When running the database and backend, please go into the backend folder using `cd backend`.

Expand Down Expand Up @@ -137,7 +151,7 @@ pnpm db:generate --name [short_migration_name]
> If you need to test changes locally, use `pnpm db:setup` to start a completely new database immediately,
> or use `pnpm db:push` to add changes to a database that is running already.
## Running the backend along with the frontend
## Run the backend

Make sure the frontend is running in another terminal window or background process.

Expand Down Expand Up @@ -185,7 +199,7 @@ that users must be logged in, and only see their own favorites).
> The test database is very small, so the tests do not check or verify the performance of our database.
> This is rather done by careful planning of indexes and checking the results of `EXPLAIN` queries to see if indexes and efficient strategies are used.
## GraphQL automatically generated types
## GraphQL types

Whenever you change the GraphQL schema in the folder [./src/schema](./src/schema/), please run the following command:

Expand Down
15 changes: 10 additions & 5 deletions docs/accessibility.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Accessibility
# Accessibility <!-- omit in toc -->

- [What we do well](#what-we-do-well)
- [Pointer cursor](#pointer-cursor)
- [Automatic testing](#automatic-testing)
- [Limitations and future work](#limitations-and-future-work)

## What we do well

Expand All @@ -18,13 +23,13 @@

- **Responsive layout.** The book grid goes from four columns to one as the screen gets narrower, and the book page stacks vertically on small screens, so the app can be used on phones.

## Pointer cursor on interactive elements
## Pointer cursor

Tailwind CSS v4 changed buttons to use `cursor: default` instead of `cursor: pointer`. We have deliberately chosen to keep the pointer cursor, which differs from the shadcn defaults. We have added cursor-pointer to the relevant shadcn class names.

A pointer cursor is a visual signal that an element can be clicked. Using it consistently on every button and dropdown item makes it easier to see what is interactive and avoids some elements looking like they cannot be clicked. Consistent cursors make the interface more predictable, which fits the WCAG principle that components should behave in a consistent way. Because the cursor only helps people who use a mouse, it is only one part of our accessibility work, and we also follow the other accessibility requirements described in this document.

## Automatic testing using Playwright
## Automatic testing

We use [Playwright](https://playwright.dev/) to perform automatic accessibility checks.

Expand All @@ -44,7 +49,7 @@ We're glad to share that we pass the automatic Playwright checks for all of the
Testing all of the WCAG requirements is difficult, and Playwright only tests for a subset of these.
We have rectified multiple issues highlighted by Playwright.

## Limitations/Future work
## Limitations and future work

This section is meant as an overview of potential improvements with regard to accessibility, and also shows that we are aware of the downsides of our implementation. The table has a column for the status at delivery 3, and the same table will be used to show what work has been done from delivery 3 to 4.

Expand All @@ -55,5 +60,5 @@ This section is meant as an overview of potential improvements with regard to ac
| An error when loading books is announced with `role="status"`, which screen readers may read later or not at all. | Use `role="alert"` for errors, and keep `role="status"` for loading and empty results. | Not done | Done. Errors when loading books, genres and favorites now use `role="alert"`. |
| There is no "Skip to main content" link, so keyboard users have to tab through the header on every page. | Add a skip link as the first focusable element. | Not done | Done. A "Skip to main content" link is the first focusable element on every page, and is shown when it gets focus. |
| Animations, such as the cover zooming in on hover, don't respect the user's setting for reduced motion. | Turn off these animations with Tailwind's `motion-reduce:` variant. | Not done | Done. The cover zoom uses `motion-safe:`, like the animations on the home page, and changing page scrolls to the top without animation when the user prefers reduced motion. |
| We have not tested the app with automatic tools, and color contrast has not been measured. | Run Lighthouse and axe on all pages. | Not done | Done. Lighthouse, which uses axe for its accessibility checks, gives 100 on all pages after we made `--muted-foreground` darker (the breadcrumb links were 4.29:1). See the [Lighthouse results](/docs/sustainability.md#lighthouse). |
| We have not tested the app with automatic tools, and color contrast has not been measured. | Run Lighthouse and axe on all pages. | Not done | Done. Lighthouse, which uses axe for its accessibility checks, gives 100 on all pages after we made `--muted-foreground` darker (the breadcrumb links were 4.29:1). See the [Lighthouse results](./sustainability.md#lighthouse). |
| We have not tested the main flows with only a keyboard or with a screen reader. | Test the main flows with only a keyboard and with a screen reader (VoiceOver or NVDA). | Not done | Done. We tabbed through every page: the order follows the layout, and every element shows a focus ring. Playwright tests search, filter, sort, opening a book, saving it as a favorite and going back using only the keyboard. Testing with a screen reader is done manually, and showed links being read correct, tabs listed (e.g. "tab 1 out of 3"), etc. |
15 changes: 12 additions & 3 deletions docs/ai-documentation.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
# Use of AI in this project
# Use of AI in this project <!-- omit from toc -->

- [Overview](#overview)
- [How we keep humans in the loop](#how-we-keep-humans-in-the-loop)
- [Learning and AI](#learning-and-ai)
- [Code quality](#code-quality)
- [LLM restrictions](#llm-restrictions)
- [Examples of rejecting AI advice](#examples-of-rejecting-ai-advice)

## Overview

We have used Claude (through Claude Code) as a tool during development. In short, it was used for:

Expand Down Expand Up @@ -29,15 +38,15 @@ Furthermore, if used correctly, AI can be used to help explain concepts when you

No matter whether the code was written manually or using help from LLMs, all issues and pull requests must have a proper description, as required by our [CONTRIBUTING.md](../CONTRIBUTING.md) file. This forces all group members to explain their thought process, reasoning for their code, and makes it obvious if someone does not understand the code at all. Fortunately, we have not had such issues in our group, and practically all pull requests have had coherent descriptions which are easy to understand.

## Code generated by AI is quality-checked in the same strict way as all other code
## Code quality

All code that LLMs (and humans) write should be checked by ESLint, Prettier and our Vitest tests and E2E tests before pushing to git.
Furthermore, we have checks in CI (GitHub Actions) which run all of these, excluding the E2E tests (see the [project choices and reasoning documentation](./choices-and-reasoning.md) for further details).
These checks confirm whether the code passes these strict requirements, and if it does not, it will not get merged. It's that simple.

Some things cannot be checked automatically, such as some of the practices described in our [CONTRIBUTING.md](../CONTRIBUTING.md) file, so after the automatic checks, we still perform human review on all pull requests. In order for a pull request to be merged, all conversations must be resolved, and it needs at least one explicit approving review.

## LLMs are unpredictable - and their access is restricted based on that
## LLM restrictions

The LLMs used by our group do not have access to run any write operations using git. This means no automatic committing, pushing or otherwise adding code that has not been quality checked.
Furthermore, the LLMs only have access to the fewest tools they need to get the job done. That means reading and editing only the files they need, and performing only the terminal commands that are needed.
Expand Down
Loading