A full-stack web framework for Nim, based on Jester.
Basolato extends Jester, an awesome Sinatra-like framework for Nim, while also adding features for full-stack development. It was also heavily inspired by other frameworks:
Language | Framework |
---|---|
Ruby | Rails |
PHP | Laravel |
Python | Masonite |
Java/Scala | Play |
Go | Revel |
In order to start using Basolato, you'll first need a working Nim installation. You can find installation instructions for Nim here.
Once installed, make sure Nimble, Nim's package manager, is already in your PATH. If not, add .nimble/bin
in your favorite shell.
export PATH=$PATH:~/.nimble/bin
The framework depends on several libraries (installed automatically by Nimble):
- httpbeast, a highly performant, multi-threaded HTTP 1.1 server written in Nim.
- nim-templates, a simple string templating library.
- allographer, a library for building queries.
- flatdb, a small Flatfile database, used for sessions.
- bcrypt, used for hashing passwords.
- nimAES, for AES support.
- faker, for generating fake data.
The following libraries can be used for making views:
- Karax, for single-page applications.
- react.nim, React.js bindings.
- react-16.nim, React 16.x bindings with an example app (WIP).
You can install Basolato easily using Nimble:
nimble install https://github.com/itsumura-h/nim-basolato
After installing Basolato, you should have access to the ducere
command on your shell.
Using ducere
you can easily create a template project structure to start development right away. Ducere will generate a folder automatically using your project name.
cd /your/project/dir
ducere new {project_name}
The overall file structure is as follows:
├── .gitignore
├── app
│ ├── controllers
│ │ ├── README.md
│ │ └── welcome_controller.nim
│ ├── domain
│ │ ├── models
│ │ │ ├── README.md
│ │ │ ├── di_container.nim
│ │ │ └── value_objects.nim
│ │ └── usecases
│ │ └── README.md
│ └── middlewares
│ ├── README.md
│ ├── custom_headers_middleware.nim
│ └── framework_middleware.nim
├── config.nims
├── main.nim
├── migrations
│ ├── README.md
│ ├── migrate.nim
│ └── migration0001sample.nim
├── public
│ ├── README.md
│ ├── basolato.svg
│ ├── css
│ ├── favicon.ico
│ └── js
├── resources
│ ├── README.md
│ ├── layouts
│ │ ├── application.nim
│ │ └── head.nim
│ └── pages
│ └── welcome_view.nim
├── session.db
├── {project_name}.nimble
└── tests
With your project ready, you can start serving requests using ducere
:
ducere serve # includes hot reloading
Or by compiling through Nim:
nim c -r main
- ducere CLI tool
- Routing
- Controller
- Middleware
- Headers
- Migration
- View
- Error
- Validation
- Security (CsrfToken, Cookie, Session, Auth)
- Password
- Helper
- https://github.com/the-benchmarker/web-frameworks
- https://github.com/TechEmpower/FrameworkBenchmarks
Version | Content |
---|---|
v1.0 | Support Clean architecture and Tactical DDD |
v2.0 | Support GraphQL |
Run.
nimble setupTool # Build docker image
nimble toc # Generate TOC