Clone this repository then run npm install
npm install
Setup the environmental variables by copying the .env-copy into a .env file
cp .env-copy .env
Install docker desktop first for your machine: https://docs.docker.com/engine/install/
Run the MongoDB server through docker-compose.
sudo docker-compose up -d
To stop the container run
sudo docker-compose stop
You can install MongoDB Compass GUI to view DBs and Collections: https://www.mongodb.com/try/download/compass
To use a local mongodb instance follow the steps below:
On Mac use homebrew. If not installed install it.
Add the mongodb repo to homebrew
brew tap mongodb/brew
Install community mongodb
brew install [email protected]
We use transactions for DB consistency. For this a mongodb replica set is required To use replica sets install the package run-rs globally
npm i -g run-rs
In a separate terminal run
sudo run-rs --mongod --dbpath ./rs-data
To run tests first run the MongoDB server above
After that run the commands below
npm test
To populate UI testing data run the command below. It will populate a separate DB from the normal tests.
NB: You can fill data for your supabase user by filling the TEST_USER_ID, TEST_USER_FIRST_NAME and TEST_USER_LAST_NAME in the .env The TEST_USER_ID is found by checking your DB after a normal login. It's easier to check with 'MongoDB Compass' installed.
pnpm test-data
NB: If you change the schema, re-run test-data AND restart the dev server
To run a certain fixture:
pnpm vitest chapters
To view console logs you must put empty lines under the log you want to view:
console.log('Please show this log');
console.log('\n');
Once you've created a project and installed dependencies with npm install
(or pnpm install
or yarn
), start a development server:
npm run dev
# or start the server and open the app in a new browser tab
npm run dev -- --open
To create a production version of your app:
npm run build
You can preview the production build with npm run preview
.
To deploy your app, you may need to install an adapter for your target environment.