{"id":13483216,"url":"https://github.com/vladfaust/crystalworld","last_synced_at":"2025-04-01T03:31:51.038Z","repository":{"id":52503503,"uuid":"134903361","full_name":"vladfaust/crystalworld","owner":"vladfaust","description":"RealWorld back-end API implementation 👍","archived":false,"fork":false,"pushed_at":"2021-04-27T11:37:15.000Z","size":219,"stargazers_count":43,"open_issues_count":2,"forks_count":5,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-08-01T17:34:12.843Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://realworld.io","language":"Crystal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vladfaust.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-25T20:47:06.000Z","updated_at":"2024-05-23T04:43:33.000Z","dependencies_parsed_at":"2022-09-14T03:10:27.924Z","dependency_job_id":null,"html_url":"https://github.com/vladfaust/crystalworld","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vladfaust%2Fcrystalworld","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vladfaust%2Fcrystalworld/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vladfaust%2Fcrystalworld/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vladfaust%2Fcrystalworld/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vladfaust","download_url":"https://codeload.github.com/vladfaust/crystalworld/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221299707,"owners_count":16794062,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T17:01:09.140Z","updated_at":"2024-10-24T09:09:59.444Z","avatar_url":"https://github.com/vladfaust.png","language":"Crystal","funding_links":[],"categories":["Examples and funny stuff"],"sub_categories":[],"readme":"# ![Crystal World logo](media/logo.png)\n\n[![Built with Crystal](https://img.shields.io/badge/built%20with-crystal-000000.svg?style=flat-square)](https://crystal-lang.org/)\n[![Build status](https://img.shields.io/travis/vladfaust/crystalworld/master.svg?style=flat-square)](https://travis-ci.org/vladfaust/crystalworld)\n[![Awesome](https://awesome.re/badge-flat2.svg)](https://github.com/veelenga/awesome-crystal)\n[![vladfaust.com](https://img.shields.io/badge/style-.com-lightgrey.svg?longCache=true\u0026style=flat-square\u0026label=vladfaust\u0026colorB=0a83d8)](https://vladfaust.com)\n\nWelcome to the Crystal World, a [RealWorld back-end API](https://realworld.io) application implemented in [Crystal](https://crystal-lang.org)!\n\n## About\n\nThis project aims to demonstrate of how simple and enjoyable it is to develop a high-performance web application in [Crystal](https://crystal-lang.org), which is proven to be both *fast* and *slick* language, featuring:\n\n* ⚡️ **Efficiency** comparable to C\n* 🍃 **Beauty** inherited from Ruby\n* 🔒 **Type system** with smart compiler\n\nCrystal World relies on [Onyx framework](https://github.com/onyxframework) as its foundation. The database chosen is SQLite. Go ahead and read the source code, you'll find it delightfully simple and understandeable! 🍰\n\n*Note that although Crystal itself is not officially released yet, it's already being used in many real-world (including business) applications.*\n\n## Installation\n\nClone this repository with\n\n```sh\n\u003e git clone https://github.com/vladfaust/crystalworld.git \u0026\u0026 cd crystalworld\n```\n\nCrystal is a compiled language. It has different compilation modes, e.g. development and production. Production code is faster and packed into a single binary, however its builds take more time. Therefore, there are multiple ways to proceed:\n\n### Production build with Docker\n\n1. Build an image:\n\n```sh\n\u003e docker build -t crystalworld:latest .\n```\n2. Apply migrations:\n\n```sh\n\u003e docker run -e DATABASE_URL=\"sqlite3://./crystalworld.db\" crystalworld bin/cake db:migrate\n```\n\n3. Launch the server\n\n```sh\n\u003e docker run -p 5000:5000 -e DATABASE_URL=\"sqlite3://./crystalworld.db\" \\\n-e JWT_SECRET_KEY=\"63a051d73d71c997d38946f82e708301\" crystalworld\n```\n\n### Production build from the source code\n\n0. [Install Crystal](https://crystal-lang.org/install/) on your machine\n1. Set env vars\n\n```sh\n\u003e export DATABASE_URL=\"sqlite3://./crystalworld.db\" CRYSTAL_ENV=production \\\nJWT_SECRET_KEY=\"63a051d73d71c997d38946f82e708301\"\n```\n\n2. Build the app\n\n```sh\n\u003e time shards build --production --release --no-debug --progress --stats\n```\n\n3. Apply migrations\n\n```sh\n\u003e ./bin/cake db:migrate\n```\n\n4. Launch the server\n\n```sh\n\u003e ./bin/server\n```\n\n### Development build from the source code\n\n0. [Install Crystal](https://crystal-lang.org/install/) on your machine\n1. Create an `/.env.development.local` file and put some environment variables there (see below)\n2. Apply migrations\n\n```sh\n\u003e crystal src/bin/cake.cr -- db:migrate\n```\n\nor install [Cake](https://github.com/axvm/cake) and exec `cake db:migrate`\n\n3. Launch the server in development mode\n\n```sh\n\u003e crystal src/bin/server.cr --progress\n```\n\nExample output:\n\n![Example terminal screenshot](media/terminal-screenshot.png)\n\n## Environment variables\n\nCrystal World follows [twelve-factor methodology](https://12factor.net/) and therefore relies on environment variables. You can see example and default variables at `/.env.example` file.\n\n## Testing\n\nCrystal has a convenient testing environment built-in. Read more at [Testing docs](https://crystal-lang.org/docs/guides/testing.html). Basically, you place specs under `/spec` folder and run them with `crystal spec`. It's also a good idea to have a separate `/.env.test` file.\n\nReal World comes with integration testing suit, which can be found at \u003chttps://github.com/gothinkster/realworld/tree/master/api\u003e. Crystal World uses this script in its CI, so if the badge is green it means that all the integration tests are passed. You can run these tests locally on your machine as well, just to be sure.\n\n## Contributors\n\n- [@vladfaust](https://github.com/vladfaust) Vlad Faust - creator, maintainer\n\n## Licensing\n\nThis software is licensed under [MIT License](LICENSE).\n\n[![Open Source Initiative](https://upload.wikimedia.org/wikipedia/commons/thumb/4/42/Opensource.svg/100px-Opensource.svg.png)](https://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvladfaust%2Fcrystalworld","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvladfaust%2Fcrystalworld","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvladfaust%2Fcrystalworld/lists"}