DEV Community

Nir Adler
Nir Adler

Posted on • Originally published at blog.niradler.com on

Statikly - No hassle full stack framework

Statikly is a full-stack framework for developers who want to create SSR/static sites, great for blog/static/content sites, and amazing for prototype and building internal tools and SEO optimisation.

Provide an alternative for writing frontend with endless packages and single page application frameworks like React/Vue, more and more heap is growing on server side UI, like next.js and remix, and I wanted to simplify it even more.

Statikly is based on fastify framework and ecosystem plugins, it's trying to not be very opinionated but to support strong defaults.

let's create our first project

npm i -g statikly nodemon
mkdir statikly
cd statikly
statikly init # clone niradler/statikly-demo
npm run watch # visit localhost:3000

Enter fullscreen mode Exit fullscreen mode

The code behind this page can be found in views/index.ejs if you wonder where the rest of the HTML coming from we use the layout feature, the page layout is at partials\layout.ejs configured as env var

STATIKLY_LAYOUT=./partials/layout.ejs

Enter fullscreen mode Exit fullscreen mode

in .env make sure you don't commit .env with secrets to git.

<section>
  <h1>Todo example</h1>
  <a href="/todos"><button>My Todos</button></a>
</section>

<figure>
  <img src="public/image.jpg" alt="Minimal landscape" />
</figure>

Enter fullscreen mode Exit fullscreen mode

Go ahead and play with the demo todo app to figure out how you can pass data to your view with loaders, checkout the todos loader for example views\todos\loader.js

Supported env vars:

NODE_ENV=production # optional: set in production
STATIKLY_ROOT= # optional: set to override current folder
STATIKLY_STATIC_FOLDER=public # optional: for other public folder
STATIKLY_TEMPLATE=ejs # optional: template engine to use for the complete list @fastify/view
STATIKLY_LAYOUT= # optional: layout path
STATIKLY_VIEWS=views # optional: for other views folder
STATIKLY_PASSWORD=1234 # optional: basic auth
STATIKLY_USERNAME=user # optional: basic auth

Enter fullscreen mode Exit fullscreen mode

Another helpful command wil be running statikly --help

Top comments (0)