{"id":13500957,"url":"https://github.com/sailorproject/sailor","last_synced_at":"2026-01-18T02:44:08.931Z","repository":{"id":12904925,"uuid":"15582132","full_name":"sailorproject/sailor","owner":"sailorproject","description":"A Lua MVC Web Framework.","archived":false,"fork":false,"pushed_at":"2022-10-28T09:53:01.000Z","size":1879,"stargazers_count":924,"open_issues_count":48,"forks_count":123,"subscribers_count":65,"default_branch":"master","last_synced_at":"2024-10-31T19:37:40.465Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Lua","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/sailorproject.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-01-02T11:29:24.000Z","updated_at":"2024-10-25T18:34:41.000Z","dependencies_parsed_at":"2022-09-07T17:50:43.792Z","dependency_job_id":null,"html_url":"https://github.com/sailorproject/sailor","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sailorproject%2Fsailor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sailorproject%2Fsailor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sailorproject%2Fsailor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sailorproject%2Fsailor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sailorproject","download_url":"https://codeload.github.com/sailorproject/sailor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246155998,"owners_count":20732355,"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-31T22:01:20.692Z","updated_at":"2026-01-18T02:44:08.913Z","avatar_url":"https://github.com/sailorproject.png","language":"Lua","funding_links":[],"categories":["Lua","Libraries","资源","Resources"],"sub_categories":["OpenResty"],"readme":"# Sailor\n\n[![License](http://img.shields.io/badge/Licence-MIT-brightgreen.svg)](LICENSE) [![Bountysource](https://img.shields.io/bountysource/team/sailor/activity.svg)](https://www.bountysource.com/teams/sailor)\n\n[![Build Status](https://travis-ci.org/sailorproject/sailor.svg?branch=master)](https://travis-ci.org/sailorproject/sailor)\n[![Coverage Status](https://coveralls.io/repos/github/sailorproject/sailor/badge.svg?branch=master)](https://coveralls.io/github/sailorproject/sailor?branch=master)\n\n[![LuaRocks](https://img.shields.io/badge/LuaRocks-0.5.0-blue.svg)](https://luarocks.org/modules/etiene/sailor)\n[![Lua](https://img.shields.io/badge/Lua-5.1%2C%20JIT%2C%205.2-blue.svg)](https://img.shields.io/badge/Lua-5.1%2C%20JIT%2C%205.2-blue.svg)\n\n[![Join the chat at https://gitter.im/sailorproject/sailor](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/sailorproject/sailor?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge) [![Twitter Follow](https://img.shields.io/twitter/follow/sailor_lua.svg?style=social)](https://twitter.com/sailor_lua)\n\n\n# [WE ARE LOOKING FOR NEW MAINTAINERS!](https://github.com/sailorproject/sailor/issues/173) \n\n\n### Features\n  * Compatible with Lua 5.1, Lua 5.2 and LuaJIT. (5.3 compatibility so far untested)\n  * Luarocks setup\n  * Runs over Apache2 (with mod_lua), NginX (openresty), Mongoose, Lighttpd, Xavante and Lwan web servers\n  * Using Windows, Mac or Linux systems\n  * Compatible with MySQL, PostgreSQL, SQLite and other databases supported by the luasql library\n  * MVC structure\n  * Parsing of Lua pages\n  * Routing\n  * Basic Object-relational mapping\n  * Validation\n  * Transactions\n  * App comes already shipped with Bootstrap\n  * Include, redirect\n  * Sessions, cookies\n  * Login module\n  * Easy deployment (unix only) -\u003e sailor create \"app name\" /dir/to/app\n  * Form generation\n  * Lua at client (possible through a Lua=\u003eJS virtual machine deployed with the app)\n  * Friendly urls\n  * Inspect function for better debugging =\u003e similar to a var dump\n  * Custom 404 pages\n  * Relations\n  * Model generation (reading from DB)\n  * CRUD generation (reading from model)\n  * Theme and layout (now you can have multiple layouts within a theme. e.g. 1-column and 2-column)\n  * Integration with Busted for unit and functional tests for your app\n\n\n### Roadmap\n* Integration with mod_lua's DB API and DB module refactor\n* Improvements to the form and validation module\n\nMore about the motivation to build this project can be found here: http://etiene.net/10/sailor\n\n### Directory tree info\n* /docs - this one is supposed to have documentation\n* /lua-to-js-vms - different Lua-\u003eJavascript virtual machines for use of Lua in the browser with Sailor\n* /rockspecs - Rockspec files for LuaRocks install\n* /src - Lua modules with nice stuff from Sailor and other places.\n * /sailor - Sailor modules\n * /sailor/blank-app - blank Sailor web app, can be copy-pasted as base for your own apps\n* /test - apps for testing and demonstration purposes\n\n### Supported Environments\n\nSailor has been tested under Linux, Mac OS X and Windows and is currently compatible with Apache with [mod_lua](http://www.modlua.org/) or [mod_pLua](https://github.com/Humbedooh/mod_pLua), Nginx with [ngx_lua](https://github.com/openresty/lua-nginx-module), [Lwan](http://lwan.ws/), Lighttpd with [mod_magnet](http://redmine.lighttpd.net/projects/1/wiki/Docs_ModMagnet), or any CGI-enabled web server, like [Civetweb](https://github.com/civetweb/civetweb), [Mongoose](https://github.com/cesanta/mongoose) and [Xavante](http://keplerproject.github.io/xavante/), if [CGILua](https://github.com/keplerproject/cgilua) is present.\n\n### Installation\n\nFor Linux, see [INSTALL_LINUX.md](https://github.com/sailorproject/sailor/blob/master/docs/INSTALL_LINUX.md) (Ubuntu) or [INSTALL_LINUX_ARCH.md](https://github.com/sailorproject/sailor/blob/master/docs/INSTALL_LINUX_ARCH.md) (Arch Linux)\n\nFor Windows, see [INSTALL_WIN.md](https://github.com/sailorproject/sailor/blob/master/docs/INSTALL_WIN.md)\n\nFor Mac, see [INSTALL_MAC.md](https://github.com/sailorproject/sailor/blob/master/docs/INSTALL_MAC.md)\n\n### Using Sailor\nA default Sailor app will have the following directory tree structure:\n* /conf - configuration files, open and edit them.\n* /controllers - controllers you will make!\n* /themes - default theme files.\n* /models - models you will make!\n* /pub - publicly accessible files (js libraries, for example)\n* /runtime - temporary files generated during runtime.\n* /tests - unit and functional tests\n* /views - this is where your lua pages in .lp will go\n\n#### Creating Pages #\nGo to /controllers and create your first controller! It should be a lua module. Name it whatever you want, our example is \"site.lua\". We will serve two pages, one accessible via \u003cdomain\u003e/?r=site which will run site.index() by default and another one acessible via \u003cdomain\u003e/?r=site/notindex.\n```lua\nlocal site = {}\nlocal model = require \"sailor.model\"\nfunction site.index(page)\n  local foo = 'Hello world'\n  local User = model(\"user\")\n  local u = User:new()\n  u.username = \"etiene\"\n  u.password = \"a_password\"\n  local valid, err = u:validate() -- validate() will check if your attributes follow the rules!\n  if not valid then\n    foo = \"Boohoo :(\"\n  end\n\n  -- Warning: this is a tech preview and some methods of model class do not avoid SQL injections yet.\n  page:render('index',{foo=foo,name=u.username}) -- This will render /views/site/index.lp and pass the variables 'foo' and 'name'\nend\nfunction site.notindex(page)\n  page:write('\u003cb\u003eHey you!\u003c/b\u003e')\nend\nreturn site\n```\nGo to /views, create a dir named 'site' to match your controller name and create your first page, our example is index.lp\n\n```html\n\u003c?=foo?\u003e\n\u003cp\u003e\n  Hi, \u003c?=name?\u003e\n\u003c/p\u003e\n```\nFor more information on what you can do with html and Lua Pages, visit http://keplerproject.github.io/cgilua/manual.html#templates\n\nFor more examples, you can check the test controller (/controllers/test.lua), the test views (/views/test/*) and the User model (/models/user.lua)\n\n### Documentation \u0026 Reference Manual\nhttp://sailorproject.org/?r=docs\n\n\n### Contributing\nContributions are welcome! Just make a pull request :) Please try to follow the code style of the rest of the repository.\n\nIf you made an extension for Sailor and would like to share, please get in contact so I can add it to the website.\n\n### Thanks\n\nThis repository contains the following third-party MIT licensed code:\n\n* LP Templates - http://keplerproject.github.io/cgilua/manual.html#templates\n* Valua - https://github.com/sailorproject/valua\n* Lua at client - https://github.com/felipedaragon/lua_at_client\n* Moonshine - http://moonshinejs.org/\n* Lua5.1.js - https://github.com/logiceditor-com/lua5.1.js\n* Lua.vm.js - https://kripken.github.io/lua.vm.js/lua.vm.js.html \n* Starlight - https://github.com/paulcuth/starlight\n\n\n### Suggestions, questions \u0026 hugs\nHugs! Not bugs. For bugs, fill an issue! :)\n\ndalcol@etiene.net\n\nhttps://twitter.com/etiene_d\n\n### Mail List \u0026 Support\n[Join our google group for mail list and support](https://groups.google.com/forum/#!forum/sailor-l)\n\n\n##### If you are having trouble to get Sailor working or if you got it working using different specs, please make contact so we can exchange info and I can improve the manual. Thanks!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsailorproject%2Fsailor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsailorproject%2Fsailor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsailorproject%2Fsailor/lists"}