Skip to content

tomasvn/dofuslab

 
 

Repository files navigation

DofusLab

DofusLab is an open source set builder for players of the French MMO Dofus, where you can experiment with your equipment.

Written using TypeScript and Python 3.

Please come give us a try at https://dofuslab.io!


Project setup

Initial

Setup testing URL and env files

$ sudo echo '127.0.0.1       dev.localhost' >> /etc/hosts
$ cp client/.env.dist client/.env && cp server/.env.dist server/.env

Backend

Start postgres and redis

$ postgres -D /usr/local/var/postgres
$ redis-server

Alternative: Start postgres and redis with Homebrew

$ brew services start postgresql; brew services start redis

Create database

$ 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

Start a virtual environment

$ python3 -m venv venv
$ source venv/bin/activate

Install dependencies

$ cd server
$ pip install -r requirements.txt

Fill database with initial content

flask db upgrade
python -m oneoff.database_setup
python -m oneoff.update_image_urls

Run the server

$ flask run

Frontend

Install root dependencies

$ yarn

Install dependencies

$ cd client
$ yarn

Run the app

$ yarn dev

Open http://dev.localhost:3000/ and test away!


Making changes

Update database schema

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

Generate TypeScript types from GraphQL schema

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

i18n

To add any new user-facing strings client-side, add the key in the EN locale files first (/client/public/static/locales/en/*).

Merge the new key into the other locales

$ 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

Add server-side dependencies (pip install)

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)


Join us on Discord | Buy us a coffee

About

The open-source equipment experiment tool for the MMORPG Dofus.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 51.0%
  • Python 46.4%
  • JavaScript 1.2%
  • CSS 1.1%
  • HTML 0.2%
  • Mako 0.1%