Module 60: PostgreSQL

Lesson 2 of 5 · 15–25 minutes

Running PostgreSQL

🏠The everyday picture

You can visit a records office in town (a managed service), or set up a small one in your own house for practice (a local install).

📘What it really is

Three ways to get a PostgreSQL to practise on:

  1. Docker (the same everywhere; Level 6 teaches Docker fully):
docker run --name crm-db -e POSTGRES_PASSWORD=devpassword -p 5432:5432 -d postgres:17
  1. Installers: Postgres.app on Mac, the EDB installer on Windows, or your Linux package manager.
  2. A managed free tier (Supabase or Neon): nothing to install; you get a connection string.

  3. A connection string holds everything needed to connect: postgresql://user:password@host:5432/database It contains a password: keep it in .env as DATABASE_URL, never in code or Git.

  4. Managed services require TLS (encrypted connections); add ?sslmode=require if needed.

  5. One server holds several databases; each database has schemas (namespaces, public by default) holding tables.
  6. Create a database for your CRM: CREATE DATABASE crm;

🖱️Try it

Get PostgreSQL running by one of the three ways. Create a database called crm. Put the connection string in your API project's .env as DATABASE_URL and the variable name (with a placeholder) in .env.example.

✅Quick check

Where should the database connection string be kept?

Show the answer

In an environment variable (like DATABASE_URL in .env), never in code or Git, because it contains a password.

What's a schema in PostgreSQL?

Show the answer

A namespace inside a database that holds tables; public is the default.

← PreviousWhy PostgreSQL
ProLearners Assist