Introduction

Clewy is a modern, statically typed hybrid programming language designed from the ground up to handle the complexity of modern business logic—without compromising the power and flexibility of a full-scale programming language.

The Problem with Traditional Solutions

Modern enterprise software suffers from a fundamental gap between business logic and technical implementation.

  • Generic programming languages (Python, TypeScript, Go) are powerful, but require every business concept—roles, permissions, workflows—to be implemented manually. A simple "Admin can approve" rule results in hundreds of lines of code scattered across controllers and middleware.
  • Low-code/no-code platforms (Bubble, AppMaster, Retool) solve the inverse problem: accessible for non-technical users but offer limited flexibility. When business requirements grow, you hit a wall. Breaking out of them is painful and expensive.
Clewy's Answer: Domain knowledge belongs in the language, not the library. Clewy introduces first-class constructs for entities, roles, and status machines natively into the syntax.

Who is it for?

  • Professional Developers: Eliminate repetitive boilerplate code and focus on product differentiation. You lose zero power compared to TS.
  • Technical Founders: Validate ideas and build MVPs rapidly without hiring a full team.
  • Agencies & System Integrators: Use industry templates and generic programming to deliver bespoke systems quickly.

Does not fit for:

  • Low-level system programming (use Rust or C)
  • Pure algorithm libraries without business logic
  • Projects without any web application component

Core Concepts: The Hybrid Engine

Clewy is not one or the other—it is both. It is structured around two co-existing layers. You can define your domain in the Business Layer, and write advanced logic in the Programming Layer. They communicate seamlessly.

industry
role
entity
permission
workflow
status
rule

Language Comparison

EgenskapCLEWYTYPESCRIPTPYTHONLOW-CODE
Affärskoncept inbyggda Ja❌ Nej❌ Nej⚠️ Delvis
Fullständig programmeringslogik Ja Ja Ja❌ Nej
Statisk typning Ja Ja⚠️ Delvis❌ Nej
Kodgenerering Ja❌ Nej❌ Nej Ja
Versionskontroll (Git) Ja Ja Ja❌ Sällan
Skalbarhet Ja Ja Ja❌ Begränsad
Branschmallar Ja❌ Nej❌ Nej⚠️ Begränsade
Rollbaserad behörighetInbyggtManuelltManuellt⚠️ Delvis
StatusmaskinerInbyggtManuelltManuellt⚠️ Delvis
UI-generering Ja❌ Nej❌ Nej Ja

Interactive Syntax Reference

Explore how Clewy handles various enterprise scenarios using explicit business logic mapped to pure functions. These are complete, production-ready blueprints exactly as seen in our documentation.

1"text-[#c4b59b]">industry "Barbershop" {
2 // ROLLER
3 "text-[#c4b59b]">role "text-[#8b9487]">Kund {
4 ema"text-[#c4b59b]">il: Str"text-[#c4b59b]">ing
5 telefon: Str"text-[#c4b59b]">ing
6 favor"text-[#c4b59b]">it_fr"text-[#c4b59b]">isör: Fr"text-[#c4b59b]">isör?
7 }
8 "text-[#c4b59b]">role Fr"text-[#c4b59b]">isör {
9 namn: Str"text-[#c4b59b]">ing
10 spec"text-[#c4b59b]">ial"text-[#c4b59b]">itet: [Str"text-[#c4b59b]">ing]
11 "text-[#c4b59b]">schema: Schema
12 betyg: "text-[#8b9487]">Float = 5.0
13 }
14 "text-[#c4b59b]">role "text-[#8b9487]">Ägare extends Fr"text-[#c4b59b]">isör {
15 but"text-[#c4b59b]">ik: But"text-[#c4b59b]">ik
16 }
17
18 // ENTITETER
19 "text-[#c4b59b]">entity "text-[#8b9487]">Tjänst {
20 namn: Str"text-[#c4b59b]">ing
21 pr"text-[#c4b59b]">is: Dec"text-[#c4b59b]">imal
22 varakt"text-[#c4b59b]">ighet: Durat"text-[#c4b59b]">ion
23 kategor"text-[#c4b59b]">i: "text-[#8b9487]">TjänstKategor"text-[#c4b59b]">i
24 akt"text-[#c4b59b]">iv: "text-[#8b9487]">Bool = true
25 "text-[#c4b59b]">validate {
26 pr"text-[#c4b59b]">is > 0 "Pr">iset måste vara större än 0"
27 varakt"text-[#c4b59b]">ighet > 0 "Varakt">igheten måste vara pos">it">iv"
28 }
29 }
30
31 "text-[#c4b59b]">entity Bokn"text-[#c4b59b]">ing {
32 kund: "text-[#8b9487]">Kund
33 fr"text-[#c4b59b]">isör: Fr"text-[#c4b59b]">isör
34 tjänst: "text-[#8b9487]">Tjänst
35 t"text-[#c4b59b]">id: "text-[#8b9487]">DateT"text-[#c4b59b]">ime
36 anteckn"text-[#c4b59b]">ingar: Str"text-[#c4b59b]">ing?
37 "text-[#c4b59b]">status: Bokn"text-[#c4b59b]">ingStatus
38 totalt: Dec"text-[#c4b59b]">imal
39 "text-[#c4b59b]">computed slutT"text-[#c4b59b]">id: "text-[#8b9487]">DateT"text-[#c4b59b]">ime {
40 "text-[#c4b59b]">return t"text-[#c4b59b]">id + tjänst.varakt"text-[#c4b59b]">ighet
41 }
42 t"text-[#c4b59b]">imestamps: true
43 }
44
45 // STATUSAR
46 "text-[#c4b59b]">status Bokn"text-[#c4b59b]">ingStatus {
47 Väntande -> Bekräftad -> Slut"text-[#c4b59b]">förd
48 Väntande -> Avbokad
49 Bekräftad -> Avbokad "text-[#c4b59b]">om (bokn"text-[#c4b59b]">ing.t"text-[#c4b59b]">id - now()) > Durat"text-[#c4b59b]">ion(hours: 2)
50 "text-[#c4b59b]">in"text-[#c4b59b]">it"text-[#c4b59b]">ial: Väntande
51 term"text-[#c4b59b]">inal: [Slut"text-[#c4b59b]">förd, Avbokad]
52 }
53
54 // BEHÖRIGHETER
55 "text-[#c4b59b]">permission {
56 "text-[#8b9487]">Kund kan skapa Bokn"text-[#c4b59b]">ing
57 "text-[#8b9487]">Kund kan läsa, avboka Bokn"text-[#c4b59b]">ing "text-[#c4b59b]">om bokn"text-[#c4b59b]">ing.kund == akt"text-[#c4b59b]">iv_användare
58 "text-[#8b9487]">Kund kan läsa "text-[#8b9487]">Tjänst, Fr"text-[#c4b59b]">isör
59 Fr"text-[#c4b59b]">isör kan läsa Bokn"text-[#c4b59b]">ing "text-[#c4b59b]">om bokn"text-[#c4b59b]">ing.fr"text-[#c4b59b]">isör == akt"text-[#c4b59b]">iv_användare
60 Fr"text-[#c4b59b]">isör kan bekräfta, slut"text-[#c4b59b]">föra Bokn"text-[#c4b59b]">ing "text-[#c4b59b]">om bokn"text-[#c4b59b]">ing.fr"text-[#c4b59b]">isör == akt"text-[#c4b59b]">iv_användare
61 "text-[#8b9487]">Ägare kan allt
62 }
63
64 // REGLER
65 rule "Inga dubbelBokn">ingar" {
66 gäller: Bokn"text-[#c4b59b]">ing
67 v"text-[#c4b59b]">illkor: {
68 "text-[#c4b59b]">inga Bokn"text-[#c4b59b]">ing b där
69 b.fr"text-[#c4b59b]">isör == bokn"text-[#c4b59b]">ing.fr"text-[#c4b59b]">isör &&
70 b."text-[#c4b59b]">id != bokn"text-[#c4b59b]">ing."text-[#c4b59b]">id &&
71 b."text-[#c4b59b]">status IN ["Väntande", "Bekräftad"] &&
72 överlapper(b.t"text-[#c4b59b]">id, b.slutT"text-[#c4b59b]">id, bokn"text-[#c4b59b]">ing.t"text-[#c4b59b]">id, bokn"text-[#c4b59b]">ing.slutT"text-[#c4b59b]">id)
73 }
74 }
75
76 // ACTIONS
77 "text-[#c4b59b]">action skapaBokn"text-[#c4b59b]">ing(tjänstId: "text-[#8b9487]">UUID, fr"text-[#c4b59b]">isörId: "text-[#8b9487]">UUID, t"text-[#c4b59b]">id: "text-[#8b9487]">DateT"text-[#c4b59b]">ime, anteckn"text-[#c4b59b]">ingar: Str"text-[#c4b59b]">ing?): Bokn"text-[#c4b59b]">ing {
78 "text-[#c4b59b]">let tjänst = "text-[#8b9487]">Tjänst.h"text-[#c4b59b]">ittaMed(tjänstId) ?? "text-[#c4b59b]">kasta NotFoundError("">Tjänst")
79 "text-[#c4b59b]">let fr"text-[#c4b59b]">isör = Fr"text-[#c4b59b]">isör.h"text-[#c4b59b]">ittaMed(fr"text-[#c4b59b]">isörId) ?? "text-[#c4b59b]">kasta NotFoundError("Fr">isör")
80
81 "text-[#c4b59b]">om !fr"text-[#c4b59b]">isör.t"text-[#c4b59b]">illgängl"text-[#c4b59b]">ig(t"text-[#c4b59b]">id, tjänst.varakt"text-[#c4b59b]">ighet) {
82 "text-[#c4b59b]">kasta Confl"text-[#c4b59b]">ictError("Fr">isören är ">inte t">illgängl">ig v">id denna t">id")
83 }
84
85 "text-[#c4b59b]">let bokn"text-[#c4b59b]">ing = Bokn"text-[#c4b59b]">ing.skapa({
86 kund: akt"text-[#c4b59b]">iv_användare,
87 fr"text-[#c4b59b]">isör, tjänst, t"text-[#c4b59b]">id, anteckn"text-[#c4b59b]">ingar,
88 totalt: tjänst.pr"text-[#c4b59b]">is,
89 "text-[#c4b59b]">status: "Väntande"
90 })
91
92 "text-[#c4b59b]">await sk"text-[#c4b59b]">ickaBook"text-[#c4b59b]">ingbekräftelse(bokn"text-[#c4b59b]">ing)
93 "text-[#c4b59b]">emittera Bokn"text-[#c4b59b]">ingsSkapad { bokn"text-[#c4b59b]">ing }
94 "text-[#c4b59b]">return bokn"text-[#c4b59b]">ing
95 }
96}

Deployment & Tooling

Clewy applications compile into standard Next.js 14+ App Router architectures. They can be deployed to any modern platform without vendor lock-in. Configuration is simple and explicit.

Configuration (`clewy.config.json`)

web {
  mål: "next.js"
  version: "14"
  tema {
    primärfärg: "#0066FF"
    typsnitt: "Inter"
    radiusStil: "avrundad"
    mörktLäge: true
  }
  layout {
    typ: "sidebar" // "sidebar" | "toppnavigation"
    logotyp: "./tillgångar/logo.svg"
    varumärkesnamn: "Min Barbershop"
  }
}

Generated Architecture

Clewy outputs highly optimized Next.js pages, API routes, and Server Actions. Middleware is automatically generated from your permission blocks.

genererad-app/
├── app/
│   ├── layout.tsx
│   ├── page.tsx
│   ├── (auth)/
│   └── api/
├── components/
├── lib/
└── prisma/

Docker Multi-Stage Build

Easily export an optimized Dockerfile using clewy export --format docker. The generated image uses Alpine Linux and minimizes runtime footprints.

FROM node:20-alpine AS bas
WORKDIR /app
FROM bas AS beroenden
COPY package*.json ./
RUN npm ci
FROM beroenden AS byggare
COPY . .
RUN npm run build
FROM bas AS produktion
ENV NODE_ENV=production
COPY --from=byggare /app/.next ./.next
COPY --from=byggare /app/node_modules ./node_modules
COPY --from=byggare /app/package.json ./package.json
EXPOSE 3000
CMD ["npm", "start"]

Roadmap & FAQ

Clewy is an evolving ecosystem. Our milestones are built on strict enterprise demands.

Version 1.0 (Now)

Core Language & Compiler

  • Complete Clewy compiler to TS/Next.js
  • Business Layer (`industry`, `role`, `entity`, `status`)
  • Database ORM schemas & API generation
  • Industry Templates (Barbershop, Gym, E-commerce)
Version 1.1 (Q3 2025)

Ecosystem Expansion

  • Multiple compiler targets (Remix, SvelteKit)
  • GraphQL API generation
  • Clewy Studio (Visual IDE)
  • Language Server Protocol (LSP)
Version 1.2 (Q4 2025)

Enterprise & AI

  • Clewy AI (Assisted completion & generation)
  • SSO / SAML Integrations
  • Automated Audit Logs
  • Multi-region distributed databases
Version 2.0 (2026)

Native Paradigm

  • Native Runtime (No Node.js dependency)
  • Distributed Workflows
  • Formal mathematical verification
  • Clewy Cloud Managed Hosting

Contact The Clewy Foundation

Technical Support
support@clewy.dev
Enterprise Sales
enterprise@clewy.dev
Security & Bounties
security@clewy.dev
Partnerships
partners@clewy.dev