Express Jwt Postgres Api logo

Express Jwt Postgres Api

Community
andersonamaral2
express-jwt-postgres-api

Builds a production-style Express.js REST API with JWT authentication, PostgreSQL, layered middleware, and Docker Compose for local development. Use when the user asks to scaffold a secure Node.js/Express API with login, protected routes, and a relational database.

Overview

Publisherandersonamaral2
RepositoryClaude-Code-to-Deep-Agents-Skills-Converter
Skill nameexpress-jwt-postgres-api
Stars
58
Forks
8
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by andersonamaral2 on GitHub. Read the source before you install it.

Installation

Install the Express Jwt Postgres Api AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/andersonamaral2/Claude-Code-to-Deep-Agents-Skills-Converter/tree/main/examples/deep-agents-output-3
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/andersonamaral2/Claude-Code-to-Deep-Agents-Skills-Converter.git /tmp/Claude-Code-to-Deep-Agents-Skills-Converter
mkdir -p .claude/skills
cp -r /tmp/Claude-Code-to-Deep-Agents-Skills-Converter/examples/deep-agents-output-3 .claude/skills/express-jwt-postgres-api
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Express Jwt Postgres Api in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Express Jwt Postgres Api on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Express Jwt Postgres Api is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Skill: Express.js JWT API with PostgreSQL and Docker

Builds a production-style Express.js REST API with JWT authentication, a PostgreSQL database, layered middleware, and Docker Compose for local development.

Execution Context

This skill runs inside Deep Agents CLI (v0.0.34+). Available tools:

ToolUsage in this skill
write_todosPlan the build steps
executeRun npm, docker, curl, and inline tests
write_fileCreate source files, SQL, compose, and .env
edit_fileAdjust files if a test reveals an issue

Critical execution rules:

  1. Always start by creating the plan via write_todos.
  2. Create files one by one via write_file — never generate everything at once.
  3. Test each module via execute immediately after creating it.
  4. Verify required environment variables before starting the server.

Execution Plan (use with write_todos)

  • 1. Check prerequisites (Node.js 18+, npm, Docker, Docker Compose)
  • 2. Verify environment variables (JWT_SECRET, DATABASE_URL, PORT)
  • 3. Initialize project and install dependencies
  • 4. Create src/db.js (PostgreSQL pool)
  • 5. Create middleware (auth.js, logger.js)
  • 6. Create routes (auth.js, notes.js)
  • 7. Create src/index.js entry point
  • 8. Create db/init.sql and docker-compose.yml
  • 9. Create .env, start the database, run the API
  • 10. Test the full register → login → create-note flow

Prerequisites Check

Use execute to verify the toolchain:

bash
node --version    # requires 18+
npm --version
docker --version
docker compose version

Environment Setup

Verify required environment variables via execute:

bash
for var in JWT_SECRET DATABASE_URL; do
  if [ -z "${!var}" ]; then
    echo "WARNING: $var not set — will fall back to .env defaults"
  fi
done
echo "Environment check done"

Security note: Never hardcode production secrets. The .env below uses placeholders; keep it out of version control via .gitignore.

Implementation

Initialize the project via execute:

bash
npm init -y

Install dependencies via execute:

bash
npm install express jsonwebtoken bcrypt pg dotenv
npm install --save-dev nodemon

Use write_file to create src/db.js:

javascript
const { Pool } = require('pg');

const pool = new Pool({ connectionString: process.env.DATABASE_URL });

module.exports = { pool };

Test via execute:

bash
node -e "require('./src/db.js'); console.log('OK: db module loads')"

Use write_file to create src/middleware/auth.js:

javascript
const jwt = require('jsonwebtoken');

function authRequired(req, res, next) {
  const header = req.headers.authorization || '';
  const token = header.startsWith('Bearer ') ? header.slice(7) : null;
  if (!token) return res.status(401).json({ error: 'missing token' });
  try {
    req.user = jwt.verify(token, process.env.JWT_SECRET);
    next();
  } catch {
    return res.status(401).json({ error: 'invalid token' });
  }
}

module.exports = { authRequired };

Use write_file to create src/middleware/logger.js:

javascript
module.exports = function logger(req, res, next) {
  console.log(`${new Date().toISOString()} ${req.method} ${req.path}`);
  next();
};

Test the middleware via execute:

bash
node -e "require('./src/middleware/auth.js'); require('./src/middleware/logger.js'); console.log('OK: middleware loads')"

Use write_file to create src/routes/auth.js with POST /auth/register (bcrypt-hash the password and insert the user) and POST /auth/login (verify the password and return a signed JWT).

Use write_file to create src/routes/notes.js with CRUD endpoints (GET/POST/PUT/DELETE /notes) guarded by the authRequired middleware and scoped to req.user.id.

Test the routers via execute:

bash
node -e "require('./src/routes/auth.js'); require('./src/routes/notes.js'); console.log('OK: routers load')"

Use write_file to create src/index.js:

javascript
require('dotenv').config();
const express = require('express');
const logger = require('./middleware/logger');
const authRouter = require('./routes/auth');
const notesRouter = require('./routes/notes');

const app = express();
app.use(express.json());
app.use(logger);
app.use('/auth', authRouter);
app.use('/notes', notesRouter);

const port = process.env.PORT || 3000;
app.listen(port, () => console.log(`API listening on ${port}`));

Use write_file to create db/init.sql:

sql
CREATE TABLE IF NOT EXISTS users (
  id SERIAL PRIMARY KEY,
  email TEXT UNIQUE NOT NULL,
  password_hash TEXT NOT NULL
);

CREATE TABLE IF NOT EXISTS notes (
  id SERIAL PRIMARY KEY,
  user_id INTEGER REFERENCES users(id),
  body TEXT NOT NULL
);

Use write_file to create docker-compose.yml:

yaml
version: "3.8"
services:
  db:
    image: postgres:16
    environment:
      POSTGRES_USER: api
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
      POSTGRES_DB: api
    ports:
      - "5432:5432"
    volumes:
      - ./db/init.sql:/docker-entrypoint-initdb.d/init.sql
      - pgdata:/var/lib/postgresql/data

volumes:
  pgdata:

Use write_file to create .env:

PORT=3000
JWT_SECRET=change-me-in-production
DATABASE_URL=postgresql://api:change-me@localhost:5432/api
POSTGRES_PASSWORD=change-me

Security note: These are placeholder secrets. Replace them with real values from your secret manager before deploying, and add .env to .gitignore.

Start the database via execute:

bash
docker compose up -d

Add a dev script and run the API via execute:

bash
npm pkg set scripts.dev="nodemon src/index.js"
npm run dev &
sleep 3

Test the full flow via execute:

bash
curl -s -X POST http://localhost:3000/auth/register \
  -H "Content-Type: application/json" \
  -d '{"email":"a@b.com","password":"secret123"}'

TOKEN=$(curl -s -X POST http://localhost:3000/auth/login \
  -H "Content-Type: application/json" \
  -d '{"email":"a@b.com","password":"secret123"}' \
  | python3 -c "import sys,json;print(json.load(sys.stdin)['token'])")

curl -s -X POST http://localhost:3000/notes \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"body":"hello"}'

Document the project architecture and conventions in AGENTS.md at the root (the Deep Agents equivalent of a project memory file).

Usage with Deep Agents CLI

Mode 1 — Build (one-shot)

bash
deepagents -y "Scaffold an Express JWT API with PostgreSQL following the express-jwt-postgres-api skill"

Mode 2 — Interactive

bash
deepagents
> Build me a secure Express REST API with JWT auth and a Postgres database

Mode 3 — Non-interactive (CI/CD)

bash
deepagents -n -y -S "npm,node,docker" "Generate the Express JWT API scaffold in ./api"

Troubleshooting

Node.js not found

bash
node --version
# Install via nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
nvm install 18

Database connection refused

bash
# Is the container up and healthy?
docker compose ps
docker compose logs db | tail -20
# Confirm DATABASE_URL host/port match docker-compose.yml (localhost:5432)

JWT verify fails on protected routes

bash
# JWT_SECRET must be identical at sign time (login) and verify time (auth middleware).
echo "JWT_SECRET is ${JWT_SECRET:+set}"
# Re-issue a token after confirming the secret is exported, then retry the request.

Port 3000 already in use

bash
lsof -i :3000
# Kill the process or change PORT in .env

Context window overflow

Use /compact before continuing, or split route generation into `task` sub-agents.

Frequently asked questions

What does the Express Jwt Postgres Api AI skill do?

Builds a production-style Express.js REST API with JWT authentication, PostgreSQL, layered middleware, and Docker Compose for local development. Use when the user asks to scaffold a secure Node.js/Express API with login, protected routes, and a relational database.

Why use Express Jwt Postgres Api on TypingMind?

Because you install it once and use it with any model. Express Jwt Postgres Api is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Express Jwt Postgres Api in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/andersonamaral2/Claude-Code-to-Deep-Agents-Skills-Converter/tree/main/examples/deep-agents-output-3. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Express Jwt Postgres Api?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Express Jwt Postgres Api?

As many as you like. As long as a model supports skills, you can use Express Jwt Postgres Api with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Express Jwt Postgres Api AI skill free?

Yes. It is published on GitHub by andersonamaral2 under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇