{"id":18614871,"url":"https://github.com/andrewjbateman/pern-stack-auth","last_synced_at":"2025-04-11T00:30:59.599Z","repository":{"id":40378627,"uuid":"186683295","full_name":"AndrewJBateman/pern-stack-auth","owner":"AndrewJBateman","description":":clipboard: Repair. PERN stack todo app with jwt user authentication ","archived":false,"fork":false,"pushed_at":"2023-03-06T04:29:28.000Z","size":8501,"stargazers_count":55,"open_issues_count":9,"forks_count":25,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-25T06:51:13.000Z","etag":null,"topics":["backend","frontend","jwt-authentication","pern","pern-stack","postgresql-database","postman","postman-api","react","repair","stack"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AndrewJBateman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-14T19:03:39.000Z","updated_at":"2025-01-24T21:27:53.000Z","dependencies_parsed_at":"2023-02-06T16:31:09.206Z","dependency_job_id":null,"html_url":"https://github.com/AndrewJBateman/pern-stack-auth","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fpern-stack-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fpern-stack-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fpern-stack-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fpern-stack-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndrewJBateman","download_url":"https://codeload.github.com/AndrewJBateman/pern-stack-auth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248322233,"owners_count":21084333,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend","frontend","jwt-authentication","pern","pern-stack","postgresql-database","postman","postman-api","react","repair","stack"],"created_at":"2024-11-07T03:27:16.053Z","updated_at":"2025-04-11T00:30:56.055Z","avatar_url":"https://github.com/AndrewJBateman.png","language":"JavaScript","readme":"# :zap: PERN Full Stack Todo\n\n* PostgreSQL Express React Node (PERN) full-stack app, integrates React frontend with Node.js backend. Tutorial code from [The Stoic Programmers](https://www.youtube.com/channel/UCAPuqvFWmUg_gc_AZHUBPsA) (see 'Inspiration' below)\n* **Note:** to open web links in a new window use: _ctrl+click on link_\n\n![GitHub repo size](https://img.shields.io/github/repo-size/AndrewJBateman/pern-stack-auth?style=plastic)\n![GitHub pull requests](https://img.shields.io/github/issues-pr/AndrewJBateman/pern-stack-auth?style=plastic)\n![GitHub Repo stars](https://img.shields.io/github/stars/AndrewJBateman/pern-stack-auth?style=plastic)\n![GitHub last commit](https://img.shields.io/github/last-commit/AndrewJBateman/pern-stack-auth?style=plastic)\n\n## :page_facing_up: Table of contents\n\n* [:zap: PERN Stack Auth](#zap-pern-stack-auth)\n  * [:page_facing_up: Table of contents](#page_facing_up-table-of-contents)\n  * [:books: General info](#books-general-info)\n  * [:camera: Screenshots](#camera-screenshots)\n  * [:signal_strength: Technologies](#signal_strength-technologies)\n  * [:floppy_disk: Setup](#floppy_disk-setup)\n  * [:wrench: Testing](#wrench-testing)\n  * [:computer: Code Examples](#computer-code-examples)\n  * [:cool: Features](#cool-features)\n  * [:clipboard: Status, Testing \u0026 To-Do List](#clipboard-status-testing--to-do-list)\n  * [:clap: Inspiration](#clap-inspiration)\n  * [:file_folder: License](#file_folder-license)\n  * [:envelope: Contact](#envelope-contact)\n\n## :books: General info\n\n### Backend\n\n* PostgreSQL needs to be installed and running - I started it from my Windows 10 PostgreSQL 12 dropdown option 'SQL shell (psql)'\n* Postman used to test the backend before frontend was available\n\n### Frontend\n\n* React frontend includes a simple todo list with a user input field and a table of todos below. User can edit and delete todos.\n* [JavaScript XML (JSX)](https://reactjs.org/docs/introducing-jsx.html) used to write HTML elements in Javascript\n* [React Fragments](https://reactjs.org/docs/fragments.html) used to show table of todos as a row with columns in the DOM\n\n## :camera: Screenshots\n\n![Backend screenshot](./img/postgresql.png)\n![Frontend \u0026 backend screenshot](./img/todos.png)\n![Frontend screenshot](./img/edit.png)\n\n## :signal_strength: Technologies - Backend\n\n* [PostgreSQL v14](https://www.postgresql.org/)\n* [PostgreSQL Installer for Windows](https://www.postgresqltutorial.com/install-postgresql/)\n* [Express.js middleware v4](https://expressjs.com/)\n* [Node.js v16](https://nodejs.org/es/)\n* [Nodemon v2](https://www.npmjs.com/package/nodemon) npm module so backend server will automatically restart after code changes\n* [Postman API](https://www.postman.com/downloads/) to simulate a frontend\n\n## :signal_strength: Technologies - Frontend\n\n* [React framework v16](https://reactjs.org/)\n* [Bootstrap v4](https://getbootstrap.com/) component library\n\n## :floppy_disk: Setup - Backend\n\n* Change to `/server` directory\n* Install dependencies using `npm i`\n* Install [nodemon](https://www.npmjs.com/package/nodemon) globally if you don't already have it\n* Install [PostgreSQL](https://www.postgresql.org/) \u0026 run it (requires the password you created during installation)\n* Add database access credentials to `db.js` - recommend installing [npm dotenv](https://www.npmjs.com/package/dotenv) \u0026 using .env to hide credentials if commiting to Github\n* Postgresql shell commands: `\\l` list all databases. `\\c` database1 connect to database1. `\\dt` inspect tables. `\\d+` inspect table \u0026 show relation information. `\\q` to quit.\n* Run `nodemon server` for a dev server\n* `http://localhost:5000/` can be accessed for CRUD operations such as POST, GET, PUT, DELETE etc. using Postman\n\n## :floppy_disk: Setup - Frontend\n\n* Change to `/client` directory\n* Install dependencies using `npm i`.\n* run `npm start`. Frontend will open at `http://localhost:3000/`\n\n## :computer: Code Examples - Backend\n\n* backend `index.js`: express post method used to add new todo [description] to postgreSQL database using SQL INSERT INTO statement\n\n```javascript\n// create a todo\napp.post('/todos', async (req, res) =\u003e {\n  try {\n    const { description } = req.body;\n    const newTodo = await pool.query(\n      \"INSERT INTO todo (description) VALUES($1) RETURNING *\",\n      [description]\n    );\n\n    res.json(newTodo.rows[0]);\n  } catch (err) {\n    console.error(err.message);\n  }\n})\n```\n\n## :computer: Code Examples - Frontend\n\n* function that runs when user presses 'Add' button: the input body (description) is converted from a JavaScript object to a JSON string \u0026 POSTed to the todo database\n\n```javascript\n  const onSubmitForm = async e =\u003e {\n    e.preventDefault();\n    try {\n      const body = { description };\n      const response = await fetch(\"http://localhost:5000/todos\", {\n        method: \"POST\",\n        headers: { \"Content-Type\": \"application/json\" },\n        body: JSON.stringify(body)\n      });\n\n      console.log(\"Successfully added todo: \", response);\n      window.location = \"/\";\n    } catch (err) {\n      console.error(err.message);\n    }\n  };\n```\n\n## :cool: Features - Backend\n\n* All data stored in PostgreSQL database that can also be viewed and changed from the PostgreSQL shell (psql)\n\n## :cool: Features - Frontend\n\n* React app created from the command prompt using [Create React App](https://reactjs.org/docs/create-a-new-react-app.html)\n* Uses the [Bootstrap basic table](https://www.w3schools.com/bootstrap/bootstrap_tables.asp) to list todos\n* [Bootstrap 4 Modal](https://www.w3schools.com/bootstrap4/bootstrap_modal.asp) dialog box\n\n## :clipboard: Status \u0026 To-Do List\n\n* Status: Error in registration\n* To-Do: Fix errors and complete testing\n\n## :clap: :wrench: Inspiration/General Tools\n\n* [PERN Stack Course - PostgreSQL, Express, React and Node](https://www.youtube.com/watch?v=ldYcgPKEZC8\u0026t=116s)\n* [Youtube video: Learn Database Design by combining our JWT and PERN stack Todo List app together Part 1](https://www.youtube.com/watch?v=l3njf_tU8us)\n* [Youtube video: Learn Database Design by combining our JWT and PERN stack Todo List app together, part 2](https://www.youtube.com/watch?v=25kouonvUbg)\n* [Youtube video: How to Deploy a PERN application on Heroku](https://www.youtube.com/watch?v=ZJxUOOND5_A)\n* [React documentation](https://reactjs.org/docs/getting-started.html)\n* [Enable Emmet support for JSX in Visual Studio Code | React](https://medium.com/@eshwaren/enable-emmet-support-for-jsx-in-visual-studio-code-react-f1f5dfe8809c)\n* [js-beautify for VS Code](https://marketplace.visualstudio.com/items?itemName=HookyQR.beautify)\n\n## :file_folder: License\n\n* N/A\n\n## :envelope: Contact\n\n* Repo created by [ABateman](https://github.com/AndrewJBateman), email: gomezbateman@yahoo.com\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewjbateman%2Fpern-stack-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewjbateman%2Fpern-stack-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewjbateman%2Fpern-stack-auth/lists"}