The TypeScript framework where you write business code first, choose deployment and API later.

Fougère mâle · Aspidium filix-mas R. Siélain, Atlas de poche des plantes des champs, pl. 124, 1895

01 — Business code

Start with your business code.

Plain classes that do the work and ask for what they need. No route, no setup, no server required.

// fronds/blog/services/Moderation.ts
export default abstract class Moderation {
  abstract canPublish(text: string): Promise<boolean>;
}

// fronds/blog/services/KeywordModeration.ts
export default class KeywordModeration extends Moderation { … }

// fronds/blog/handlers/CommentHandler.ts
export default class CommentHandler {
  constructor(private moderation: Moderation) {}

  async canPublish(text: string) {
    return this.moderation.canPublish(text);
  }
}

02 — The schema

Your schema joins it.

You describe a post once, and your code uses it everywhere.

// fronds/blog/entities/Post.ts
export default class Post extends entity({
  id: primary(),
  title: text({ min: 1, max: 200 }),
  body: text(),
  status: readOnly(oneOf('draft', 'published')),
}) {}

// fronds/blog/handlers/PostHandler.ts
export default class PostHandler {
  async publish(id: Post['id']) { … }
}

03 — Derivation

Everything else is derived.

The API, the validation, the form and the table are all read from your schema. Change a field and they change with it.

class PostHandler extends Repository<Post>  // five CRUD operations
POST /api/blog/posts                  // the API, validated
useFormFor(Post)                      // the form, validated first
posts (title, body, …)                // the table

// GraphQL, or any adapter that reads an entity's schema
Incoming — REST, GraphQL, forms, client typesOutgoing — tables, migrations, ports
See what one entity gives you →

04 — Your choices

The rest is your choice.

One process or several, which implementation answers each port, SQLite or Postgres: each is one line in fougere.config.ts, completed by your editor from your own code. Your code doesn't change.

// fougere.config.ts
fronds: { blog: { remote: 'http://127.0.0.1:4100' } },
ports: { Moderation: 'ManualModeration' },
Split it yourself →

05 — The rule

Your code is your business. How it runs is config.

Tables, protocols, hosts: Fougere keeps them apart from what your code means, so changing them never touches it.

Ask your agent

Scroll
↓

Try Fougere

Getting started →

Or add it to your app

Built with Fougere and Nuxt, hosted on GitHub Pages.