Coder Social home page Coder Social logo

rads / rain Goto Github PK

View Code? Open in Web Editor NEW
8.0 4.0 0.0 98 KB

๐ŸŒง๏ธ A Clojure/Script library for fast and flexible web apps.

License: MIT License

Clojure 73.59% JavaScript 19.09% CSS 0.26% Shell 7.06%
babashka backend bbin biff clojure clojurescript frontend hydration incremental-static-regeneration isomorphic javascript jetty nextjs re-frame react reagent server-side-rendering static-site-generator rain-clj

rain's Introduction

rain Slack

A Clojure/Script library for fast and flexible web apps.

When you start architecting a new web app, one of the foundational decisions you make is - "How and where do I want to render content?". Should it be rendered on the web server, build server, on the Edge, or directly on the client? Should it be rendered all at once, partially, or progressively? (patterns.dev)

Rain helps you answer these questions. Once you decide on an approach, you can use rain new to create an app from scratch and deploy it to a JAMstack host or cloud VPS provider in minutes. Check out the Installation and Usage sections to get started.

  • Supports multiple rendering patterns in the same app:
    • Static Site Generation (SSG)
    • Incremental Static Generation (ISG)
    • Server-Side Rendering (SSR)
    • Client-Side Rendering (CSR)
    • Hydration
  • Supports reusable code between the server and browser
  • Helpers for biff, reitit, reagent, and re-frame
  • Fast
  • Extensible

Status: alpha

Table of Contents

Installation

Command-Line Tool (CLI)

First, install bbin. Then run the following command:

bbin install io.github.rads/rain

Now you can run rain in your shell to see the docs for the CLI tool.

Library

Add io.github.rads/rain to your deps.edn:

io.github.rads/rain {:git/tag "v0.1.8" :git/sha "c490345"}

See the Usage section for examples on how to use the library to build an app.

Docs

Usage

Rain supports multiple rendering patterns. See the table below to find an example based on your needs.

Note: This table is a work-in-progress and may change as Rain matures. For a more nuanced view of rendering patterns, see the Additional Resources section.

SSG ISG CSR SSR Hydration
Example rain.examples.ssg bbin-site TODO TODO rain.examples.todomvc
Command rain new -t ssg TODO TODO TODO rain new -t hydration
Use Cases Landing pages, blogs Dashboards Full-featured apps Document-based sites Supports both CSR and SSR use cases
Host as a static site (JAMstack)? Yes Yes Yes No No
API required? No No Yes No Yes
Custom server required? No No No Yes Yes
JavaScript required for viewing? No No Yes No No
JavaScript required for interaction? No No Yes No Yes
Dynamic content on build? Yes Yes Yes Yes Yes
Dynamic content after deploy? No Yes Yes Yes Yes
Dynamic content based on request? No No Yes Yes Yes
User login supported? No No Yes Yes Yes
First Content Paint (FCP)? Good Good Varies Good Good
Time-to-Interactive (TTI)? Good Good Varies Good Varies

Additional Resources

rain's People

Contributors

rads avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rain's Issues

Add `rain` CLI

# Standalone install
curl -o- https://raw.githubusercontent.com/rads/rain/main/rain > ~/.local/bin/rain

# Depends on clojure/tools/clojure and borkdude/brew/babashka
# `bbin` can be invoked w/o installing via `rain install`
brew install rads/tools/rain

# Install via bbin
bbin install io.github.rads/rain

# Create a new project
rain new <dir>
rain new <dir> --template ssg
rain new <dir> --template isg
rain new <dir> --template ssr
rain new <dir> --template csr
rain new <dir> --template hydration

# Alias for `bb dev`
# If `bb dev` not defined, run default main namespace with nREPL included
rain dev

# Run both `rain test-clj` and `rain test-cljs`
rain test

# Alias for `bb test-clj`
# If `bb test-clj` not defined, run tests with `cognitect-labs/test-runner`
rain test-clj

# Alias for `bb test-cljs`
# If `bb test-cljs` not defined, run tests with `shadow-cljs`
rain test-cljs

# Alias for `clj` (no aliases) or `clj -A` (with aliases)
rain repl

# Alias for `clojure -X`
rain exec <fn-sym>

# Alias for `clojure -M`
rain main <main-ns>

SSG template

bbin install io.github.rads/rain
rain new rads/example
[rain/shell] neil new --name rads/example --template io.github.rads/rain.templates.ssg --git/url https://github.com/rads/rain
Creating project from io.github.rads/rain.templates.ssg in example

[rain/shell] git init
Initialized empty Git repository in /Users/rads/src/rain/example/.git/

[rain/shell] git add .

[rain/shell] git commit -m 'First commit'
[main (root-commit) 297dd4b] First commit
 10 files changed, 468 insertions(+)
 create mode 100644 .github/workflows/full-build.yml
 create mode 100644 .gitignore
 create mode 100644 bb.edn
 create mode 100644 deps.edn
 create mode 100644 resources/live.js
 create mode 100644 resources/tailwind.config.js
 create mode 100644 resources/tailwind.css
 create mode 100644 src/rads/example.clj
 create mode 100644 src/rads/example/app.clj
 create mode 100644 src/rads/example/ui.clj

[rain/info] New project created:
[rain/info]
[rain/info]   Template:  io.github.rads/rain.templates.ssg
[rain/info]   Directory: /Users/rads/src/rain/example
[rain/info]   Namespace: rads.example
[rain/info]
[rain/info] Now you can go to your project and start the dev server:
[rain/info]
[rain/info]   cd example && bb dev

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.