Analytics server for MetaMask SDK.
- Node.js
- Yarn
- Docker (Optional, for containerized deployment)
- Install Dependencies:
yarn install
- Configure Environment:
Copy
.env.sample(if it exists, otherwise create.env) and fill in the necessary environment variables. - Build the Code:
yarn build
- Run the Server:
- For production mode (uses compiled code):
yarn start
- For development mode (uses ts-node):
yarn dev
- For production mode (uses compiled code):
The server will typically run on the port specified in your .env file (defaulting to 2002 if not set).
- Build the Docker Image:
docker build -t metamask/analytics-server . - Run the Docker Container:
Make sure to provide the necessary environment variables, for example by using an
.envfile and the--env-fileflag.docker run -p 2002:2002 --env-file .env metamask/analytics-server
- Replace
2002:2002if the server uses a different port. - The container exposes port 2002 by default.
- Replace
The server is configured using environment variables. These can be placed in a .env file in the root directory for local development. See .env.sample (if available) for required variables.
When running with Docker, environment variables should be passed to the container (e.g., using --env-file or -e flags).