https://github.com/abogoyavlensky/clojure-stack-lite
๐ชถA quick way to start a full-stack Clojure app with Server-side Rendering. Built on SQLite/PostgreSQL, HTMX, AlpineJS and TailwindCSS v4
https://github.com/abogoyavlensky/clojure-stack-lite
alpinejs boilerplate clojure generate htmx project scaffold stack tailwindcss template
Last synced: 3 months ago
JSON representation
๐ชถA quick way to start a full-stack Clojure app with Server-side Rendering. Built on SQLite/PostgreSQL, HTMX, AlpineJS and TailwindCSS v4
- Host: GitHub
- URL: https://github.com/abogoyavlensky/clojure-stack-lite
- Owner: abogoyavlensky
- License: mit
- Created: 2025-01-22T03:48:36.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2025-09-22T23:01:09.000Z (3 months ago)
- Last Synced: 2025-09-23T00:21:42.500Z (3 months ago)
- Topics: alpinejs, boilerplate, clojure, generate, htmx, project, scaffold, stack, tailwindcss, template
- Language: Clojure
- Homepage: https://stack.bogoyavlensky.com
- Size: 229 KB
- Stars: 62
- Watchers: 2
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Clojure Stack Lite
A quick way to start a full-stack Clojure app with server-side rendering.
Built on a powerful yet lightweight stack featuring SQLite/PostgreSQL, HTMX, AlpineJS, and TailwindCSS v4.
This template is designed to be lightweight and easy to use, with a focus on rapid development and deployment. Minimal distraction and sane defaults. Everything is streamlined to give you a solid foundation for building modern web applications.
Get started building your new Clojure application in seconds and be productive!
## Usage
1. Create a new Clojure project using Clojure CLI:
```bash
clojure -Ttools install-latest :lib io.github.seancorfield/deps-new :as new
clojure -Tnew create :template io.github.abogoyavlensky/clojure-stack-lite :name myproject
```
> Requires Clojure CLI tools version `1.12.0.1479` or later.
Or alternatively using [neil](https://github.com/babashka/neil):
```bash
brew install babashka/brew/neil
neil new io.github.abogoyavlensky/clojure-stack-lite myproject
```
2. Start development (with [mise](https://mise.jdx.dev/getting-started.html)):
```shell
cd myproject
mise trust && mise install
bb clj-repl
(reset)
```
The server should be available at `http://localhost:8000`.
Check out project's README.md and template documentation for more information on how to use the project.
> [!TIP]
> Edit some details before going to production: label in `Dockerfile`,
domain in `resources/public/manifest.json` and description in `README.md`
## Features
- ๐๏ธ Robust Clojure stack powered by Integrant and Reitit/Ring
- ๐จ Lightweight frontend using HTMX, AlpineJS and TailwindCSS v4 (with optional DaisyUI
components)
- ๐ฆ SQLite/PostgreSQL database (you choose)
- ๐ Zero-downtime deployment via Kamal
- โก GitHub Actions CI/CD pipeline
- ๐งช Integration and unit testing setup with coverage
- ๐ Linting, formatting and deps version management
- โ๏ธ deps.edn and Babashka Tasks for efficient project management
- ๐ฑ Basic PWA support out of the box (without service worker)
- ๐ Optional authentication and registration flow
## Stack
### Backend
- **Integrant**: Component lifecycle management for application
- **Reitit**: Fast data-driven routing
- **Ring/Jetty**: HTTP server adapter
- **Hiccup**: HTML generation from Clojure data structures
- **Malli**: Data validation and specification
### Database
- **SQLite/PostgreSQL**: Choose between file-based SQLite or enterprise-grade PostgreSQL
- **next.jdbc**: JDBC-based database access
- **HoneySQL**: SQL as Clojure data structures
- **Ragtime**: Database migrations
### Frontend
- **HTMX 2**: HTML extensions for AJAX without writing JavaScript
- **AlpineJS 3**: Lightweight JavaScript framework for adding behavior
- **TailwindCSS 4**: Utility-first CSS framework
- [OPTIONAL] **DaisyUI**: A UI Component library (`:daisyui true` option)
### Development
- **Babashka**: Project management with tasks
- **clj-kondo**: Static analyzer and linter
- **cljfmt**: Code formatter
- **eftest/cloverage**: Testing and code coverage
### Deployment
- **Docker**: Containerization
- **Kamal**: Zero-downtime deployments
- **GitHub Actions**: CI/CD workflows
### Features
- Authentication and registration flow (`:auth true` option)
- Login, logout, registration, password reset, password change, account page
## Project structure
The template generates a Clojure project with the following structure:
```
โโโ .clj-kondo/ # Clojure linting configuration
โโโ .github/ # GitHub Actions workflows and configurations
โโโ .kamal/ # Kamal deployment configuration (only used with Kamal)
โโโ db/ # Empty database directory for database files (only used with SQLite)
โโโ dev/ # Development configuration directory
โ โโโ user.clj # User-specific development configuration
โโโ resources/ # Static resources and configuration files
โ โโโ public/ # Public assets (CSS, JS, images)
โ โโโ migrations/ # Database migration files
โ โโโ config.edn # Main configuration file for the application
โ โโโ config.dev.edn # Development-specific configuration
โ โโโ logback.xml # Logging configuration file
โโโ src/ # Source code directory
โ โโโ {{name}} # Main namespace directory
โ โโโ core.clj # Application entry point
โ โโโ db.clj # Database system component and main operations
โ โโโ handlers.clj # HTTP request handlers
โ โโโ routes.clj # Route definitions
โ โโโ server.clj # Server system component
โ โโโ views.clj # HTML templates and components with Hiccup
โโโ test/ # Test files directory
โ โโโ {{name}} # Test namespace directory
โ โโโ home_test.clj # Example test for home page
โ โโโ test_utils.clj # Test utilities
โโโ .cljfmt.edn # Formatting configuration
โโโ .gitignore # Git ignore rules
โโโ .mise.toml # mise-en-place configuration with system dependencies
โโโ .dockerignore # Docker ignore rules
โโโ bb.edn # Babashka tasks configuration for managing application
โโโ deps.edn # Clojure dependencies and aliases
โโโ Dockerfile # Dockerfile for building the application image
โโโ docker-compose.yaml # Run PostgreSQL database for local development (only used with PostgreSQL)
โโโ LICENSE # License file, AGPLv3 by default, for motivation check: https://plausible.io/blog/open-source-licenses
โโโ README.md # Project documentation
```
## Options
The template offers customization options for generating your project:
- `:db` - Choose between SQLite or PostgreSQL for your database (*Default: `:sqlite`*)
- Available values: `:sqlite` or `:postgres`
- `:daisyui` - Include [DaisyUI](https://daisyui.com/), a component library for TailwindCSS (*Default: `false`*)
- Available values: `true`
- `:deploy` - Choose between Kamal and no deployment configuration (*Default:* `:kamal`)
- Available values: `:kamal` or `:none`
- `:auth` - Add authentication and registration flow (*Default: `false`*)
- Available values: `true`
Possible values: `false | true`
Usage example:
```shell
clojure -Tnew create :template io.github.abogoyavlensky/clojure-stack-lite :name myproject :daisyui true
```
## Authentication flow preview
https://github.com/user-attachments/assets/187daef7-d39d-4794-8dd4-2a88b735c826
## Roadmap
- [x] DaisyUI support
- [x] PostgreSQL support
- [x] No deployment option
- [x] Register/Auth flow
- [ ] Sentry support
- [ ] More frontend tool options (TwinSpark, Datastar)
- [ ] Queue support
- [ ] Websocket support
## Links
- [Integrant + Aero](https://lambdaisland.com/blog/2019-12-11-advent-of-parens-11-integrant-in-practice)
- [Start TailwindCSS as part of the app system](https://shagunagrawal.me/posts/multiplayer-board-game-in-clojure/#repl)
- [Auto-reloading Ring/Reitit](https://bogoyavlensky.com/blog/auto-reloading-ring/)
- [Sessions with Ring/Reitit](https://github.com/metosin/reitit/issues/205)
- [Clojure + Kamal](https://bogoyavlensky.com/blog/deploying-full-stack-clojure-app-with-kamal/)
- [CI with Kamal](https://igor.works/blog/evolution-of-github-action-for-kamal)
## Template Development
### Requirements
To work with this template, you need:
1. [mise](https://mise.jdx.dev/) (recommended) or manual installation of:
- Java
- Clojure
- Babashka
### Getting Started
All management tasks:
```shell
bb tasks
The following tasks are available:
test Run tests for the template config
new Create a new project
release Create and push a new git tag based on provided version
```
After you updated the template and ran tests `bb test`, you can create a new project to check if everything works as expected:
```shell
bb new
```
The new project will be created in the `tmpl` directory at the root that is ignored by git.
### Release
Once you are ready to release a new version of the template, bump version in `deps.edn`:
```
:aliases -> :build -> :exec-args -> :version -> "0.1.1
```
and then run the following command:
```shell
bb release
```
A new git tag based on latest version will be created and pushed to the repository.
## License
MIT License
Copyright (c) 2025 Andrey Bogoyavlenskiy