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.
Backend (merq-backend)
Section titled “Backend (merq-backend)”The backend is a Go application built and run using Docker.
Building
Section titled “Building”The primary build process is defined in the merq-backend/Dockerfile. It’s a multi-stage build:
- Builder Stage: Compiles the Go source code into binaries for the server, migrator, and seeder.
- Run Stage: Copies the compiled binaries into a lightweight
alpineimage.
To build the Docker image, run the following command from the merq-backend directory:
docker build -t merq-backend .Running Locally
Section titled “Running Locally”The backend can be run locally using the docker-compose.yml file, which orchestrates the backend container along with its dependencies (PostgreSQL, Redis, etc.).
docker-compose up -d --buildMakefile Commands
Section titled “Makefile Commands”The merq-backend repository includes a Makefile with helper targets for common development tasks:
Goose SQL Migrations (primary)
Section titled “Goose SQL Migrations (primary)”| Command | Description |
|---|---|
make goose-status | Show status of all SQL migrations |
make goose-up | Run all pending SQL migrations |
make goose-down | Rollback last SQL migration |
make goose-reset | Rollback ALL migrations (down-to 0) |
make goose-redo | Rollback and re-apply last migration |
make goose-create name=xxx | Create new SQL migration file |
Seeders
Section titled “Seeders”| Command | Description |
|---|---|
make seed-v2 | Run all pending seeders |
make seed-list | List all seeders and their status |
Integration Tests
Section titled “Integration Tests”| Command | Description |
|---|---|
make integration-up | Start test database container |
make integration-down | Stop test database container |
make test-integration | Run integration tests |
make test-integration-verbose | Run integration tests with verbose output |
Note: The older
make migrate-up/down/createtargets use the legacy GORM-based migrator tool and are kept for backward compatibility. Prefermake goose-*for all new migration work.
Web Dashboard (merq-web)
Section titled “Web Dashboard (merq-web)”The web dashboard is a React application built with Vite.
Building
Section titled “Building”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.
Deployment
Section titled “Deployment”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:
- Installs dependencies (
bun install). - Builds the project for production (
bun run build). - Copies the contents of the
dist/directory to the web server’s root (e.g.,/var/www/merq-web). - Sets the correct file permissions (
chmod -R 755) to ensure the web server (like Nginx) can serve the files.
Mobile App (merq-mobile)
Section titled “Mobile App (merq-mobile)”The mobile app is a React Native project.
Building for Development
Section titled “Building for Development”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 for Production
Section titled “Building for Production”Building a release version of the mobile app is a more involved process.
Android (APK / AAB)
Section titled “Android (APK / AAB)”The merq-mobile/package.json file contains scripts for building Android releases:
yarn build:apk: Creates a standalone release.apkfile (assembleRelease).yarn build:apk-debug: Creates a debug.apkfile (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 intoandroid/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.