Deployment
Relevant source files
The following files were used as context for generating this wiki page:The aidoit4u-mobile-app project utilizes a hybrid architecture consisting of a frontend Expo application (for iOS, Android, and Web) and a backend Node.js server. Deployment involves building and running these two components, which are managed within a single monorepo structure. The frontend is responsible for the user interface and client-side logic, while the backend handles business logic, authentication, and communication with external services.
This document outlines the build process, configuration, and deployment strategy for both the frontend and backend components, as derived from the project's source files.
Architecture Overview
The project is structured with a client-side Expo application and a server-side Node.js application. During development, they are run concurrently. For production, the backend is built into a dist directory and the frontend is built for its target platforms (iOS, Android, Web).
This diagram illustrates the high-level components and their interactions.
Sources: package.json:5-12
Build & Deployment Scripts
The package.json file defines the core scripts for development, building, and running the application.
| Script | Description |
|---|---|
dev | Runs the backend server and the Expo Metro bundler concurrently for development. |
dev:server | Starts the Node.js backend server in development mode using tsx for live reloading. |
dev:metro | Starts the Expo Metro bundler for the web, iOS, and Android clients. |
build | Compiles the backend TypeScript server code using esbuild into a production-ready bundle in the dist/ directory. |
start | Runs the compiled backend server from the dist/ directory in a production environment. |
android | Starts the development server for the Android app. |
ios | Starts the development server for the iOS app. |
Sources: package.json:5-12
Frontend Deployment (Expo)
The frontend is an Expo application configured for iOS, Android, and Web platforms. Its configuration and build process are defined in app.config.ts.
Application Configuration
The primary configuration is managed in app.config.ts. It defines application metadata, platform-specific settings, and plugins.
| Property | Value/Description | Source |
|---|---|---|
name | "Legal AI" | app.config.ts:15 |
slug | "aidoit4u-mobile-app" | app.config.ts:16 |
version | "1.0.0" | app.config.ts:25 |
orientation | "portrait" | app.config.ts:26 |
scheme | Dynamically generated from bundleId (e.g., manus20260105013345) | app.config.ts:11-12, 28 |
ios.bundleIdentifier | space.manus.aidoit4u.mobile.app.t20260105013345 | app.config.ts:7, 20, 32 |
android.package | space.manus.aidoit4u.mobile.app.t20260105013345 | app.config.ts:7, 21, 45 |
web.bundler | "metro" | app.config.ts:57 |
Sources: app.config.ts
A unique bundleId is constructed using a project name and a timestamp. This bundleId is then used to derive a deep link scheme for OAuth callbacks.
Sources: app.config.ts:7-12, constants/oauth.ts:6-8
Bundling and Transpilation
The project uses Metro as its JavaScript bundler, configured in metro.config.js.
- NativeWind: The configuration is wrapped with
withNativeWindto enable Tailwind CSS for React Native. - iOS Styling Fix: The
forceWriteFileSystem: trueoption is enabled to fix styling issues in development mode on iOS by writing CSS to the file system instead of using virtual modules. - Babel: The
babel.config.jsfile configures the Babel transpiler, integrating presets forexpoandnativewind, and includes thereact-native-worklets/plugin.
Sources: metro.config.js:3-10, babel.config.js
Platform-Specific Builds
The app.config.ts file contains specific configurations for iOS and Android builds.
- Android:
- An adaptive icon is configured with foreground, background, and monochrome images.
edgeToEdgeEnabledis set totrue.- The
POST_NOTIFICATIONSpermission is requested. - Intent filters are set up to handle the custom deep link scheme (
manus...) for OAuth callbacks. - Build architectures are specified as
armeabi-v7aandarm64-v8avia theexpo-build-propertiesplugin.
- iOS:
supportsTabletis enabled.- The bundle identifier is set from the centrally configured
bundleId.
Sources: app.config.ts:31-68
Backend Deployment (Node.js)
The backend is a TypeScript-based Node.js server. The deployment process involves compiling the TypeScript source into JavaScript and running it with Node.
Backend Build and Run Flow
The following diagram shows the process for building and running the backend in production.
Sources: package.json:8,9
Environment and Service Dependencies
The backend server relies on several environment variables to connect to external services. These are critical for a successful deployment.
| Environment Variable | Purpose | Relevant File(s) |
|---|---|---|
BUILT_IN_FORGE_API_URL | Base URL for the Forge API (used for LLM and storage). | server/storage.ts:8, server/_core/llm.ts:153 |
BUILT_IN_FORGE_API_KEY | API key for authenticating with the Forge API. | server/storage.ts:9, server/_core/llm.ts:159 |
OAUTH_SERVER_URL | URL of the Manus OAuth server for authentication. | server/_core/sdk.ts:40 |
APP_ID | The application's unique ID for OAuth. | server/_core/sdk.ts:60 |
COOKIE_SECRET | Secret key used to sign and verify session JWTs. | server/_core/sdk.ts:133 |
Sources: server/storage.ts, server/_core/llm.ts, server/_core/sdk.ts
Frontend-Backend Communication
The frontend application needs to know the URL of the backend API server. The getApiBaseUrl function determines this URL.
- Web Platform: When running on the web, it automatically derives the backend URL from the current
window.location. It assumes the frontend runs on a port like8081and the backend on3000, replacing the port in the hostname (e.g.,8081-sandbox.domainbecomes3000-sandbox.domain). - Native Platforms (iOS/Android): On native, it relies on the
EXPO_PUBLIC_API_BASE_URLenvironment variable. If this is not set, API calls will be made to a relative path, which will fail.
The following sequence diagram illustrates the URL derivation on the web.
Sources: constants/oauth.ts:28-46