{"id":20847754,"url":"https://github.com/todd-demone/lighthouse-bnb","last_synced_at":"2026-05-18T03:12:05.238Z","repository":{"id":135699551,"uuid":"449829301","full_name":"todd-demone/lighthouse-bnb","owner":"todd-demone","description":"The primary purpose of this project was to design a relatIonal database and use SQL and PostgreSQL to create and query the database. The SQL was incorporated into the Node.js/Express backend.","archived":false,"fork":false,"pushed_at":"2022-02-04T21:05:28.000Z","size":2685,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-23T16:41:12.542Z","etag":null,"topics":["database-design","javascript","postgresql","sql"],"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/todd-demone.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-19T19:33:15.000Z","updated_at":"2022-01-27T11:03:58.000Z","dependencies_parsed_at":"2024-04-19T00:15:48.040Z","dependency_job_id":null,"html_url":"https://github.com/todd-demone/lighthouse-bnb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/todd-demone/lighthouse-bnb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/todd-demone%2Flighthouse-bnb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/todd-demone%2Flighthouse-bnb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/todd-demone%2Flighthouse-bnb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/todd-demone%2Flighthouse-bnb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/todd-demone","download_url":"https://codeload.github.com/todd-demone/lighthouse-bnb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/todd-demone%2Flighthouse-bnb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33163451,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T22:39:12.733Z","status":"online","status_checked_at":"2026-05-18T02:00:06.436Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["database-design","javascript","postgresql","sql"],"created_at":"2024-11-18T02:22:52.070Z","updated_at":"2026-05-18T03:12:05.233Z","avatar_url":"https://github.com/todd-demone.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lighthouse BnB\n\nThis pre-existing Airbnb clone used in-memory objects to store its data, so I incorporated a database into the backend of this application (more details below).\n\n## Purpose\n\nI worked on Lighthouse BnB while completing the [Lighthouse Labs Web Development Flex Program](https://www.lighthouselabs.ca/en/web-development-flex-program). \n\nThe primary objectives of this project were:\n- design a relational database using [database design](https://en.wikipedia.org/wiki/Database_design) best practices, including applying the [normalization rules](https://en.wikipedia.org/wiki/Database_normalization)\n- use SQL and PostgreSQL to create the database and tables and seed the tables\n- create a connection to the database use `pg` and `dotenv`\n- create database queries\n    * functions for user-related queries: \n        * `getUserWithEmail`\n        * `getUserWithId`\n        * `addUser`\n    * functions for api-related queries:\n        * `getAllProperties` (including filters for property search)\n        * `getAllReservations`\n        * `addProperty`\n- call the db query functions from within the route handler functions and utilize the returned data as needed.\n\n## Dependencies\n\nThe instructions below assume that the following software is installed on your computer:\n- [git](https://git-scm.com/)\n- [Node.js](https://nodejs.org) (I used v. 12.8.2)\n- [npm](https://www.npmjs.com/) - included with Node.js\n- [PostgreSQL](https://www.postgresql.org/)\n\n## Instructions for running the app\n\n1. Clone the repository and install the dependencies via npm:\n\n```bash\ngit clone git@github.com:todd-demone/lighthouse-bnb.git\ncd lighthouse-bnb\nnpm install\n```\n\n2. Create a `.env` file in your root folder to store your database-related environment variables. An example file `.env.example` has been included in the root folder of the app.\n\n3. Before proceeding, you may need to set up a password for your user on psql (the PostgreSQL command-line tool):\n    - Open `psql` on the command line\n    - Type `\\password`\n    - Type your new password, hit Enter, type the password again, hit Enter.\n\n4. Create and seed the database:\n    - Open `psql` on the command line\n    - create a database\n    - connect to the database\n    - create the tables\n    - seed the tables with some fake data\n\n```\nCREATE DATABASE lightbnb;\n\\c lightbnb;\n\\i db/migrations/01_schema.sql;\n\\i db/seeds/01_seeds.sql;\n\\i db/seeds/02_seeds.sql;\n```\n\n5. Run the server.\n```\nnpm run start\n```\n\n6. go to \u003chttp://localhost:3000/\u003e in your browser.\n\n7. Click the login link. Use the following sample user data to complete the login:\n    - email: `jacksonrose@hotmail.com` \n    - password: `password`\n\n## Npm Dependencies\n\n- [bcrypt](https://www.npmjs.com/package/bcrypt)\n- [cookie-session](https://www.npmjs.com/package/cookie-session)\n- [dotenv](https://www.npmjs.com/package/dotenv)\n- [express](https://expressjs.com/)\n- [nodemon](https://www.npmjs.com/package/nodemon)\n- [pg](https://node-postgres.com/)\n- [sass](https://sass-lang.com/)\n\n## Author\n\n[Todd Demone](https://github.com/todd-demone)\n\n## Project Structure\n\n```\n├── db\n│   ├── migrations\n│   │   ├── 01_schema.sql\n│   ├── queries\n│   │   ├── 01_single_user.sql\n│   │   ├── 02_avg_length_of_reservation.sql\n│   │   ├── 03_property_listings_by_city.sql\n│   │   ├── 04_most_visited_cities.sql\n│   │   ├── 05_all_my_reservations.sql\n│   ├── seeds\n│   │   ├── 01_seeds.sql\n│   │   ├── 02_seeds.sql\n├── public\n│   ├── index.html\n│   ├── javascript\n│   │   ├── components \n│   │   │   ├── header.js\n│   │   │   ├── login_form.js\n│   │   │   ├── new_property_form.js\n│   │   │   ├── property_listing.js\n│   │   │   ├── property_listings.js\n│   │   │   ├── search_form.js\n│   │   │   └── signup_form.js\n│   │   ├── index.js\n│   │   ├── libraries\n│   │   ├── network.js\n│   │   └── views_manager.js\n│   └── styles\n├── sass\n└── server\n    ├── database\n    │   └── apis.js\n    │   └── connection.js\n    │   └── users.js\n    ├── routes\n    │   ├── apiRoutes.js\n    │   └── userRoutes.js\n    └── express_server.js\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftodd-demone%2Flighthouse-bnb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftodd-demone%2Flighthouse-bnb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftodd-demone%2Flighthouse-bnb/lists"}