• Stars
    star
    228
  • Rank 170,158 (Top 4 %)
  • Language
    Nim
  • License
    MIT License
  • Created over 4 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An asynchronous fullstack web framework for Nim.

Basolato Framework


An asynchronous multiprocessing full-stack web framework for Nim, based on asynchttpserver.

โš ๏ธ This project is under heavy development. It's not yet production-ready. โš ๏ธ

The only supported OS are Alpine, Debian, and Ubuntu.
It is recommended to use Docker regular flavor for development.
nimlang/nim:1.6.6-alpine-regular or nimlang/nim:1.6.6-ubuntu-regular
https://hub.docker.com/r/nimlang/nim

in Ubuntu 22.04ใ€Nim can' run because of OpenSSL3 and recommand to use Debian 11.

FROM debian:11.5-slim

# prevent timezone dialogue
ENV DEBIAN_FRONTEND=noninteractive

RUN apt update --fix-missing && \
    apt upgrade -y
RUN apt install -y --fix-missing \
        gcc \
        g++ \
        xz-utils \
        ca-certificates \
        vim \
        wget \
        procps \
        git \
        sqlite3 \
        libpq-dev \
        libmariadb-dev \
        libsass-dev

ARG VERSION="1.6.8"
WORKDIR /root
RUN wget --inet4-only https://nim-lang.org/download/nim-${VERSION}-linux_x64.tar.xz && \
    tar -Jxf nim-${VERSION}-linux_x64.tar.xz && \
    rm -f nim-${VERSION}-linux_x64.tar.xz && \
    mv nim-${VERSION} .nimble

ENV PATH $PATH:/root/.nimble/bin

Table of Contents

Introduction

Basolato extends asynchttpserver, an implements a high performance asynchronous HTTP server in Nim std library, 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

Set up your environment

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

Dependencies

The framework depends on several libraries (installed automatically by Nimble):

  • allographer, a library for building queries.
  • flatdb, a small Flatfile database, used for sessions.
  • bcrypt, used for hashing passwords.
  • faker, for generating fake data.
  • sass, provides a Sass/SCSS to CSS compiler for Nim through bindings to libsass.

Installation

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.

Creating projects

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:

โ”œโ”€โ”€ app
โ”‚ย ย  โ”œโ”€โ”€ data_stores
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ queries
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ repositories
โ”‚ย ย  โ”œโ”€โ”€ di_container.nim
โ”‚ย ย  โ”œโ”€โ”€ http
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ controllers
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ welcome_controller.nim
โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ middlewares
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ”œโ”€โ”€ auth_middleware.nim
โ”‚ย ย  โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ set_headers_middleware.nim
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ views
โ”‚ย ย  โ”‚ย ย      โ”œโ”€โ”€ errors
โ”‚ย ย  โ”‚ย ย      โ”œโ”€โ”€ layouts
โ”‚ย ย  โ”‚ย ย      โ”‚ย ย  โ”œโ”€โ”€ application_view.nim
โ”‚ย ย  โ”‚ย ย      โ”‚ย ย  โ””โ”€โ”€ head_view.nim
โ”‚ย ย  โ”‚ย ย      โ””โ”€โ”€ pages
โ”‚ย ย  โ”‚ย ย          โ””โ”€โ”€ welcome_view.nim
โ”‚ย ย  โ”œโ”€โ”€ models
โ”‚ย ย  โ””โ”€โ”€ usecases
โ”œโ”€โ”€ config
โ”‚ย ย  โ””โ”€โ”€ database.nim
โ”œโ”€โ”€ config.nims
โ”œโ”€โ”€ database
โ”‚ย ย  โ”œโ”€โ”€ migrations
โ”‚ย ย  โ”‚ย ย  โ””โ”€โ”€ migrate.nim
โ”‚ย ย  โ””โ”€โ”€ seeders
โ”‚ย ย      โ””โ”€โ”€ seed.nim
โ”œโ”€โ”€ main.nim
โ”œโ”€โ”€ public
โ”‚ย ย  โ”œโ”€โ”€ basolato.svg
โ”‚ย ย  โ”œโ”€โ”€ css
โ”‚ย ย  โ”œโ”€โ”€ favicon.ico
โ”‚ย ย  โ””โ”€โ”€ js
โ”œโ”€โ”€ resources
โ”‚ย ย  โ””โ”€โ”€ lang
โ”‚ย ย      โ”œโ”€โ”€ en
โ”‚ย ย      โ”‚ย ย  โ””โ”€โ”€ validation.json
โ”‚ย ย      โ””โ”€โ”€ ja
โ”‚ย ย          โ””โ”€โ”€ validation.json
โ”œโ”€โ”€ {project_name}.nimble
โ””โ”€โ”€ tests
    โ””โ”€โ”€ test_sample.nim

With your project ready, you can start serving requests using ducere:

ducere serve # includes hot reloading
> Run server for development

ducere build
./startServer
> Run server for production 

Documentation

English
ๆ—ฅๆœฌ่ชž

Benchmark

benchmark

Roadmap

Version Content
v1.0 Support Clean architecture and Tactical DDD
v2.0 Support GraphQL

Development

Generate TOC of documents

Run.

nimble setupTool # Build docker image
nimble toc # Generate TOC