Create Data Modelling App
A tool for quickly creating a data modelling app.
Getting started
By following these steps, you will have your own custom application up and running on your local machine.
Requirements:
1) Create a new application
Create a new app by running (change my-app
to your application name).
npx @development-framework/create-dm-app my-app
This will create a new folder my-app
and inside that folder, the initial project structure is generated and the transitive dependencies are installed.
(npx comes with npm 5.2+ and
higher, see instructions for older npm versions)
2) Starting services
The dependent services (DMSS, job and databases) are specified in the docker compose file called docker-compose.yaml
.
Go to the my-app
folder in a terminal and run the commands to start the services:
docker-compose pull
docker-compose up --build
3) Install dm-cli
The dm-cli can be used for resetting datas sources. The recommended way to run the cli tool is to:
- Create a new virtual python environment with the bash command
python -m venv .venv
- Activate the virtual environment with the bash command
source .venv/bin/activate
- Install the dm-cli (available on PyPi with
pip install dm-cli
4) Upload entities, blueprints and recipes
Run this commands that will upload to DMSS any entities, blueprints and recipes register under the data source folder:
./reset-app.sh
The script uses dm-cli, so the venv needs to be activated before running the script.
NOTE: This script must be run every time a modification is done in any files in the app/DemoApplicationDataSource/
folder.
5) Start the web application
When inside the my-app
folder in the terminal, run
npm install
npm start
The web app can now be reached at http://localhost:3000 in the web browser.
Remember: You must have the docker-compose services running to use the web application
The web page will automatically reload if you make changes to the code.
You will see the build errors and lint warnings in the console.
When you’re ready to deploy to production, create a minified bundle with npm run build
.
Remote DMSS: The app can be connected to any DMSS instance you want.
Settings
This template uses an application entity to control the behavior of the app. This entity can be seen at app/data/DemoApplicationDataSource/DemoApplication/entities/demoApplication.json
. The .env
points to this application entity, which will be loaded and used to select UI plugin to be shown. The recipe that defines what to show can be seen at app/data/DemoApplicationDataSource/DemoApplication/recipes/demoApp.json
. There also exist default recipes that can be seen at app/data/DemoApplicationDataSource/DemoApplication/recipes/appDefault.recipe.json
.
URLs to services are controlled by environment variables in the .env
file, by default this will point to the services specified in the docker-compose.yaml
file.
UI Plugins
Adding
- Create a new folder under
src/plugins
. This will be your plugin. - Add this plugin to the
src/plugins/index.tsx
-file that contains list of local plugins to load. - Done
Using
Associate a blueprint type with a set of ui recipes that uses the ui-plugin.
- Create a
CORE:RecipeLink
-entity. See app/data/DemoApplicationDataSource/DemoApplication/instances/recipe_links/demoApp.json
as an example. - Run
reset-app.sh
so that the recipe link is uploaded to DMSS.
Development tips
Pre commit
In this repo, pre-commit has been used to ensure consistent code formatting. The pre-commit
hook
will run prettier formatting and analyze the JavaScript code using eslint
.
To run pre-commit, it needs to be installed on your local machine with
pip install pre-commit
Once installed, pre-commit can be run with:
pre-commit run --all-files
Link dm-core-packages
If you want to work on the core and don't want to release new core versions to see the changes in create-dm-app, then
change the @development-framework/dm-core
from inside package.json
to point to core locally
like link:./../dm-core-packages/packages/dm-core/
. You have to run yarn rollup
inside dm-core to get changes, since this will build a new dist that will be picked-up by create-dm-app.