Full StackIntermediate

PERN App

PostgreSQL, Express, React, and Node.js — the modern evolution of the classic MERN stack, with PostgreSQL for better data consistency and relationships.

Overview

The PERN stack is a battle-tested combination for building fullstack web applications. A React frontend handles the UI, Express.js serves the REST API with JWT authentication, and PostgreSQL stores your data with full relational support. Everything runs on Node.js and deploys as three containers that Nexlayer wires together automatically.

ReactExpress.jsPostgreSQLNode.jsJWTREST API

What's Included

React Frontend

customizable

React app serving the Todo UI on port 80. Calls the Express backend API.

katieharris/pern-react-todo:latest

Express Backend

customizable

Express.js REST API on port 3000. Handles CRUD operations against PostgreSQL.

katieharris/pern-express-todo:latest

PostgreSQL

off-the-shelf

PostgreSQL database with persistent storage. Preconfigured for the Todo app schema.

katieharris/pern-postgres-todo:latest

How It Connects

1.

React serves the Todo UI at / on port 80 and makes API calls to the Express backend

2.

Express runs on port 3000, handles CRUD operations, and connects to PostgreSQL at postgres.pod:5432

3.

PostgreSQL stores Todo data with persistent 2Gi volume storage

Deploy on Nexlayer

Install the Nexlayer MCP:

npx @nexlayer/mcp-install

Then give your coding agent the YAML below and ask it to deploy:

Deploy this nexlayer.yaml to Nexlayer

Your agent will configure all three services, wire the database connection, and give you a live URL.

Deployment YAML

Save this as nexlayer.yaml in your project, or copy it directly to your agent:

nexlayer.yaml
application:
  name: PERN App
  pods:
    - name: postgres
      image: katieharris/pern-postgres-todo:latest
      vars:
        POSTGRES_USER: postgres
        POSTGRES_PASSWORD: passw0rd
        POSTGRES_DB: todo
        PGDATA: /var/lib/postgresql/data
      servicePorts:
        - 5432
      volumes:
        - name: pg-data-volume
          size: 2Gi
          mountPath: /var/lib/postgresql

    - name: express
      image: katieharris/pern-express-todo:latest
      vars:
        POSTGRES_HOST: postgres.pod
        POSTGRES_USERNAME: postgres
        POSTGRES_PASSWORD: passw0rd
        POSTGRES_DB: todo
      servicePorts:
        - 3000

    - name: react
      path: /
      image: katieharris/pern-react-todo:latest
      vars:
        EXPRESS_URL: http://express.pod:3000
      servicePorts:
        - 80

Make It Yours

Replace the react and express images with your own. Build your React app and Express API, push them to a container registry, and update the image references in the YAML.

The PostgreSQL pod includes persistent volume storage. Update the environment variables to change the database name, user, and password.

Remember to change the default passwords before deploying to production.