- This project will be archived as read-only indefinitely as of April 5, 2024. Any existing site deployments listed below may stay up, but future maintenance or fixes are not planned
- The production deployment I was using on render.com will only load the index page (which doesn't make any database calls), as the Heroku / ClearDB database I was using is no longer available for free, as of December 18, 2023
- In theory, this project should still work with a locally deployed SQL database or a cloud SQL database (which you may or may not have to pay for). However, future compatibility with newer NodeJS versions (probably needed for most cloud deployments) is not guaranteed; as listed below this was last tested with NodeJS v16.15.1
- The info given below is otherwise still accurate from an educational standpoint, and there a variety of other database vendors that may offer free or cheap plans (do your own research). If you pick a nonrelational database vendor like MongoDB, the SQL code as written below will need adjustments, as seen here
Proof of concept CRUD (Create, Read, Update, Delete) site, with database interaction.
The site is meant to be used by a theoretical hospital. The user is able to insert new entries, update entries, delete entries, search and view existing entries for a variety of hospital-related applications.
- SQL (ClearDB) for database management
- NodeJS for backend (last tested to work on NodeJS v16.15.1)
- Express Handlebars used for frontend templating of recurring site features
- Deployed on render.com
- Entity Relationships Diagram
- Schema
- The final SQL implementation can be viewed in the
ddqheroku.sql
file here.
Screenshot of Pharmacy Page after Searching for pharmacy named "Kroger":
Screenshot of Pharmacy page after filling out the "Add new Pharmacy" form and adding a new Pharmacy "Johnson Pharmacy":
Screenshot of Pharmacy page after deleting " Albertsons" pharmacy:
Screenshot of Pharmacy Update Page after clicking on "Update" for pharmacy "Wallgreens&":
Screenshot of Pharmacy page after I updated "Wallgreens&" pharmacy to have the name "Wallgreens" instead:
SQL Database Setup
- Helpful Video Guide
- This video isn't 100% matching this project's use case but still a lot there that helps. Refer to the video if instructions below confuse.
- Make Heroku account and ClearDB account (Even though we deploy on Render.com, we need Heroku for the free ClearDB database add-on).
- December 18, 2023 edit: The Heroku ClearDB add-on is no longer free; there may be other free relational (SQL) database offerings out there, do your own research
- Install MySQL Workbench or similar SQL tool, log in to your ClearDB database in MySQL Workbench. Run the file
ddqheroku.sql
(found in the project root directory here) in MySQL Workbench to initiate the database creation and populate it with sample data. - Create
dbcon.js
file using your ClearDB credentials, withdbdon.js.example
file (in root directory) as a template. - If you ever need to debug the SQL database, you can try running some of the commands found in the
dmq.sql
file here.
How to Run Locally
- Run
yarn
to install node modules. - Run
npm start
to test the website locally.
How to Deploy
- Currently deployed on render.com
- Optional Security Measure: I made a duplicate, private cloned repository that was identical to the public repository. I removed
dbcon.js
from the public repository, while keepingdbcon.js
in the private repository. I deployed from the private repository to prevent my credentials from being leaked, and I made sure that the public repository haddbcon.js
listed in the.gitignore
.- Another approach is to make a local (not remote) Git branch and keep your credentials there.