Honest product reviews to help buyers make the best purchase decisions.
- Git
git clone https://github.com/simonsinclair/honest-reviews.git
cd honest-reviews
Run a production version of the Honest Reviews application from a Docker container exposed at http://localhost:3000.
- Setup
- Docker
docker build --tag honest-reviews .
docker run --name honest-reviews --publish 3000:3000 honest-reviews
docker exec honest-reviews npx prisma db seed
Note: The seed script will create a new product and accompanying user reviews. It is idempotent and can be run as many times as required.
Run the Honest Reviews application in development mode at http://localhost:3000.
- Setup
- Node.js:
>=14
npm i
to install package dependencies.cp .env.example .env
to create an.env
file. See Environment variables.npm run dev:init
to create, migrate, and seed the database.
npm run dev
Run the Honest Reviews application test suite all together or individiually by type.
- All Development Prequisites.
npx playwright install
to install browser binaries required by Playwright E2E tests.
npm test
Analyse all application code for formatting, linting, and type errors.
npm run test:static
Verify isolated parts of the application, such as React components, work as expected.
npm run test:unit
Verify critical user flows, such as posting a product review, work as expected.
npm run test:e2e
Route | Comments |
---|---|
/ |
Redirects to /products (the current homepage). This gives us room to have a root homepage in future. |
/products |
The products page – a listing of all products in the database. |
/products/$id |
The product identified by $id 's page. |
/products/$id/reviews |
Redirects to /products/$id#reviews . A vanity URL to improve the experience of people querying the visible URL structure. See route below. |
/products/$id/reviews/new |
The review form for the product identified by $id . |
We use Prisma – a type-safe ORM with support for the following databases: PostgreSQL, MySQL, SQLite, SQL Server, MongoDB, and CockroachDB.
Our current database is SQLite (as defined by the default DATABASE_URL
found in .env.example). To use another supported relational database, update this value.
To use a PostgreSQL database, your .env
file might contain the following:
DATABASE_URL="postgresql://test:test@localhost:5432/test?schema=public"
The rating trend chart is based on a 30-Day Simple Moving Average, which assumes there is at least one rating for every day. In practice, this may not be the case. For days where there are no reviews, we should carry over the previous day's rating.
[2, 3, null, 4] => [2, 3, 3, 4].
It's currently possible for users to imitate other users. In practice, this means User A (user-a@gmail.com) can post a review as User B (user-b@gmail.com) by filling in the review form inaccurately. In order to prevent this, we should verify a user's identity through authentication before they can post a review.
We should isolate our E2E environment to allow tests to create, update, and delete data without affecting the main application.
Our server-side review posting logic exists within a Remix Action. This function is exported from the NewReviewPage
component and can therefore be tested in isolation. We should verify the action returns the expected Responses and throws the expected errors when presented with various request cases.