{"id":18614859,"url":"https://github.com/andrewjbateman/pern-stack-database","last_synced_at":"2025-09-20T23:33:42.816Z","repository":{"id":39186869,"uuid":"249371486","full_name":"AndrewJBateman/pern-stack-database","owner":"AndrewJBateman","description":":clipboard: Full stack app using PostgreSQL, Express, React \u0026 Node.js. Tutorial app","archived":false,"fork":false,"pushed_at":"2023-01-06T02:35:28.000Z","size":4389,"stargazers_count":3,"open_issues_count":23,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T06:51:13.563Z","etag":null,"topics":["concurrent-processes","css3","express","nodejs","nodemon","pern-stack","postgresql-database","react"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","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":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-23T08:12:14.000Z","updated_at":"2023-05-02T21:09:15.000Z","dependencies_parsed_at":"2023-02-05T03:15:54.760Z","dependency_job_id":null,"html_url":"https://github.com/AndrewJBateman/pern-stack-database","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-database","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fpern-stack-database/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fpern-stack-database/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fpern-stack-database/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndrewJBateman","download_url":"https://codeload.github.com/AndrewJBateman/pern-stack-database/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":["concurrent-processes","css3","express","nodejs","nodemon","pern-stack","postgresql-database","react"],"created_at":"2024-11-07T03:27:14.606Z","updated_at":"2025-09-20T23:33:42.729Z","avatar_url":"https://github.com/AndrewJBateman.png","language":"JavaScript","readme":"# :zap: PERN Full Stack Database\n\n* PostgreSQL Express React Node (PERN) full-stack app, integrates React frontend with Node.js backend.\n* Currently shows weather data from [OpenWeather API](https://openweathermap.org/api). Tutorial code (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-database?style=plastic)\n![GitHub pull requests](https://img.shields.io/github/issues-pr/AndrewJBateman/pern-stack-database?style=plastic)\n![GitHub Repo stars](https://img.shields.io/github/stars/AndrewJBateman/pern-stack-database?style=plastic)\n![GitHub last commit](https://img.shields.io/github/last-commit/AndrewJBateman/pern-stack-database?style=plastic)\n\n## :page_facing_up: Table of contents\n\n* [:zap: PERN Full Stack Database](#zap-pern-stack-database)\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  * [:computer: Code Examples](#computer-code-examples)\n  * [:clipboard: Status \u0026 To-Do List](#clipboard-status--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* Postgresql shell commands: `\\l` list all databases. `\\c database1` connect to database1. `\\dt` inspect tables. `\\q` to quit.\n\n### Frontend\n\n* React frontend includes a city selection user input field and a dropdown list of cities. Select a city to see the weather there.\n* [JavaScript XML (JSX)](https://reactjs.org/docs/introducing-jsx.html) used to write HTML elements in Javascript\n\n## :camera: Screenshots\n\n![Backend screenshot](./img/postgresql.png)\n![Frontend screenshot](./img/weather.png)\n\n## :signal_strength: Technologies - Backend\n\n* [PostgreSQL v12](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 v12](https://nodejs.org/es/)\n* [Nodemon](https://www.npmjs.com/package/nodemon) npm module so backend server will automatically restart after code changes\n* [OpenWeather API](https://openweathermap.org/api) for weather data\n\n## :signal_strength: Technologies - Frontend\n\n* [React framework v17](https://reactjs.org/)\n* [Create React App](https://github.com/facebookincubator/create-react-app) used to bootstrap frontend React app\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 postgresql database \u0026 weather API access credentials to .env file\n* Run `nodemon server` for a dev server on port 5000\n\n## :floppy_disk: Setup - Frontend\n\n* Change to `/client` directory\n* Install dependencies using `npm i`. (I have not tried this method and cannot be sure it will work)\n* Alternatively - and better - bootstrap a new React project using `npx create-react-app my-app`\n* Run `npm start`. Frontend will open at `http://localhost:3000/`\n\n## :floppy_disk: Setup - Full stack\n\n* From top level `\\pern-stack-database` run `npm run dev` for a dev server on port 5000 and a React fontend at `http://localhost:3000/`\n\n## :computer: Code Examples - Backend\n\n* [Static method used](https://javascript.info/static-properties-methods) to add city to database list of cities.\n\n```javascript\n  // callback function - if error return it to callback. If no error then return rows (empty set)\n  static insert (city, callback) {\n    db.query('INSERT INTO cities (city_name) VALUES ($1)', [city], (err, res) =\u003e {\n      if (err.error)\n        return callback(err);\n      callback(res);\n    });\n  }\n```\n\n## :computer: Code Examples - Frontend\n\n* method to add a city\n\n```javascript\n// fetch an object that has a city property\n  // after getting city list clear input field\n  handleAddCity = () =\u003e {\n    fetch('/api/cities', {\n      method: 'post',\n      headers: { 'Content-Type': 'application/json' },\n      body: JSON.stringify({ city: this.state.newCityName })\n    })\n    .then(res =\u003e res.json())\n    .then(res =\u003e {\n      this.getCityList();\n      this.setState({ newCityName: '' });\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: Working front and back ends. App works and stores city names in PostgreSQL database. Deploy to Heroku not working - could be npm dependency issues or missing API access credentials in Heroku.\n* To-Do: Change backend so it checks if city already in database before adding it. Add commenting. Add functionality\n* Solve deploy issues: retry video 4 from 9.10 to create the correctly named database\n\n## :clap: Inspiration/General Tools\n\n* [Full Stack React App Tutorial (Beginners) | Part #1 – Introduction](https://www.youtube.com/watch?v=Z4jCvpSROp8\u0026t=1s)\n* [Full Stack React App Tutorial (Beginners) | Part #2 – Back End](https://www.youtube.com/watch?v=Bz0oxKrOcNk)\n* [Full Stack React App Tutorial (Beginners) | Part #3 – Front End](https://www.youtube.com/watch?v=0RtSiP5Dnn8)\n* [Full Stack React App Tutorial (Beginners) | Part #4 – Deployment](https://www.youtube.com/watch?v=0eGA1zYvyeU)\n* [Full Stack React App Tutorial (Beginners) | Part #5 – Best Practices (Bonus)](https://www.youtube.com/watch?v=uajUz8rswyM)\n* [React documentation](https://reactjs.org/docs/getting-started.html)\n* [PostgreSQL Quick Command List](http://jcsites.juniata.edu/faculty/rhodes/dbms/pgsql.htm)\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-database","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewjbateman%2Fpern-stack-database","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewjbateman%2Fpern-stack-database/lists"}