This Flow Interaction Template Service provides a way to propose, store and host InteractionTemplate
data structures using an efficient in-memory storage system.
This repository is a place for developers to propose their Interaction Templates to be audited, and where Interaction Templates can be stored and hosted by the provided API. The service uses an in-memory storage system that loads all templates at startup for fast, efficient access.
The service uses a high-performance in-memory storage system that:
- Loads templates at startup from the
./templates
directory - Stores templates in hash maps for O(1) lookup performance
- Supports 580+ templates with only ~12MB memory usage
- Eliminates database dependencies for simplified deployment
- Optimized for serverless environments like Vercel
Templates are automatically loaded from:
- Local template files in
./templates/**/*.json
- Remote peer instances (if configured via
PEERS
environment variable) - Existing manifest files for backward compatibility
The service provides a RESTful API with the following endpoints:
GET /v1/templates/{template_id}
- Get template by IDGET /v1/templates?name={name}
- Get template by name aliasGET /v1/templates/manifest
- Get complete template manifestPOST /v1/templates/search
- Search templates by Cadence AST hash
GET /v1/auditors?network={network}
- Get auditors for network (mainnet/testnet)
GET /
- Interactive API documentation homepage
If you have created an Interaction Template, you can create a PR to place your Interaction Template in the ./proposals
folder of this repository.
Auditors in the Flow ecosystem can check this folder to see new Interaction Templates available for audit.
If you have created an Interaction Template, you can create a PR to place your Interaction Template in the ./templates
folder of this repository. Templates are automatically loaded into memory when the service starts.
GET /v1/templates/${template_id}
Returns the complete InteractionTemplate JSON object.
POST /v1/templates/search
Content-Type: application/json
{
"cadence_base64": "base64-encoded-cadence-code",
"network": "mainnet" | "testnet"
}
Returns the InteractionTemplate that matches the provided Cadence AST hash.
GET /v1/templates?name=transfer-flow
Returns the InteractionTemplate associated with the given name alias.
GET /v1/templates/manifest
Returns the complete manifest of all available templates.
GET /v1/auditors?network=mainnet
Returns auditor information for the specified network.
The service is optimized for serverless deployment on Vercel:
- No database setup required - templates are loaded from the filesystem
- Fast cold starts - templates load in 1-2 seconds
- Efficient memory usage - only ~12MB for 580+ templates
- Simple build process - single TypeScript compilation step
Required environment variables:
NODE_ENV=production
FLOW_ACCESS_API_URL=https://rest-mainnet.onflow.org
AUDITORS_JSON_FILE=./auditors/auditors.json
NAMES_JSON_FILE=./names/names.json
TEMPLATE_DIR=./templates
FLOW_NETWORK=mainnet
DISCOVERY_WALLET=https://fcl-discovery.onflow.org/mainnet/authn
The service can run on any Node.js hosting platform:
npm install
npm run build
npm start
- Node.js 18.x
- npm
# Install dependencies
npm install
# Development mode with auto-reload
npm run dev
# Build production version
npm run build
# Start production server
npm start
├── api/ # Vercel serverless functions
│ └── index.ts # Main serverless function entry point
├── src/ # Source code
│ ├── storage/ # In-memory storage system
│ │ └── InMemoryTemplateStorage.ts
│ ├── services/ # Business logic layer
│ │ └── template.ts
│ ├── routes/ # API route definitions
│ │ ├── template.ts # Template endpoints
│ │ └── auditors.ts # Auditor endpoints
│ ├── middlewares/ # Express middleware
│ │ └── cors.ts
│ ├── utils/ # Utility functions
│ │ ├── crypto-polyfill.ts
│ │ ├── gen-hash.ts
│ │ ├── mixpanel.ts
│ │ ├── parse-cadence.ts
│ │ ├── read-files.ts
│ │ └── write-file.ts
│ ├── app.ts # Express app configuration
│ ├── index.ts # Development server entry
│ └── config.ts # Configuration management
├── templates/ # Template storage directory
│ ├── NFTCatalog/ # NFT catalog templates
│ │ └── catalog-manifest.json # Template catalog manifest
│ ├── FlowCore/ # Core Flow templates
│ ├── EmeraldID/ # EmeraldID templates
│ ├── test/ # Test templates
│ └── *.template.json # Individual template files
├── auditors/ # Auditor configuration
│ └── auditors.json # Network-specific auditor information
├── names/ # Name alias mappings
│ └── names.json # Template name aliases
├── proposals/ # Proposed templates for review
├── vercel.json # Vercel deployment configuration
├── tsconfig.json # TypeScript configuration
├── package.json # Dependencies and scripts
└── .nvmrc # Node.js version specification
vercel.json
- Vercel deployment configuration with serverless function setuptsconfig.json
- TypeScript compilation settingspackage.json
- Dependencies and build scriptsauditors/auditors.json
- Network-specific auditor informationnames/names.json
- Name aliases for template lookup- Template files - Individual
.template.json
files containing InteractionTemplate data
Flow's official Interaction Template service is available at:
https://flix.flow.com
Example requests:
# Get template by name
curl "https://flix.flow.com/v1/templates?name=transfer-flow"
# Get template by ID
curl "https://flix.flow.com/v1/templates/{template_id}"
# Search by Cadence code
curl -X POST "https://flix.flow.com/v1/templates/search" \
-H "Content-Type: application/json" \
-d '{"cadence_base64": "...", "network": "mainnet"}'
# Get auditors
curl "https://flix.flow.com/v1/auditors?network=mainnet"
This project is open to be run by anyone. By forking this repository and deploying the API service, anyone can run an instance of FLIX and make Interaction Templates available for querying.
If you don't wish to operate your own instance of FLIX, you can use Flow's official instance at https://flix.flow.com
. To add Interaction Templates to Flow's instance, follow the Propose Templates workflow above.
- Startup Time: 1-2 seconds to load 580+ templates
- Memory Usage: ~12MB total (1.2% of typical serverless limits)
- Lookup Performance: O(1) hash map lookups
- Template Count: Currently supporting 580+ templates
- Data Size: ~7.5MB of template data
- In-memory storage for maximum performance
- Serverless-optimized architecture
- Zero database dependencies
- Fast cold starts on Vercel
- Template validation using Flow's InteractionTemplateUtils
- Automatic manifest generation
- CORS-enabled for browser usage
- TypeScript for type safety