FOC Engine is THE onchain app engine that provides APIs, indexer services, and easy to use components for building production ready onchain apps in days.
- API Service: REST API server running on port 8080
- Indexer Service: Starknet event indexer running on port 8085
- Smart Contracts: Cairo contracts for on-chain functionality
- Infrastructure: Docker Compose for local development, Helm charts for Kubernetes deployment
- Modules: Modular onchain app components
The following dependencies must be installed to run the foc-engine:
- docker
- docker compose
- cmdline tools:
jq,yq
Option 1: Install using asdf
asdf plugin add foc-engine https://github.com/b-j-roberts/asdf-foc-engine.git
asdf install foc-engine latest
asdf global foc-engine latestgit clone git@github.com:b-j-roberts/foc-engine.git
cd foc-engine
docker compose -f docker-compose-devnet.yml buildCreate a .env file from the example:
cp .env.example .envRequired environment variables:
STARKNET_KEYSTORE: Path to Starknet keystoreSTARKNET_ACCOUNT: Starknet account addressAVNU_PAYMASTER_API_KEY: API key for AVNU paymaster service
foc-engine run # Run the engine
foc-engine clean # Clean up resources
foc-engine version # Show version
foc-engine help # Display helpStart all services:
docker compose -f docker-compose-devnet.yml upFresh restart with clean state:
docker compose -f docker-compose-devnet.yml down --volumes
docker compose -f docker-compose-devnet.yml build
docker compose -f docker-compose-devnet.yml upRun on Sepolia testnet:
docker compose -f docker-compose-sepolia.yml upBuild everything:
make buildBuild specific components:
make build-engine # Build Go binaries
make build-contracts # Build Cairo contractsBuild and push Docker images:
make docker-build
make docker-pushRun contract tests:
cd onchain
scarb testInstall:
make helm-installUpgrade existing deployment:
make helm-upgradeUninstall:
make helm-uninstallPreview generated manifests:
make helm-templateThe project consists of:
-
Backend Services (Go):
- API service for external interactions
- Indexer service for blockchain event processing
- MongoDB for data persistence
- Redis for caching
-
Smart Contracts (Cairo):
- Located in
onchain/directory - Built with Scarb
- Tested with snforge
- Located in
-
Infrastructure:
- Docker Compose configurations for local and testnet environments
- Helm charts for Kubernetes deployments
- Production-ready Dockerfiles
When running locally, the following services are available:
- API: http://localhost:8080
- Indexer: http://localhost:8085
- MongoDB: localhost:27017
- Redis: localhost:6379
- Starknet Devnet: http://localhost:5050
[Add license information here]
