An Express 5 CRUD API starter for Node.js 22 in plain JavaScript that stores one resource, items, in PostgreSQL through node-postgres and a connection pool. It is for developers who want a tested create, read, update and delete service to rename, with input validation, limit and offset paging, JSON errors and a /health check that queries the database.
by Light CloudCRUD APIs
createApp(pool) in src/app.js builds the app without listening, and src/server.js creates the items table before it starts the server, so a broken database connection fails the deploy rather than the first request. Express 5 sends errors thrown in async handlers to the JSON error handler, which is why the routes have no try/catch. The SQL is a handful of parameterised queries in src/routes/items.js, and express and pg are the only runtime dependencies. Renaming items to your own resource starts in src/db.js, src/lib/validation.js and that routes file. On Light Cloud the deploy runs npm start with DATABASE_URL set, and every push to your copy redeploys.
Press Deploy on this template: Light Cloud copies the repo into your GitHub account, creates a PostgreSQL database and sets DATABASE_URL on the app, with no secrets to fill in. Databases need a paid plan.
Start PostgreSQL in Docker with docker run -d -p 5432:5432 -e POSTGRES_PASSWORD=postgres postgres:16, export DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres and run npm run dev. Leave sslmode out of the URL, since the local container has no TLS.
Add it to the CREATE TABLE in src/db.js, to parseItem in src/lib/validation.js and to the queries in src/routes/items.js. CREATE TABLE IF NOT EXISTS does not change a table that already exists, so run an ALTER TABLE once on an existing database.
No. It uses node-postgres with a few parameterised SQL queries, which keeps the runtime dependencies to express and pg. You can add Prisma, Drizzle or Knex later without changing the shape of the routes.
Yes. It has no Light Cloud code: any host with Node.js 22 and a reachable PostgreSQL runs it with npm install --omit=dev and npm start, given DATABASE_URL and PORT.
Start a Node.js REST API with Express, CORS, JSON errors and tests already wired up
Start a Hono CRUD API on PostgreSQL with postgres.js, validation and tests set up

Start a typed NestJS CRUD API on PostgreSQL with DTO validation and Swagger docs