Skip to content

Build & Deploy Commands

This guide provides the specific commands required to build and deploy each part of the Merq platform: the Go backend, the React web dashboard, and the React Native mobile app.

The backend is a Go application built and run using Docker.

The primary build process is defined in the merq-backend/Dockerfile. It’s a multi-stage build:

  1. Builder Stage: Compiles the Go source code into binaries for the server, migrator, and seeder.
  2. Run Stage: Copies the compiled binaries into a lightweight alpine image.

To build the Docker image, run the following command from the merq-backend directory:

Terminal window
docker build -t merq-backend .

The backend can be run locally using the docker-compose.yml file, which orchestrates the backend container along with its dependencies (PostgreSQL, Redis, etc.).

Terminal window
docker-compose up -d --build

The merq-backend repository includes a Makefile with helper targets for common development tasks:

CommandDescription
make goose-statusShow status of all SQL migrations
make goose-upRun all pending SQL migrations
make goose-downRollback last SQL migration
make goose-resetRollback ALL migrations (down-to 0)
make goose-redoRollback and re-apply last migration
make goose-create name=xxxCreate new SQL migration file
CommandDescription
make seed-v2Run all pending seeders
make seed-listList all seeders and their status
CommandDescription
make integration-upStart test database container
make integration-downStop test database container
make test-integrationRun integration tests
make test-integration-verboseRun integration tests with verbose output

Note: The older make migrate-up/down/create targets use the legacy GORM-based migrator tool and are kept for backward compatibility. Prefer make goose-* for all new migration work.

The web dashboard is a React application built with Vite.

The build process is managed by bun (for deployment) or npm/pnpm (for local dev), configured in merq-web/package.json.

  • Development Build: npm run build:dev
  • Production Build: npm run build

These commands bundle the React code and output static files to the merq-web/dist/ directory.

The deployment process for the web dashboard is handled by the merq-web/deploy.sh script. This script is intended to be run on a VPS and performs the following actions:

  1. Installs dependencies (bun install).
  2. Builds the project for production (bun run build).
  3. Copies the contents of the dist/ directory to the web server’s root (e.g., /var/www/merq-web).
  4. Sets the correct file permissions (chmod -R 755) to ensure the web server (like Nginx) can serve the files.

The mobile app is a React Native project.

The mobile project uses Yarn as its package manager. To run the app on a simulator or connected device during development:

  • Android: yarn android
  • iOS: yarn ios

The active env file is controlled by the ENVFILE variable (e.g., ENVFILE=.env.dev yarn android). By default the scripts use .env.

Building a release version of the mobile app is a more involved process.

The merq-mobile/package.json file contains scripts for building Android releases:

  • yarn build:apk: Creates a standalone release .apk file (assembleRelease).
  • yarn build:apk-debug: Creates a debug .apk file (assembleDebug).
  • yarn build:abb: Creates an Android App Bundle (.aab) for submission to the Google Play Store.
  • yarn build:bundlejs: Bundles the JavaScript entry point into android/app/src/main/assets/index.android.bundle (useful for debugging native builds).

These scripts invoke Gradle commands within the merq-mobile/android/ directory.

Building for iOS is typically done through Xcode. You would open the merq-mobile/ios/merq.xcworkspace file in Xcode and use its “Archive” feature to create a build for submission to the App Store. There are no specific command-line scripts for this in package.json.