PromptEngine

A Rails engine for managing AI prompts with version control and secure API key storage.

Installation

Add this line to your application's Gemfile:

gem "prompt_engine"

And then execute:

$ bundle
$ rails prompt_engine:install:migrations
$ rails db:migrate

Setup

Configure Encryption

PromptEngine uses Rails encryption to secure API keys. Add to your environment files:

# config/environments/development.rb
config.active_record.encryption.primary_key = 'development' * 4
config.active_record.encryption.deterministic_key = 'development' * 4
config.active_record.encryption.key_derivation_salt = 'development' * 4

For production, use rails db:encryption:init to generate secure keys.

Configure API Keys

PromptEngine requires API keys for AI providers. See API Credentials Setup for detailed configuration instructions.

Quick setup:

rails credentials:edit

Add your API keys:

openai:
  api_key: sk-your-openai-api-key
anthropic:
  api_key: sk-ant-your-anthropic-api-key

Mount the Engine

In your config/routes.rb:

mount PromptEngine::Engine => "/prompt_engine"

Usage

Visit /prompt_engine to access the admin interface.

Contributing

Contribution directions go here.

License

The gem is available as open source under the terms of the MIT License.