Rails engine integration
Install the StaticPagesApi Rails engine and publish exported pages into a host Rails app.
Engine download
The Rails engine is not published online yet. Use this placeholder link until the gem or repository is uploaded.
Install the engine
Add the engine to the host Rails app, run the installer, migrate, and mount the admin/webhook routes under /static-pages-api.
- Run bundle install.
- Run bin/rails generate static_pages_api:install.
- Run bin/rails db:migrate.
- Restart the Rails server after changing the initializer or routes.
# Gemfile
gem "static_pages_api_engine", path: "../static_pages_api_engine"
Configure public page paths
The engine can serve imported pages from the host root or from a custom prefix. Root mode serves /my-page. Prefix mode can serve /landing/my-page.
StaticPagesApi.configure do |config|
config.public_path = "/"
end
# Or use a custom prefix:
StaticPagesApi.configure do |config|
config.public_path = "/landing"
end
Create the webhook in StaticPagesApi
Open the Rails engine setup page in the host app, copy the webhook endpoint, and create a saved webhook in StaticPagesApi that uses the same signing secret.
- Default setup page: /static-pages-api/admin/setup.
- Default webhook endpoint: POST /static-pages-api/webhooks/pages.
- Store STATIC_PAGES_API_WEBHOOK_SECRET in the host Rails app.
- Attach the saved webhook to each page that should publish to the Rails app.
Manage imported pages
Use the Rails engine admin panel to view imported pages, open their public URLs, change visibility, and delete an imported copy when it needs to be re-exported.
- Imported HTML is not edited in the engine.
- Edit the source page in StaticPagesApi and export again.
- Delete actions require confirmation because deleted pages must be re-imported.
Body-only exports
If you export body only, the host Rails layout must load the assets required by the imported content. For Bootstrap-based pages, load Bootstrap 5.3.8 CSS and bootstrap.bundle.min.js before rendering the imported body fragment.
© 2026 StaticPagesApi. All rights reserved.
Documentation, examples, prompts, templates, and API guidance are provided for authorized use with StaticPagesApi.