Giter Club home page Giter Club logo

dofuslab's Introduction

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

dofuslab's People

Contributors

dependabot[bot] avatar grr14 avatar lightyearsaway avatar lucas-mds avatar paddykontschak avatar pwratheris avatar rogerpb98 avatar samlee405 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.