npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@baguettejs/core

v0.2.1

Published

🥖 Core framework for BaguetteJS — minimalist TypeScript backend

Readme

🥖 BaguetteJS

Le framework TypeScript léger, croustillant et 100 % français 🇫🇷

BaguetteJS est un framework backend minimaliste écrit en TypeScript, inspiré de NestJS et Spring,
mais conçu pour être léger, rapide et sans dépendances lourdes.

🧠 Un décorateur, un contrôleur, une injection : votre serveur est prêt à lever !


🚀 Installation

npm install baguettejs reflect-metadata

⚠️ Vous devez activer les décorateurs et les métadonnées dans votre tsconfig.json :

{
  "compilerOptions": {
    "target": "ES2020",
    "module": "NodeNext",
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "esModuleInterop": true,
    "strict": true
  }
}

⚙️ Exemple rapide

import 'reflect-metadata';
import { App, Controller, Get, Post, Req, Res, Body } from 'baguettejs';
import { UserService } from './services/user.service';

@Controller('/users')
export class UserController {
  constructor(private readonly userService: UserService) {}

  @Get()
  getAll() {
    return this.userService.findAll();
  }

  @Post()
  create(@Body() body: any, @Res() res: any) {
    const user = this.userService.create(body);
    res.statusCode = 201;
    return user;
  }
}

const app = new App();
app.bootstrap('src/controllers');
app.listen(3000);

🧩 Principes clés

1. Décorateurs de routage

| Décorateur | Description | Exemple | |-------------|-------------|----------| | @Controller('/users') | Définit la base du contrôleur | class UserController {} | | @Get('/profile') | Route GET | /users/profile | | @Post() | Route POST | /users | | @Put('/:id') | Route PUT | /users/:id | | @Delete('/:id') | Route DELETE | /users/:id |


2. Injection de dépendances

import { Service } from 'baguettejs';

@Service()
export class UserService {
  findAll() {
    return [{ id: 1, name: 'Alice' }];
  }
}

Les dépendances sont injectées automatiquement via le constructeur.


3. Décorateurs de paramètres

| Décorateur | Description | |-------------|-------------| | @Req() | Objet req natif | | @Res() | Objet res natif | | @Body() | Corps JSON de la requête | | @Param('id') | Paramètre d’URL | | @Query('search') | Paramètre de query string |


đź§  Exemple complet

@Controller('/users')
export class UserController {
  constructor(private readonly service: UserService) {}

  @Get(':id')
  getUser(@Param('id') id: string) {
    return this.service.findOne(id);
  }

  @Post()
  create(@Body() body: any) {
    return this.service.create(body);
  }
}

@Service()
export class UserService {
  private users = [{ id: 1, name: 'Alice' }];

  findOne(id: string) {
    return this.users.find(u => u.id === Number(id));
  }

  create(data: any) {
    const user = { id: Date.now(), ...data };
    this.users.push(user);
    return user;
  }
}

🧱 Structure recommandée

src/
 ├── core/
 │   ├── app.ts
 │   ├── container.ts
 │   ├── decorator.ts
 │   └── param.ts
 ├── controllers/
 │   └── user.controller.ts
 ├── services/
 │   └── user.service.ts
 └── main.ts

đź’ˇ Pourquoi BaguetteJS ?

  • 🥖 LĂ©ger et croustillant : aucun runtime framework lourd
  • đź§© Modulaire : chaque partie est indĂ©pendante
  • đź’‰ Injection de dĂ©pendances automatique
  • 🎯 BasĂ© sur les dĂ©corateurs TypeScript
  • đź’¬ Lisible, Ă©lĂ©gant et extensible

🧰 À venir

  • [ ] Middlewares globaux et par route
  • [ ] Gestion d’erreurs personnalisĂ©e
  • [ ] Guards (auth, rĂ´les, permissions)
  • [ ] Validation automatique du @Body()
  • [ ] GĂ©nĂ©ration SDK client automatique (OpenAPI-like)

💻 Développement

Lancer le projet en local

npm install
npm run dev

Compiler le framework

npm run build

Publier sur npm

npm login
npm publish --access public

đź“„ Licence

MIT © 2025 — Fait avec ❤️ par Cyprien Tertrais