Express.js backend generator: schema to REST API

Auxen, by Auxen Prime, generates a Express.js (TypeScript or JavaScript) backend from your database schema or a plain-English description. The output is an ordinary Express.js project that you download and own. It covers TypeScript (Express.js) and JavaScript (Express.js). Install with npm and start it with node.

What you get

The table is read from a real generated project (91 files for the example schema). The last column is the file in that project.

AreaWhat is generatedWhere in the project
REST APICreate, read, update and delete endpoints for each entity, under /api/<entity>src/controllers/customerController.ts
AuthenticationRegistration and login with JWT in this example. The builder also offers OAuth2, Session, API Key, Basic Auth and OpenID Connect.src/controllers/authController.ts
RBACRole and permission tables, and a permission check on the protected routessrc/middleware/rbac.ts
MigrationsAn initial migration for the schemasrc/migrations/index.ts, migrations/V1__initial_schema.sql
Tests2 test files in the example (unit and integration)src/__tests__/integration/api.integration.test.ts
DockerfileBuilds the image and runs the app as a non-root user (uid 10001)Dockerfile
docker-composeRuns the app with a PostgreSQL database beside itdocker-compose.yml
CI pipelineA GitHub Actions workflow, when you choose it.github/workflows/ci.yml
API descriptionAn OpenAPI description of the APIsrc/config/swagger.ts
Health checkA health endpointsrc/app.ts
ConfigurationAn .env.example listing the settings.env.example

The example it was generated from

Entities Customer and Invoice, with Invoice many-to-one Customer, on PostgreSQL, JWT with RBAC. Options: unit tests, integration tests, Docker, GitHub Actions pipeline and migrations. Auxen adds the authentication tables (users, roles, permissions, sessions and others) around them.

Folder layout, with file counts
.github/workflows/  1 file
docs/  2 files
migrations/  1 file
src/  77 files
src/__tests__/  2 files
src/config/  3 files
src/controllers/  8 files
src/errors/  1 file
src/middleware/  5 files
src/migrations/  1 file
src/models/  14 files
src/queries/  13 files
src/routes/  8 files
src/seeds/  1 file
src/services/  2 files
src/types/  1 file
src/utils/  4 files
src/validators/  13 files
(project root)  10 files

Real excerpts

A generated controller src/controllers/customerController.ts
export const getAll = async (req: Request<{}, {}, {}, PaginationQuery>, res: Response, next: NextFunction): Promise<void> => {
  try {
    const page = Math.max(1, parseInt(req.query.page || '1', 10));
    const limit = Math.min(100, Math.max(1, parseInt(req.query.limit || '10', 10)));
    const requestedSortBy = req.query.sortBy || 'customerId';
    // Whitelist sortBy to prevent column injection / exposing unindexed/sensitive fields
    const sortBy = SORTABLE_FIELDS.has(requestedSortBy) ? requestedSortBy : 'customerId';
    const sortOrder = req.query.sortOrder?.toUpperCase() === 'DESC' ? 'DESC' : 'ASC';

    const offset = (page - 1) * limit;

    // TODO: Add authorization scoping here (e.g., filter by owner/tenant)
    // Example: where: { ownerId: req.user?.id }
The RBAC check src/middleware/rbac.ts
export const requirePermission = (resource: string, action: string) => {
  return (req: AuthRequest, res: Response, next: NextFunction): void => {
    try {
      const user = req.user;

      if (!user) {
        res.status(401).json({ error: 'Authentication required' });
        return;
      }

      const requiredPermission = `${resource}:${action}`;
      const hasPermission = user.permissions?.includes(requiredPermission);
The first migration, for Customer migrations/V1__initial_schema.sql
CREATE TABLE IF NOT EXISTS "customer" (
    "customer_id" UUID PRIMARY KEY DEFAULT gen_random_uuid(),
    "customer_name" VARCHAR(255) NOT NULL,
    "customer_email" VARCHAR(255) UNIQUE NOT NULL,
    "customer_birthday" DATE,
    "customer_active" BOOLEAN NOT NULL,
    "customer_gender" VARCHAR(255) NOT NULL,
    "customer_notes" TEXT,
    "customer_created_at" TIMESTAMP NOT NULL
);
The Dockerfile Dockerfile
FROM node:22-alpine AS build
WORKDIR /app
COPY package*.json .npmrc* ./
RUN npm install
COPY . .
RUN npm run build

FROM node:22-alpine
WORKDIR /app
# Production mode: errors don't show internals, and TypeORM applies its
# migrations at start. Without SMTP, signup still works and the app warns
# that it can't send email.
ENV NODE_ENV=production
COPY package*.json .npmrc* ./
# The app runs with plain node: npm, npx, corepack and yarn are removed from
# the image, so their bundled dependencies carry no vulnerabilities into it.
A generated test src/__tests__/integration/api.integration.test.ts
describe('API integration: Customer CRUD', () => {
  let token: string;
  let createdId: string;

  beforeAll(async () => {
    await (app as any).ready;   // schema synced + permissions seeded
    const email = `test-${Date.now()}@example.com`;
    await request(app).post('/api/auth/signup')
      .send({ userEmail: email, userPassword: 'Passw0rd!', userFirstName: 'Test', userLastName: 'User' });
    const login = await request(app).post('/api/auth/login')
      .send({ userEmail: email, userPassword: 'Passw0rd!' });
    token = login.body.accessToken || login.body.token;

What it is built on

Read from the generated manifest: Express (package.json), Sequelize (package.json), express-validator (package.json), jsonwebtoken (package.json), Swagger UI (package.json), Jest (package.json).

The page shows TypeScript. The JavaScript variant has the same layout in .js files: for example its controller is src/controllers/customerController.js, and the example project has 89 files.

Databases

Express.js generates for PostgreSQL, MySQL, MariaDB, SQLite, SQL Server, Oracle, MongoDB and Amazon Redshift.

The data layer is written with Sequelize, TypeORM and Mongoose: Sequelize is the default, TypeORM covers the same SQL databases, and Mongoose is used for MongoDB. MongoDB is generated for FastAPI and Express.js only.

How the generator is tested

These checks live in the Auxen repository and run against the generators themselves. They are listed here as what they do, not as a guarantee about every schema you might write.

  • Generation test (npm run test:gen): generates this stack for several example schemas, then checks the syntax of the result with the TypeScript compiler and Node.js.
  • Runtime test (npm run test:runtime): starts the generated application, connects it to a real database, registers a user, logs in, then creates and lists records over HTTP.
  • Security scan: the generated project, including its Dockerfile and CI files, is scanned with Trivy for vulnerabilities, secrets and misconfiguration. The check fails on any secret, and on any high or critical finding that has a fix.
  • Docker build test (npm run test:docker, run on demand): builds each stack's own Dockerfile.

Running and deploying it

Install with npm and start it with node. You download the project and deploy it wherever you run software. Auxen does not deploy the generated backend for you yet. It has a hosted sandbox where you can run the code and try its API before you download it.

Review the code before it carries real traffic, as you would any code you did not write. The terms of service say the same: generated code is provided as is, and you are responsible for reviewing, testing and securing it.

More

Auxen is made by Auxen Prime Technologies Limited and lives at auxenprime.com. It is not affiliated with other companies that use the name Auxen.