DocsQuickstartStarter Kit

Starter Kit

The Protokit starter-kit is a monorepo that provides a complete foundation for building application chains using the Protokit framework. It demonstrates how to structure your app-chain, configure runtime modules, and deploy across different environments.

For installation and initial setup, see the QuickStart guide.

Default Environments

The starter-kit comes with three default environments, each tailored for different stages of development and deployment. Choose the one that fits your current workflow:

Inmemory Environment

Perfect for rapid testing and experimentation, this environment keeps all state in memory without any persistence. Use it to quickly iterate on runtime logic and test new features before moving to persistent environments.

Characteristics:

  • All state stored in memory
  • No external services or databases
  • Blocks are produced but not persisted
  • Perfect for unit and integration testing

Chain Configuration (chain.config.ts):

chain.config.ts
const appChain = AppChain.from({
  Runtime: Runtime.from(runtime.modules),
  Protocol: Protocol.from(protocol.modules),
  Sequencer: Sequencer.from({
    WorkerModule: WorkerModule.from(
      VanillaTaskWorkerModules.withoutSettlement()
    ),
    TaskQueue: LocalTaskQueue,
    LocalSequencerCoreModule,
    Database: InMemoryDatabase,
    Mempool: PrivateMempool,
    Graphql: GraphqlSequencerModule.from(VanillaGraphqlModules.with({})),
    BlockTrigger: TimedBlockTrigger,
  }),
  TransactionSender: InMemoryTransactionSender,
  QueryTransportModule: StateServiceQueryModule,
  NetworkStateTransportModule: BlockStorageNetworkStateModule,
});
  • WorkerModule.withoutSettlement() : Configures the worker without settlement capabilities so that your sequencer will focus purely on producing blocks without attempting to settle to L1.
  • LocalTaskQueue : Handles tasks locally without external queue infrastructure.
  • LocalSequencerCoreModule : Allows registration of BlockProducerModule and SequencerStartupModule for local block production and initialization.
  • InMemoryDatabase : All state is stored in memory, no persistence across restarts.

How to Run:

Start the inmemory environment with both the UI and sequencer running with live reload:

pnpm env:inmemory dev

Then visit:

For running tests:

pnpm env:inmemory run test --filter=chain -- --watchAll

You can create custom environments using the wizard command from the CLI. This allows you to configure additional environment setups tailored to your specific needs.

The Complete Picture

Here’s the flow of data and configuration in the starter-kit:

  1. Runtime Modules (runtime/modules/) define what your app-chain can do
  2. Protocol (protocol/index.ts) defines the rules governing your app-chain
  3. Sequencer Config (core/environments/{env}/chain.config.ts) assembles the sequencer from:
    • Your runtime modules
    • Protocol rules
    • Sequencer infrastructure (database, GraphQL, mempool)
  4. Environment Config (core/environments/{env}/.env) provides runtime parameters
  5. Client Config (core/environments/client.config.ts) configure the client appchain
  6. Docker Services (docker/) runs databases, indexer, processor, lightnet etc.
  7. Frontend (apps/web/) connects via the client config and communicates with the sequencer GraphQL API