gw2treasures.com is a Guild Wars 2 database powered by the official API.
You can create a new issue to report a bug or request a new feature.
Pull requests are always welcome ❤️.
It's best to to open an issue first to discuss the changes you want to make. You can also always ask on discord if you have any questions.
These are the steps that are required to work on any of the gw2treasures.com components.
- You need Node.js 20+, docker and pnpm (
corepack enable
) installed. - Install dependencies by running
pnpm i
in the root directory. This will install dependencies for all apps and packages. - Start the database in docker using
docker compose up -d database
. - (Optional) To get data into the database, it is best to run workers with
docker compose up -d worker
in the background.
The website uses Next.js and the code is found in apps/web and packages/ui.
- Run
pnpm run dev:web
- Visit http://gw2treasures.localhost:3000/
- Make your changes
The workers powering all background tasks of gw2treasures.com are located in apps/worker. You can see the currently queued jobs on the /status/jobs page when running the frontend.
If you have workers running in docker, it is best to stop them first (docker compose stop worker
), because they will not contain your changes.
- Make your changes.
- Start the worker with
pnpm run dev:worker
.
You can rebuild and restart your docker workers with docker compose up --build -d worker
.
You can run pnpm run prisma:studio
to open prisma studio to access the local development database.
If you need to make changes to the database schema, follow these steps:
- Make your changes in schema.prisma
- Run
pnpm run prisma:migrate-dev <name>
.<name>
should be the migration name in camelCase (for example addItemTable). - Now you can restart the components you need. The migration gets applied automatically.
If you have a local legacy database running, you can import the data with this command.
docker compose -f docker-compose.yml -f docker-compose.importer.yml up legacy-importer
If you need to work on features that required you to be logged in, you need to create a new application on gw2.me. Then add the generated client_id
and client_secret
in apps/web/.env.local
:
GW2ME_CLIENT_ID="<client_id>"
GW2ME_CLIENT_SECRET="<client_secret>"
After this, you can log in with your gw2.me account.
You can also run gw2.me locally (gw2.me repository), then you also need to set GW2ME_URL
to http://localhost:4000/
.
You can also add the Admin
role to your user if required, see Database Access.
The e2e tests are located in e2e.
First make sure you are running the dev server (pnpm run dev:web
). You can run the tests with pnpm run e2e
. Follow the onscreen instructions to install all required dependencies.
# start database and web server
docker compose -f docker-compose.yml -f docker-compose.e2e.yml up -d web database database-migration
# run e2e tests
docker compose -f docker-compose.yml -f docker-compose.e2e.yml up e2e
When the database version is upgraded to a new major version, you need to run the following steps to migrate the data from the old version to the new one.
These instructions only work for migrating from the preceeding database version. If you need to migrate multiple versions, checkout old commits and run the steps from the corresponding README for each version.
- Make sure all other containers are stopped (
docker compose stop
). - Start the new database (
docker compose up -d database
). - Start the old database by running
docker compose -f docker-compose.yml -f docker-compose.database-migration.yml up -d database-old
. - Run
docker compose exec database-old bash -c 'pg_dumpall -p 5432 -U gw2treasures | PGPASSWORD=$POSTGRES_PASSWORD psql -U gw2treasures -h database'
to migrate the data to the new database. - Stop the old database
docker compose -f docker-compose.yml -f docker-compose.database-migration.yml down database-old
. - Verify everything works.
- Delete the old volume
rm -r .docker/database-pg16
.
gw2treasures.com is licensed under the MIT License.