Skip to content

migratis/base

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Migratis Base Environment

Minimal full-stack framework for deploying applications generated by migratis.ai.

Stack

  • Backend — Django 5 + Django Ninja (REST API) · SQLite (default) or PostgreSQL
  • Frontend — React 19 + react-hook-form + i18next
  • Docker — all environments

Ports: backend 8004 · frontend 3002


Quick Start

1. Generate your application

Go to migratis.ai, describe your application, tweak the sandbox until you are happy, then click Generate.

2. Start the base environment

# Backend
cd backend
bash build-docker-local.sh          # builds image, runs migrations, starts on :8004

# Frontend (separate terminal)
cd frontend
docker compose up -d                # starts on :3002

No database configuration needed — SQLite is used by default.

3. Install your generated application

Open http://127.0.0.1:3002/installer, connect with your migratis.ai credentials, select your application and click Install.

The installer will:

  • Download and extract the backend Django module
  • Activate required framework modules (auth, i18n, etc.) in settings.py
  • Register API routers in api/views.py
  • Run migrate and seed translations automatically

4. Apply the frontend

Download the frontend ZIP from the installer result screen, extract it into frontend/src/, then follow the included INSTALL.md to add the new routes to App.js.

5. Restart and create a superuser

docker restart backend-base-api-1

docker exec -it backend-base-api-1 bash
python /backend/manage.py createsuperuser

Environment variables

Copy backend/migratis/.env.example and fill in your values. Key variables:

Variable Default Description
USE_SQLITE True Use SQLite instead of PostgreSQL
INSTALLER True Enable/disable the installer (API + page) — see below
MIGRATIS_BACKEND_URL http://host.docker.internal:8000 URL of the migratis generator (from inside Docker)
SECRET_KEY Django secret key
ALLOWED_HOSTS 127.0.0.1,localhost Allowed hostnames

Enabling / disabling the installer

The installer is controlled entirely by the backend with a single setting — there is no separate frontend flag to keep in sync.

In backend/migratis/.env:

INSTALLER=True    # installer enabled (default)
INSTALLER=False   # installer disabled

Then restart the backend:

docker restart backend-base-api-1

Behaviour:

  • INSTALLER=True — the /installer/ API is mounted and the /installer page works normally.
  • INSTALLER=False — the /installer/ API is not mounted (its endpoints return 404, so they cannot be reached). The /installer page is still reachable, but it detects the disabled state (via the always-available /installer/status endpoint) and shows instructions on how to turn it back on, instead of the installer UI.

Once you have installed your application you typically set INSTALLER=False so the installation API is no longer exposed in production.


Switching to PostgreSQL

PostgreSQL runs as the base-db service behind a Compose profile, so it is never started in the default SQLite setup (no unused database container).

  1. In backend/migratis/.env, set:

    USE_SQLITE=False
    DB_NAME=migratis
    DB_USER=migratis
    DB_PASSWORD=change-me      # keep in sync with the base-db service
    DB_HOST=base-db            # the base-db service name on the Compose network
    DB_PORT=5432
  2. Rebuild — build-docker-local.sh detects USE_SQLITE=False and automatically enables the postgres profile, starting the base-db container:

    cd backend && bash build-docker-local.sh

    Or start it manually:

    cd backend && docker compose --profile postgres up --build

On first boot the entrypoint waits for the database, runs migrate, then seed_translations — so all translations are repopulated into the fresh PostgreSQL database automatically.

Carrying over existing data — switching engines points Django at a new, empty database; it does not copy your SQLite rows. Translations come back via re-seeding, but manual edits (and rows added by installed modules) do not. To preserve them exactly, migrate the data while still on SQLite:

docker exec backend-base-api-1 python manage.py dumpdata i18n --indent 2 > i18n_dump.json
# after switching and migrating on PostgreSQL:
docker exec backend-base-api-1 python manage.py loaddata i18n_dump.json

To switch back to SQLite, set USE_SQLITE=True and rebuild — the base-db container stays off.

About

Environment base for migratis.ai application generator

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Contributors