Creating a Shard
Explore some Crystal projects on GitHub, such as the sentry tool[39] or the MongoDB driver.[40] You’ll notice that they all have the same simple structure, which we’ll dissect in a moment. This similarity isn’t a coincidence: they were all created with the Crystal tool chain. When starting a brand new application, this tool generates a basic app directory structure on which to build your project. So Crystal projects, or shards as they’re called, have a common structure—this makes it easy to explore their code.
The command to create a new project has the following structure:
$ crystal init TYPE NAME [DIR]
TYPE can be app (for an application) or lib (when writing a library). NAME is, of course, the name of the project. The optional ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access