This is a T3 Stack project bootstrapped with create-t3-app
. The project is deployed at improvdb.com.
- A Postgres database URL (you can get one for free at Planet Scale or use the docker compose file to run Postgres locally)
- Google authentication credentials - Read more
- (Optional) A free Upstash redis URL
cp .env.example .env
# edit the `.env` file with your configuration details, and then
npm install
You must have docker installed for this to work. You can use a local Postgres database with the following commands
docker-compose -f docker-compose.postgres.yml up
# Wait for postgres server to be ready, then run
npx prisma db push
npx prisma db seed
Then you can just update your .env
file with DATABASE_URL=postgres://improvdb_user:secret@127.0.0.1:5432/improvdb_db
.
If you ever need to reset the database, you have two options:
npx prisma db push --force-reset
npx prisma db seed
Run the following command to destroy the volumes associated with the postgres database, and then start again from scratch.
docker-compose -f docker-compose.postgres.yml down -v
As simple as
npm run dev
You can also run prisma studio with the following command:
npx prisma studio
To be able to run all tests properly, you must have docker installed. That's because we want to use the same docker container that is used in CI, ensuring that there aren't differences when doing screenshot / visual regression testing.
You must also make sure that you are using a freshly seeded local Postgres database.
docker build -t playwright-docker -f tests/Dockerfile-playwright .
docker image ls # Should output "playwright-docker"
docker run -p 9323:9323 --rm --name playwright-runner -it playwright-docker:latest /bin/bash
# From inside the container now you can run
npx playwright test
More detailed instructions on the Docker | Playwright documentation. Loosely based on this guide.
If you need to update the screenshots, then you can run this command instead:
npx playwright test --update-snapshots
And then, once you've run tests, you can update the snapshots in the git repository by running the following (while the docker container is still running, in a separate terminal):
docker cp playwright-runner:/app/tests .
You can alternatively run a test directly without docker, skipping the screenshot comparison functionality altogether.
You can do this with the command:
SKIP_SCREENSHOT_COMPARISON=1 npx playwright test
While connected to a production/staging database, run the following:
npx tsx prisma/updateSeedData.ts
This will pull all resources and all public lesson plans into the seedData.json
file in the git repository.
To learn more about the T3 Stack, take a look at the following resources:
- Documentation
- Learn the T3 Stack — Check out these awesome tutorials
You can check out the create-t3-app GitHub repository
Contributions are welcome! The best place to start is by opening an issue.