Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungI audited my own ML linter and had to withdraw its best evidence(21.09.2026 um 22:54 Uhr)
Sichere ProgrammierungQuantum Result Validation for Distributed Computing Systems(21.09.2026 um 22:54 Uhr)
Sichere ProgrammierungJWT Authentication and Role-Based Access Control in LocalHands(21.09.2026 um 22:56 Uhr)
Sichere ProgrammierungStochastic Parrot or Alien Mind?(21.09.2026 um 22:56 Uhr)
Sichere ProgrammierungBuilding AI for the Physical World Is a Different Engineering Problem(21.09.2026 um 22:58 Uhr)
Sichere ProgrammierungI audited my own ML linter and had to withdraw its best evidence(21.09.2026 um 22:54 Uhr)
Sichere ProgrammierungQuantum Result Validation for Distributed Computing Systems(21.09.2026 um 22:54 Uhr)
Sichere ProgrammierungJWT Authentication and Role-Based Access Control in LocalHands(21.09.2026 um 22:56 Uhr)
Sichere ProgrammierungStochastic Parrot or Alien Mind?(21.09.2026 um 22:56 Uhr)
Sichere ProgrammierungBuilding AI for the Physical World Is a Different Engineering Problem(21.09.2026 um 22:58 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

AdminJS v7 in classic NestJS without tears

I'm writing this blog because AdminJS decided to go with ESM in their latest version (v7) and make my life harder (a bit) because NestJS are still using CommonJS and theres no plan to support esm. Simply my problem was: Use…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

I'm writing this blog because AdminJS decided to go with ESM in their latest version (v7) and make my life harder (a bit) because NestJS are still using CommonJS and theres no plan to support esm.






Simply my problem was:



Use require('adminjs') and you get a ERR_REQUIRE_ESM

Use normal import in TypeScript, wait for CJS to compile, again you get a ERR_REQUIRE_ESM





But hold up isn't there official example?



There's this repo people point to: dziraf/adminjs-v7-with-nestjs. It claims to show AdminJS v7 running smoothly with NestJS, and the AdminJS docs even link to it as an example.

Cool, right?

Except... have you actually tried cloning and running it?

It doesn't work. There's a known open issue that's been sitting there for years: Not running · Issue #1.





The trick in one sentence



Load AdminJS and friends with dynamic import() inside async function and keep everything else CommonJS like it always was.





Time to code



You can find the full working example in this repository:

👉 https://github.com/arab0v/nestjs-adminjs-starter



make sure to rollback all the changes form adminjs documentation first then lets start.



Package Installation



create new nest project in current dir if you didn't already




nest new .






install all the boys. sequelize in my case and could be whatever you want just install orm's adapter from adminjs docs.




npm install sequelize adminjs @adminjs/nestjs @adminjs/sequelize  @adminjs/express express-session express-formidable






create adminjs esm loader




touch src/adminjs-loader.ts






src/adminjs-loader.ts




// This file is the only place where we touch ESM stuff
export async function loadAdminJS() {
const [adminjs, adminjsNest, sequelizeAdapter] = await Promise.all([
import('adminjs'),
import('@adminjs/nestjs'),
import('@adminjs/sequelize'),
]);

const AdminJS = adminjs.default;
const { AdminModule } = adminjsNest;

// Tell AdminJS to use Sequelize u can use any other orm adapter
AdminJS.registerAdapter({
Database: sequelizeAdapter.Database,
Resource: sequelizeAdapter.Resource,
});

return { AdminJS, AdminModule };
}






src/main.ts (almost unchanged)




import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';

async function bootstrap() {
// We let AppModule do async setup (including AdminJS)
const rootModule = await AppModule.forRoot();
const app = await NestFactory.create(rootModule);

await app.listen(process.env.PORT || 3000);
}

bootstrap();






src/app.module.ts (the place where you actually use it)




import { Module } from '@nestjs/common';
import { loadAdminJS } from './adminjs-loader';

@Module({})
export class AppModule {
static async forRoot() {
const { AdminModule } = await loadAdminJS();

return {
module: AppModule,
imports: [
AdminModule.createAdmin({
adminJsOptions: {
rootPath: '/admin',
},
}),
],
};
}
}









Why this actually works well enough




  • Dynamic import() is allowed in CommonJS files

  • Nothing else in your project needs to become ESM

  • No "type": "module" in package.json

  • No tsconfig "module": "nodenext" nightmare

  • No wrappers, no babel plugins, no weird loaders

  • You only pay the async price once at startup






What usually goes wrong (heads up)




  • Don’t do import AdminJS from 'adminjs' at the top of files — TypeScript will compile it → runtime crash

  • Put all AdminJS-related imports only inside loadAdminJS()






Resources thats lead me to this solution








End



This is not the most beautiful solution.

But it’s small, contained, and lets you keep running AdminJS v7 today without rewriting half your monorepo or forcing ESM on the whole team.



Good luck.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten AdminJS v7 in classic NestJS without tears

Thematisch verwandte Begriffe: AdminJS, classic, NestJS, without · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-79918 | MaxKB is an open-source AI assistant for enterprise. Prior to version 2.…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick