# expresso-macchiato

## 🧘 Relax. Let expresso-macchiato handle it.

Writing a fully operational backend server—with routes, a database, and documentation—shouldn’t feel like crafting a rocket 🚀. With expresso-macchiato, the setup is minimal, the structure is clean, and the flexibility is in your hands.

No more boilerplate. No more endless wiring.

### 🧩 What is expresso-macchiato?

expresso-macchiato is a lightweight but powerful Node.js framework built on top of Express and TypeORM. It simplifies the process of:

* Creating and exposing RESTful routes from entity definitions.
* Generating and serving a Swagger schema out of the box.
* Bootstrapping your entire app (routes, database, sockets, etc.) with a single class.

It's designed for developers who want to go from zero to production-ready server in minutes.

Writing this:

```ts
export const noteRoutes = new RouterWrapper({
    tag:'note',
    basePath:'/api/note',
    dbRouting:
    {
        entity: Note,
        secure: { user_id: { tokenKey: 'id', methods: "*" } },
        getParameters: [{ in: 'query', like:true, name:'content' }],
        bodyParameters: Swagger.createSchema({ content: 'string' }),
    }
});
```

and mounting it to the Starter, you will:

1. Create dynamic routes for your entity.
2. Secure them with a token, with eventually some logics to query the db with the decrypted payload
3. Create the swagger documentation you can access right after.

<figure><img src="/files/wWjmzebjdjSWqYPS7MLS" alt=""><figcaption></figcaption></figure>

### 🏁 Quick Start

The fastest way to get started with expresso-macchiato is using the official project scaffolding:

```bash
npx create-expresso-macchiato
```

This command sets up a complete and ready-to-use template, optimized for working with expresso-macchiato.

**Why this is the recommended way:**

1. Preconfigured build system using TSUP.
2. Includes jwe-token-based authentication and pre-exposed API routes.
3. Built-in MinIO utility for handling image storage from Docker.
4. Comes with a Dockerfile and docker-compose setup out of the box.
5. Includes prefilled .env files and a .gitignore tailored for Node/TypeScript projects.
6. Included a mockup dev socket and background service

You just need to:

```bash
npm install
npm run dev
```

And you're good to go! 🎉\
This will:

* Connect to the database
* Expose some demo routes
* Serve auto-generated Swagger docs at /swagger-ui

#### 🛠️ Manual Installation

Prefer starting from scratch? You can install expresso-macchiato directly into your own project:

```bash
npm install expresso-macchiato
```

### 🚀 Next Version

If you like **express-o**, I'm open to contributors and motivated to keep improving the project.

#### Planned for `v1.0.0`:

1. ✨ A clean and robust socket implementation (currently in the `develop` branch)
2. 🔐 Support for multiple authentication strategies in dynamic DB routing (currently only JWE is supported)
3. 💡 Fresh ideas and contributions from the community!

***

Feel free to open an issue, fork the repo, or start a discussion — let's make express-o even better together!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://alessios-books.gitbook.io/expresso-macchiato/expresso-macchiato.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
