Amethyst is a Rails inspired web-framework for Crystal language
Amethyst is a web framework written in Crystal language. The goals of Amethyst are to be fast like Node.js and provide agility in application development as Rails do. Why I called it "Amethyst"? Because Crystal has a light purple color at GitHub like amethyst gemstone.
Latest version - 0.1.3
For detailed information, see docs on our wiki below:
Here are some benchmarking results
For now, next things are implemented:
Here is classic 'Hello World' in Amethyst
require "amethyst"
class WorldController < Base::Controller
actions :hello
view "hello", "#{__DIR__}/views", name
def hello
name = "World"
respond_to do |format|
format.html { render "hello", name }
end
end
end
class HelloWorldApp < Base::App
routes.draw do
all "/", "world#hello"
get "/hello", "world#hello"
register WorldController
end
end
app = HelloWorldApp.new
app.serve
# /views/hello.ecr
Hello, <%= @name %>
Feel free to fork project and make pull-requests. Stick to standart project structure and name conventions:
src/
amethyst/
module1/ # module1 files
class1.cr
...
module1.cr # loads all module1 files into namespace Amethyst::Module1
module2/
class1.cr # describe class Class1 (module, struct, i.e)
...
module2.cr # loads all module2 files into namespace Amethyst::Module2
file_module.cr # module that consists of one file
amethyst.cr # requires module1.cr, module2.cr, file_module.cr
spec/
module1/
class1_spec.cr # specs for Module1::Class
spec_helper.cr # loads main spec_helper
module2/
class2_spec.cr
spec_helper # loads "amethyst/all"
examples/ # examples to play with
# don't forget to require "..src/amethyst" or "..src/all"
I would be glad for any help with contributing.