The Complete Intro to Postgres, as taught by Brian Holt for Frontend Masters

Overview

next-course-starter


A NextJS starter to get you started creating educational materials using Markdown

Get Started

  1. Set up Node.js v14+
  2. Clone this repo
  3. Run npm install
  4. Run npm run dev to start the dev server
  5. Open http://localhost:3000 in a browser

Configure Your Course

There are several things to configure before getting started.

course.json

This json file allows you to configure the details of the site. Update the info here and it'll update it everywhere throughout the course website.

  • author.name – Your name
  • author.company – The company you work at or whatever you want as your subtitle. Optional.
  • title – The title of your course
  • subtitle – The subtitle of your course. Optional.
  • frontendMastersLink – A link to the published video on FrontendMasters.com. Optional.
  • social.linkedin - Your LinkedIn public user name, just the name, not the full link. Optional
  • social.twitter – Your Twitter user name. Optional.
  • social.github – Your GitHub user name. Optional.
  • description – The description you want to show up in search engine results.
  • keywords – The SEO keywords for this course. An array of strings
  • productionBaseUrl – Typically useful for GitHub Pages. This adds a base path to your project. For GitHub Pages, this will be the name of your repo. For example, this site's base URL is /next-course-starter because the production URL for this site is btholt.github.io/next-course-starer. Do note this will also make your dev server's base URL this as well so you can catch problems before they go to production.
  • csvPath – A CSV with the meta data for your lessons will be created at this path when you build or export the project. If you delete this config option it will not generate a CSV.

styles/variables.css

Here is where you can theme your site. You can retheme the whole site with just these.

public/images

Here is where you should stick all your images. Inside of your markdown, refer to images in this folder as ./images/<image file name>.

Note this site doesn't use next/image because that requires the server component.

public/images/author.jpg

Your image. If you call it this, you won't have to change any code. If you need to change it, it's in pages/index.js.

public/images/social-share-cover.jpg

The image that will be used if someone shares your website to Twitter/Facebook/etc. If you call it this, you won't have to change any code. If you do need to change it, it's in pages/index.js

public/images/course-icon.png

The image at the top of the course. If you call it this, you won't have to change any code. If you do need to change it, it's in pages/index.js

Favicon

Just replace the favicon* files and the apple-touch-icon.png in the public/images directory. If you have a PNG, favicon.io will generate these files for you. If you don't want favicons, just remove the references to them in pages/_app.js.

Lessons

All your markdown lesson files will go in lessons/. They must be organized an named this way:

The folders must be named 01-section-one-name, 02-section-two-name, 03-section-three, etc.

The lessons are then grouped inside of these, the lessons are ordered by letters, A-lesson-one.md, B-lesson-two.md, C-lesson-three.md, etc. This numbering scheme matches how Frontend Masters organizes their content.

The titles of your lessons and sections are generated from the folder and lesson names (and can be overridden.) The first, organizing part of the name is stripped (the 01- part of 01-section-one and the A- part of A-lesson-one), the hyphens are turned into spaces (section-one becomes section one) and then those are run through title-case (so section one becomes Section One.) If you need to override these, use the frontmatter (explained below.)

The folder and lesson names are also used for the slugs. 02-section-two/C-lesson-three.md becomes yoursite.com/lessons/section-two/lesson-three.

Each of these lessons can have a frontmatter for the following properties

  • title – If you want the title to be different from the file name, you can specify here what that title should be. Frequently this useful for things where the capitalization would be off e.g. TailwindCSS instead of Tailwindcss. Optional.
  • description – If you want to give individual lessons descriptions for SEO and for Frontend Masters, you can write a brief description here.

Be aware because of how the numbers and letters are stripped out, it is possible to have ambigious paths. 01-welcome/A-intro.md and 03-welcome/D-intro.md would resolve to the same thing and only the first one would be visitable.

meta.json

Each section (e.g. inside of 03-section-three folder) folder can have a meta.json file, and is totally optional.

  • title – an override for the title of the section. Frequently useful for capitalization e.g. JS Tools instead of Js Tools.
  • icon – so you can set the icon used in the home page and the header. These icons are pulled from the free Font Awesome v5 icons. If you want fa-hammer, use "hammer" as the value for icon.

highlight.js Theme

The code blocks use Highlight.js. By default it will use a11y-light as the theme for the code blocks. Change the CSS import in pages/_app.js to the theme you want to use.

GitHub Pages / GitHub Actions

By default this repo works with GitHub Pages. Just make sure you set the productionBaseUrl in the course.json to the name of the repo.

It also includes a GitHub Action to automatically deploy to your gh-pages branch. Just make sure that your repo has GitHub Pages enabled and the branch is set to gh-pages. If you're not deploying to GitHub Pages go ahead and delete the .github directory.

By default the GitHub Action looks for a main branch, so be sure you're using that instead of master.

Example Sites

npm commands

  • npm run dev - Next's dev command. Start a local dev server. Note if you have a productionBasePath set in your course.json, your dev server will respect that (so you don't mess up your paths in production.)
  • npm run build - Build your site for production. This will still include the Next.js server run time. Use this if you're using something like Vercel to host your site.
  • npm run export - Builds your site statically, use this if you're going to deploy to GitHub Pages, S3, or somewhere else with no server. This will run next build and then next export (no need to run build yourself first.)
  • npm run start - Start an already-built server.
  • npm run csv – Will generate the CSV of the metadata from your course. Note you may have to run build first, depending on your csvPath.

Analytics

By default this doesn't generate any analytics. If you are creating a Frontend Masters course and would like a weekly report of analytics, contact me (Brian Holt) and I'll give you a snippet to drop on your page (though fair warning, I will also have access to your data, if that bothers you.)

Otherwise I'm pretty pleased with Simple Analytics (this is a referral link, free month for me and free month for you); I've been using them for my courses personally.

License

The code is this repo is licensed under the Apache 2.0 license.

I include the CC-BY-NC-4.0 license for the content; this is what I recommend you license your content under: anyone can use and share the content but they cannot sell it; only you can.

Comments
  • Can't start btholt/complete-intro-to-sql containerdocker

    Can't start btholt/complete-intro-to-sql containerdocker

    When I try to run docker run -e POSTGRES_PASSWORD=lol --name=sql -p 5432:5432 -d --rm btholt/complete-intro-to-sql I get WARNING: The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested e69219312f972c308fc979ae1227dd5562b77e5cc4045e96b923a381c02cfd09 and nothing happens.

    I looked around for solutions and one that seemed to do anything was adding a --platform linux/arm64/v8 option, which shuts up the warning message, but either way both docker ps -a and docker container ls -a do not display the btholt/complete-intro-to-sql container. I am running Ubuntu.

    opened by agentx3 4
  • [Bug] Need to re-insert recipes_photos data

    [Bug] Need to re-insert recipes_photos data

    In Joins and Constraints Project, it assumes you have data in recipes_photos when we don't anymore.

    We need to seed the data in:

    INSERT INTO recipes_photos
      (recipe_id, url)
    VALUES
      (1, 'cookies1.jpg'),
      (1, 'cookies2.jpg'),
      (1, 'cookies3.jpg'),
      (1, 'cookies4.jpg'),
      (1, 'cookies5.jpg'),
      (2, 'empanada1.jpg'),
      (2, 'empanada2.jpg'),
      (3, 'jollof1.jpg'),
      (4, 'shakshuka1.jpg'),
      (4, 'shakshuka2.jpg'),
      (4, 'shakshuka3.jpg'),
      (5, 'khachapuri1.jpg'),
      (5, 'khachapuri2.jpg');
    -- no pictures of xiao long bao
    

    Optionally, you can add this data in on the Foreign Keys page when we drop and re-create the tables.

    opened by K3ARN3Y 3
  • Failing saving PSQL session data after turning off computer

    Failing saving PSQL session data after turning off computer

    while running docker and psql session , every things runs perfect but after closing pc all the data in the PC is losed,? what am i doing wrong any directions from here?

    opened by Biki-das 2
  • Unable to run docker image `btholt/complete-intro-to-sql` on ubuntu

    Unable to run docker image `btholt/complete-intro-to-sql` on ubuntu

    docker run -e POSTGRES_PASSWORD=lol --name=sql -d -p 5432:5432 --rm btholt/complete-intro-to-sql
    WARNING: The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested
    f3ddec7dba8f190bf81ed6634f3f992c117d09ff9266869a3c02a30f2b657662
    
    opened by ramesh-km 1
  • [Bug] Missing videos?

    [Bug] Missing videos?

    Hi,

    I am watching the course replay. I think there is a missing video(s).

    Day 2 - Part 5 ends abruptly while talking about pgAmin. Day 2 - Part 6 picks up at GIN.

    Missing under Query Performance:

    Explain Indexes Create an Index

    Also, Day 2 Parts 8 and 9 should be swapped. Currently, Part 8 is the conclusion.

    opened by K3ARN3Y 1
  • [Bug] Update and Delete insert typo missing type

    [Bug] Update and Delete insert typo missing type

    In Updates and Deletes, you have the following code

    INSERT INTO ingredients
      (title, image)
    VALUES
      ('not real 1', 'delete.jpg'),
      ('not real 2', 'delete.jpg');
    

    This will cause an error: "ERROR: null value in column "type" of relation "ingredients" violates not-null constraint"

    In the previous lesson Tables, we altered the table to have type be NOT NULL.

    ALTER TABLE ingredients
    ADD COLUMN image VARCHAR ( 255 ),
    ADD COLUMN type VARCHAR ( 50 ) NOT NULL;
    

    I suggest to change it to:

    INSERT INTO ingredients
      (title, image, type)
    VALUES
      ('not real 1', 'delete.jpg', 'fake'),
      ('not real 2', 'delete.jpg', 'fake');
    
    opened by K3ARN3Y 1
  • [Bug] Missing query in Many-to-Many Relationships

    [Bug] Missing query in Many-to-Many Relationships

    In Many-to-Many Relationships, this query is missing at the end:

    SELECT
      i.title AS ingredient_title,
      i.image AS ingredient_image,
      i.type AS ingredient_type,
      r.title AS recipe_title,
      r.body AS recipe_body,
      r.recipe_id AS rid,
      i.id AS iid
    FROM
      recipe_ingredients ri
    INNER JOIN
      ingredients i
    ON
      i.id = ri.ingredient_id
    INNER JOIN
      recipes r
    ON
      r.recipe_id = ri.recipe_id;
    
    opened by K3ARN3Y 0
  • [Bug] Wrong id used in Relationships

    [Bug] Wrong id used in Relationships

    In Relationships, you have the code

    SELECT title, body FROM recipes WHERE id = 4;
    

    It should be

    SELECT title, body FROM recipes WHERE recipe_id = 4;
    

    Since this is the table

    CREATE TABLE recipes (
      recipe_id INTEGER PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
      title VARCHAR ( 255 ) UNIQUE NOT NULL,
      body TEXT
    );
    
    opened by K3ARN3Y 0
  • Fixing links to Workshop Page

    Fixing links to Workshop Page

    Updated/Fixed links so they point the workshop page. Once course is released, workshop pages will redirect to the course page so these won't have to be updated again.

    opened by dtauer 0
  • recipeguru database not appearing in btholt/complete-intro-to-sql docker image even after pulling latest

    recipeguru database not appearing in btholt/complete-intro-to-sql docker image even after pulling latest

    Hello, I also checked my image sha against the one you showed here, and it matches, but I do not see the recipeguru database still. I do get the amd64 warning, but I don't think that would be a factor.

    $ docker pull btholt/complete-intro-to-sql:latest
    latest: Pulling from btholt/complete-intro-to-sql
    Digest: sha256:86f9d1e155bf35b82abe2a14b56e0141644d1660d391e6d97cc58a8db6f30950
    Status: Image is up to date for btholt/complete-intro-to-sql:latest
    docker.io/btholt/complete-intro-to-sql:latest
    
    $ docker run -e POSTGRES_PASSWORD=lol --name=sql -p:5432:5432 -d --rm btholt/complete-intro-to-sql
    WARNING: The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested
    a49337a8b95055511edc290c395c88c5345724a9242902461f0b909c59ef5ab6
    
    $ docker exec -u postgres -it sql psql
    psql (14.4 (Debian 14.4-1.pgdg110+1))
    Type "help" for help.
    
    postgres=# \l
                                     List of databases
       Name    |  Owner   | Encoding |  Collate   |   Ctype    |   Access privileges
    -----------+----------+----------+------------+------------+-----------------------
     omdb      | postgres | UTF8     | en_US.utf8 | en_US.utf8 |
     postgres  | postgres | UTF8     | en_US.utf8 | en_US.utf8 |
     template0 | postgres | UTF8     | en_US.utf8 | en_US.utf8 | =c/postgres          +
               |          |          |            |            | postgres=CTc/postgres
     template1 | postgres | UTF8     | en_US.utf8 | en_US.utf8 | =c/postgres          +
               |          |          |            |            | postgres=CTc/postgres
    (4 rows)
    

    I think I can just run your recipes.sql file as a workaround, but I am filing a bug here in case this is an issue for other people..

    opened by ashoofly 2
Owner
Brian Holt
dev tools pm @stripe; formerly at @microsoft, @Netflix, @linkedin, and @reddit; teacher on @FrontendMasters
Brian Holt
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Application for self-testing before exams covering some of the subject taught at the Prague University of Economics and Business

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: ya

Jiří Vrba 2 Jun 13, 2022
A complete template for 2022 focused on around React, Postgres and various web3 integrations.

A complete template for 2022 focused on around React, Postgres and various web3 integrations. You can use the template to make a website, a web application, a hybrid decentralized web application, or even a DAO.

jim 45 Dec 22, 2022
Portfolio for Intro to Photography/Digital Media Production

This is a Next.js project bootstrapped with create-next-app. Getting Started First, run the development server: npm run dev # or yarn dev Open http://

Benjamin Smith 4 May 26, 2022
A Telegram bot which generates your intro video programmatically 📽️

Features ?? Generate videos programmatically from telegram input High performance High quality videos Installation ?? Installation is pretty easy, cli

Tuhin Kanti Pal 14 Sep 6, 2022
O objetivo dessa aplicação era criar um frontend feito totalmente em Javascript, sem nenhum arquivo HTML ou CSS pré-criado. Além disso, esse projeto também é o frontend da minha API 100% NodeJS.

Projeto HTML 100% Javascript Front-end feito "sem HTML" Conteúdos ➜ Sobre o projeto ➜ O que aprendi ➜ Como usar ?? Sobre o projeto Voltar ao topo O ob

João Victor Negreiros 19 Aug 3, 2021
My-portfolio - Built with Namecheap, Digital Ocean, Nginx, PM2, SSL, NextJs, Tailwind 3, Graphql, NexusJS, Prisma, Postgres, Passion and Love

Current Implementation technologies Nextjs with Typescript. Static pages/ Server side rendering. Easy peasy state management (Might not need it with i

Samrood Ali 1 Jan 10, 2022
A Turborepo with Strapi v4 (w/ postgres database) + Next.js powered by docker and docker-compose

Turborepo + Strapi + Next.js + Docker A Turborepo with Strapi v4 (w/ postgres database) + Next.js powered by docker and docker-compose. ⚠️ Prerequisit

Elvin Chu 60 Dec 29, 2022
Using Htmx, ASP.NET Core, and Marten (postgres document db) to sort list

Using Htmx, ASP.NET Core, and Marten (postgres document db) to sort list

Khalid Abuhakmeh 5 Feb 16, 2022
Simple "everyday CRUD" Postgres queries with perfect TypeScript types

Crudely Typed Simple "everyday CRUD" Postgres queries with perfect TypeScript types. Zero dependencies. Designed to work with pg-to-ts and node-postgr

Dan Vanderkam 26 Dec 26, 2022
Postgres.js - The Fastest full featured PostgreSQL client for Node.js and Deno

?? Fastest full-featured node & deno client ?? ES6 Tagged Template Strings at the core ??‍♀️ Simple surface API ??️ Dynamic query support ?? Chat and

Rasmus Porsager 4.3k Jan 1, 2023
Connect to a Postgres database from a Cloudflare Worker, using Cloudflare Tunnel

Cloudflare Workers Postgres Client This is an experimental module. Heavily based on cloudflare/worker-template-postgres, but cleaned up and bundled in

BubblyDoo 17 Dec 22, 2022
Wraps postgres API in a pg compatible API.

postgres/pg compatibility layer Wraps postgres API in a pg compatible API.

Gajus Kuizinas 18 Oct 16, 2022
Integration with https://neon.tech Serverless Postgres

README Welcome to RedwoodJS! Prerequisites Redwood requires Node.js (>=14.19.x <=16.x) and Yarn (>=1.15) Are you on Windows? For best results, follow

RedwoodJS 3 Sep 16, 2022
🐘 instantly stand up full Postgres databases in your AVA tests

ava-postgres ava-postgres is a test fixture for AVA that provides you with nearly-instant access to a fresh Postgres database for every test. Installa

Seam 2 Dec 22, 2022
Ferramenta desenvolvida para migrar dados de um banco de dados Sqlite para Postgres.

Sqlite to Postgres Migration Ferramenta desenvolvida para migrar dados de um banco de dados Sqlite para Postgres. Atualmente você pode: Pegar os dados

Tulio Calil 5 Dec 15, 2022
RepoProvas API, a system for sharing tests between students, built with Typescript, Node.js, Express, Prisma and Postgres.

Repoprovas Built With ?? Description RepoProvas API, a system for sharing tests between students, built with Typescript, Node.js, Express, Prisma and

Lucas Lima 3 Dec 13, 2022