DofusLab is an open source set builder for players of the French MMO Dofus. It lets you experiment with your equipment.
Written using TypeScript and Python 3.
Please come give us a try at https://dofuslab.io!
Project setup
$ sudo echo '127.0.0.1 dev.localhost' >> /etc/hosts
$ cp client/.env.dist client/.env && cp server/.env.dist server/.env
$ postgres -D /usr/local/var/postgres
$ redis-server
Alternative: Start postgres and redis with Homebrew
$ brew services start postgresql; brew services start redis
$ psql
$ CREATE DATABASE dofuslab;
$ \c dofuslab
$ CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
$ exit
Replace [USER]
with your postgres username.
$ sed -i '' 's/postgres:password/[USER]:password/g' server/.env
$ python3 -m venv venv
$ source venv/bin/activate
$ cd server
$ pip install -r requirements.txt
flask db upgrade
python -m oneoff.database_setup
python -m oneoff.update_image_urls
$ flask run
$ yarn
$ cd client
$ yarn
$ yarn dev
Open http://dev.localhost:3000/ and test away!
Making changes
After making changes to the database schema (e.g. server/app/database/model_*.py
) generate a new migration.
$ cd server
$ flask db migrate
Check the newly generated migration and make any necessary changes with your preferred text editor (vim, nano, emacs, Visual Studio Code, etc)
$ vim server/app/migrations/versions/[SOME_HASH].py
Apply your new migration.
$ flask db upgrade
After making any changes to GraphQL queries or mutations (client/graphql/*
), or the GraphQL schema (server/app/schema.py
), generate TypeScript types.
$ cd client/
$ yarn apollo-codegen
To add any new user-facing strings client-side, add the key in the EN locale files first (/client/public/static/locales/en/*
).
$ cd client/
$ yarn sync-i18n
When adding any user-facing strings in the backend, update all the messages.po
files with the new strings.
$ cd server/
$ make update-translations
Check the translations and make any necessary changes with your preferred text editor, then compile the translations.
$ make compile-translations
Run make freeze
to update requirements.txt (https://stackoverflow.com/questions/39577984/what-is-pkg-resources-0-0-0-in-output-of-pip-freeze-command)