Installation
This guide will walk you through installing foc-engine, the core component of the foc.fun ecosystem.
Prerequisites
Before installing foc-engine, ensure you have the following installed:
- Docker - Install Docker
- Docker Compose - Usually comes with Docker Desktop
- Command-line tools:
jq
- JSON processoryq
- YAML processor
Installing Prerequisites on macOS
# Install using Homebrew
brew install jq yq
Installing Prerequisites on Linux
# Ubuntu/Debian
sudo apt-get update
sudo apt-get install jq yq
# Fedora/RHEL
sudo dnf install jq yq
Installation Methods
Method 1: Using ASDF (Recommended)
ASDF is a version manager that makes it easy to install and manage multiple versions of foc-engine.
-
Install ASDF (if not already installed):
# macOS
brew install asdf
# Linux - see https://asdf-vm.com/guide/getting-started.html -
Add the foc-engine plugin:
asdf plugin add foc-engine https://github.com/foc-fun/asdf-foc-engine.git
-
Install the latest version:
asdf install foc-engine latest
-
Set as global version:
asdf global foc-engine latest
-
Verify installation:
foc-engine version
Method 2: Clone and Build
If you prefer to build from source or need the latest development version:
-
Clone the repository:
git clone git@github.com:foc-fun/foc-engine.git
cd foc-engine -
Build with Docker Compose:
docker compose -f docker-compose-devnet.yml build
Verifying Your Installation
After installation, verify everything is working:
# If using ASDF
foc-engine run
# If using clone method
docker compose -f docker-compose-devnet.yml up
You should see the foc-engine build the docker components. Then start up a local devnet, deploy and connect each of the foc-engine modules, and then continue to run in that terminal.
Troubleshooting
Docker Issues
If you encounter Docker permission errors:
# Add your user to the docker group
sudo usermod -aG docker $USER
# Log out and back in for changes to take effect
Port Conflicts
foc-engine uses several ports. If you have conflicts, check the docker-compose-devnet.yml
file to modify port mappings.
Build Failures
If the build fails:
- Ensure all prerequisites are installed
- Check Docker daemon is running:
docker ps
- Clear Docker cache:
docker system prune -a
Installing the JavaScript/TypeScript SDK
To use foc.fun in your JavaScript or TypeScript projects:
# npm
npm install foc-engine
# yarn
yarn add foc-engine
# pnpm
pnpm add foc-engine
Note: The JavaScript SDK is currently in early development. Check the SDK documentation for the latest features.
Next Steps
Now that you have foc-engine installed, proceed to Setup to configure your first application!