Community-based e-learning web application
See docs/challenge-definition.md
Below is a general guide to running the application locally.
To start, clone this repo using the web URL.
git clone https://github.com/jclicodes/opencoursewire.git
Edit the values in .envrc.example. Once properly configured, you can source these variables into your environment.
source .envrc
You can use a tool like direnv for Unix or cross-env for non-Unix environments to automatically load this into your environment before the application starts.
- Install Node dependencies (ideally via pnpm)
pnpm install
- Run external services via Docker Compose
docker compose up -d
- Ensure services are running OK before proceeding.
docker compose ps
You should see something like the below output
opencoursewire-postgres-1 postgres:16 "docker-entrypoint.s…" postgres 14 seconds ago Up 13 seconds 0.0.0.0:5432->5432/tcp, [::]:5432->5432/tcp
opencoursewire-valkey-1 valkey/valkey:8 "docker-entrypoint.s…" valkey 14 seconds ago Up 13 seconds 0.0.0.0:6379->6379/tcp, [::]:6379->6379/tcp
Ensure database is running, then run migrations via drizzle-kit
pnpm run db:generate && pnpm run db:migrate:local
You can run the Vite development server (with HMR)
pnpm run dev
Alternatively, build the server and client bundles, then start the production server
pnpm run build && pnpm run start
This project uses a pyramid testing strategy. End-to-end tests to test the entire stack from a user perspective. Integration tests to test integration points in the app/routes e.g. loaders and actions. Unit tests to test the route components themselves. Generally, sub-components in app/components are not tested since OCW's unit tests are generally meant to be of critical business value - and this value is covered when testing the route components.
Integration and unit tests are co-located with the routes under test.
Note: E2E and Integration tests require external dependencies to run, you can use docker-compose.yml
Below is a general guide to ensuring the application is completely removed from your machine.
Stop docker services:
docker compose down
Remove all stopped containers:
docker rm -vf $(docker ps -aq)
Optionally, you can also remove the images:
docker rmi valkey/valkey:8 postgres:16
Lastly, delete the repository:
cd .. && rm -rf opencoursewire