Skip to content
sorvienPublic

About

An instant, "headless" admin panel for modern JavaScript backends, built on ElysiaJS and Drizzle ORM.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

4 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

128 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AdminGen Logo

AdminGen

Instant, headless admin panel framework for modern TypeScript backends
Built natively for ElysiaJS and Drizzle ORM β€’ Powered by Bun

npm version npm downloads Docs GitHub Workflow Status Good First Issues PRs Welcome Sponsor License: MIT Powered by Bun Backend: Elysia ORM: Drizzle

AdminGen is an instant, ultra-lightweight admin panel framework for modern TypeScript backends, built natively for ElysiaJS and Drizzle ORM.

Point AdminGen at your existing Drizzle database schema, and it will:

  1. Introspect your tables, foreign keys, and relations.
  2. Auto-generate secure REST endpoints with pagination, filtering, and sorting in Elysia.
  3. Serve a dynamic, pre-built React admin panel (TanStack + Shadcn/UI) in under 40MB of RAM.

⚑ Why AdminGen?

Most existing CMS solutions (Strapi, Payload, Keystone) are heavy Node.js monoliths that consume 600MB to 1.2GB of RAM per project, creating massive server bills and sluggish cold starts.

AdminGen was engineered from day one on Bun + Elysia + Drizzle to be the fastest, lightest self-hosted admin engine in the JavaScript ecosystem.

Feature AdminGen Payload CMS Strapi Directus
Runtime Bun (or Node) Node.js Node.js Node.js
Backend Framework ElysiaJS Next.js App Router Koa / Custom Express
Database Engine Drizzle ORM (SQL First) Mongoose / Custom Custom ORM Knex
Idle Memory (RAM) ~35MB – 50MB ~600MB – 1.2GB ~350MB – 600MB ~180MB – 350MB
Cold Boot Time < 200 ms 5s – 15s 4s – 10s 3s – 8s
Frontend Stack TanStack + Shadcn/UI Custom React Custom React Vue.js
Schema Introspection Zero-Config (Drizzle) Code Config Schema Builder Database Direct

✨ Core Features

  • ⚑ Zero-Config Schema Introspection: Introspects tables, foreign keys, columns, enums, required fields, and read-only attributes directly from your Drizzle schema.
  • πŸ“Š Server-Side Operations: Dynamic server-side pagination, sorting, and text search out of the box.
  • πŸ”— Relational Lookups: Automatically resolves foreign keys into relational dropdown selects.
  • 🎨 Modern Dark UI: Pre-built with TanStack Router, TanStack Query, TanStack Table, and Shadcn/UI.
  • πŸͺΆ Ultra Low Footprint: Runs comfortably in ~40MB RAM. Host 30+ client admin panels on a single $5 VPS.
  • πŸ”’ Pluggable Auth: Plug in any authentication provider (JWT, Cookies, Better-Auth, Lucia) with a single interface.
  • πŸ—„οΈ Multi-Database: Supports SQLite, PostgreSQL, and MySQL via Drizzle ORM.

πŸš€ Try It Now

Open in CodeSandbox

No local installation needed: open the CodeSandbox template and wait for the workspace dependencies and packages to build. The example-app starts automatically on port 3000, with a pre-seeded SQLite database. In the port 3000 preview, open /admin and log in with admin / admin. CodeSandbox may require you to sign in; VM usage is subject to your account's limits.

Run locally

Experience AdminGen with pre-seeded data right now:

# 1. Clone the repository
git clone https://github.com/sorvien/admingen.git
cd admingen

# 2. Install dependencies, build the workspace & run the example app
bun install
bun run build
bun dev

Open http://localhost:3000/admin in your browser.
Log in with: admin / admin


πŸ“¦ Quick Start (Scaffold in 10 Seconds)

To create a new AdminGen app with pre-configured schemas and demo data:

bunx create-admingen my-admin

πŸ› οΈ Manual Installation (Existing Project)

1. Installation

In your Elysia + Drizzle project, install AdminGen and the Drizzle adapter:

bun add @sorvien/admingen@beta @sorvien/admingen-adapter-drizzle@beta

Ensure peer dependencies are installed:

bun add elysia drizzle-orm @sinclair/typebox

2. Usage

Mount AdminGen into your Elysia server in just 4 lines of code:

import { Elysia } from 'elysia';
import { drizzle } from 'drizzle-orm/bun-sqlite';
import { Database } from 'bun:sqlite';
import * as schema from './schema'; // Your Drizzle schema

import { AdminGen } from '@sorvien/admingen';
import { createDrizzleAdapter } from '@sorvien/admingen-adapter-drizzle';

// 1. Initialize Drizzle with your schema
const db = drizzle(new Database('sqlite.db'), { schema });

// 2. Generate the adapter from your schema
const adapterResult = createDrizzleAdapter({ schema });

// 3. Mount AdminGen plugin
const app = new Elysia()
  .decorate('db', db)
  .use(AdminGen({ adapterResult, adminPath: '/admin' }))
  .listen(3000);

console.log('🦊 Admin panel live at http://localhost:3000/admin');

Open http://localhost:3000/admin to manage your data!


♻️ Lifecycle Hooks

Add per-resource lifecycle hooks when you need to transform data or run side effects around writes:

const adapterResult = createDrizzleAdapter({
  schema,
  config: {
    resources: [{
      slug: 'users',
      hooks: {
        beforeChange: async ({ data, operation, id }) => {
          return {
            ...data,
            email: data.email?.trim().toLowerCase(),
          };
        },
        afterChange: async ({ record, operation, id }) => {
          await invalidateUserCache(record.id);
        },
        beforeDelete: async ({ id }) => {
          return id !== SYSTEM_USER_ID; // return false to cancel deletion
        },
        afterDelete: async ({ id }) => {
          await writeAuditLog({ action: 'user.deleted', id });
        },
      },
    }],
  },
});

Hooks can be synchronous or asynchronous. Errors thrown by a hook are propagated to the request. A beforeDelete hook can return false to cancel the delete.


πŸ”’ Adding Authentication

Protect your admin dashboard with a custom auth provider:

const authProvider = {
  authenticate: async (ctx: any) => {
    const token = ctx.cookie?.auth?.value;
    if (token === process.env.ADMIN_SECRET) {
      return { id: 1, name: 'Admin', email: '[email protected]' };
    }
    return null; // Redirects to /login
  }
};

app.use(AdminGen({
  adapterResult,
  authProvider
}));

πŸ›οΈ Monorepo Architecture

AdminGen is structured as a modular Bun monorepo:

admingen/
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ types/            # Shared contracts (AdminField, AdminSchema, AdapterResult)
β”‚   β”œβ”€β”€ adapter-drizzle/  # Drizzle schema introspection engine & CRUD handlers
β”‚   β”œβ”€β”€ ui/               # SPA Admin Panel (TanStack Router + Query + Table + Shadcn)
β”‚   └── admingen/         # Main Elysia plugin serving APIs & bundled SPA assets
β”œβ”€β”€ example-app/          # Fully functional SQLite demo application
└── example-app-postgres/ # Advanced PostgreSQL demo application with Docker Compose

πŸ§ͺ Testing

AdminGen has a comprehensive automated test suite testing schema introspection, CRUD handlers, and Elysia routing:

bun test

πŸ›£οΈ Roadmap

Live milestone tracking is available on our GitHub Milestones. See ROADMAP.md for the full architectural vision.

  • Monorepo setup (Bun, TypeScript, automated CI)
  • Drizzle schema introspection (SQLite, PostgreSQL, MySQL)
  • Auto-generated REST CRUD API endpoints in Elysia
  • Server-side pagination, sorting, and text filtering
  • Dynamic TanStack Table & Sidebar navigation
  • Relational foreign key dropdown lookups
  • Zero-config schema & auth fallback mode
  • v0.2.0: UI Polish & Table UX (Toasts, Cmd+K palette, CSV export, Relative timestamps, Password show/hide, Faceted filters)
  • v0.3.0: Extensibility & DB Parity (Lifecycle hooks, Multi-package manager CLI, Composite keys, RBAC permissions)
  • v1.0.0: Production Readiness (Dedicated docs hub, Dashboard KPI widgets, S3 uploads)

🀝 Contributing & Community

We warmly welcome community contributions! Whether you're fixing a typo, building a new field widget, or refining UI components, every contribution counts.

  • 🐣 New to the project? Start with our curated Good First Issues.
  • πŸ“– Check out the full Contributing Guide for local development setup, codebase architecture, and PR steps.
  • πŸ’¬ Have questions or feature ideas? Join the discussion on GitHub Issues.

πŸ‘₯ Contributors

Huge thanks to everyone who has contributed code, documentation, and ideas to AdminGen!

AdminGen Contributors

Want to see your face here? Pick up a Good First Issue and submit a pull request!


πŸ’– Support AdminGen

If AdminGen saves you time building internal dashboards or you want to support continuous development:

  • ⭐ Star the repository to help other developers discover the project.
  • πŸ’¬ Share feedback or feature requests on GitHub Issues.
  • β˜• Sponsor on GitHub to support maintenance, hosting benchmarks, and new database adapters.

πŸ“œ License

MIT License Β© 2025 Sorvien Group LLC.

About

An instant, "headless" admin panel for modern JavaScript backends, built on ElysiaJS and Drizzle ORM.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages