Crystal

Crystal is a general-purpose and object-oriented programming language.

Crystal logo

Manage your Crystal application content with a powerful headless CMS. Open Source, customizable, and self-hosted, Strapi provides an intuitive admin panel as well as an API consumable from any http client.

The easiest way to manage your content

Effortlessly create content structures that flex to your needs. No matter which data structure is the best for your business, you can easily define models and add relations to create rich layout experiences. Seamlessly write, edit and manage any content types. Easily build apps and digital experiences without the distraction of CMS complexities. Consume the API from Crystal using REST or GraphQL.

Crystal has a lot of benefits

Crystal is a general-purpose and object-oriented programming language. With syntax inspired by the language Ruby, it is a compiled language with static type-checking willing to be a fast a C language.

  1. Compile time checks & Methods overloading: Crystal is a compiled language and checks all your method inputs and outputs at compile time. If any types don’t line-up, they will be caught before runtime. Like Ruby, method overloading allows flexibility with inputs but without the guesswork of duck-typing. Compile time checks prevent type mismatch errors from making it to production.
  2. Framework: Love the completeness of Rails (or even Elixir’s Phoenix)? You’ll feel right at home with the Amber framework. Is the simplicity and easy customization of Sinatra more your thing? You’ll find that simplicity with Kemal. Do you want a full-stack framework that leverages compile time checks for strong params, HTTP verbs, and database queries? Checkout Lucky framework.
  3. Build fast: Hit the ground running with advanced routing, server-side rendering, code-splitting, offline support and more.

Many http clients exists in Crystal in order to communicate with a Strapi API: HTTP::Client, crest or cossack.

Strapi, the best fit with Crystal

The out-of-the-box Strapi features allow you to get up-and-running in no time:

  1. Single types: Create one-off pages that have a unique content structure
  2. Customizable API: With Strapi, you can just hop in your code editor and edit the code to fit your API to your needs.
  3. Integrations: Strapi supports integrations with Cloudinary, SendGrid, Algolia, and others.
  4. Editor interface: The editor allows you to pull in dynamic blocks of content.
  5. Authentication: Secure and authorize access to your API with JWT or providers.
  6. RBAC: Help maximize operational efficiency, reduce dev team support work, safeguard against unauthorized access or configuration modifications.
  7. i18n: Manage content in multiple languages. Easily query the different locales through the API.

Frequently Asked Questions

Crystal is a compiled programming language with Ruby-like syntax but C-level performance. It integrates with Strapi through HTTP clients to consume API content for high-performance backend applications.

Use Crystal's HTTP::Client to make GET requests to Strapi's REST API endpoints. Parse JSON responses using Crystal's built-in JSON module to work with your content data in a type-safe manner.

Yes, Crystal has GraphQL client libraries that can query Strapi's GraphQL endpoint. Install the appropriate shard (Crystal's package manager) and configure queries matching your Strapi schema.

Crystal compiles to native code, offering exceptional performance for CPU-intensive tasks. Use Crystal for high-throughput API consumers, data processing pipelines, or microservices that need to handle Strapi content efficiently.

Store JWT tokens or API keys securely in environment variables. Include the authentication header in your HTTP requests using Crystal's header configuration options for the HTTP client.