TheOdinProject / curriculum

The open curriculum for learning web development
https://www.theodinproject.com/
Other
10.06k stars 13.48k forks source link

Using PostgreSQL: Expand on "Populating production dbs" #28581

Open guudewie opened 3 months ago

guudewie commented 3 months ago

Checks

Describe your suggestion

The paragraph "Populating production dbs" in the Using PostgreSQL lesson is missing context. The word "production database" is never mentioned before, so in my opinion it is not clear what this paragraph is about.

Further, regarding the code snippet below the paragraph, I think it is not clear where the variables and are coming from. Based on context it is obvious, that these are environment variables. Nevertheless, it should be emphasised and explained how to change the script to use these variables. And again, I think the differentiation of local and production db is not clear at this point.

Path

Node / JS

Lesson Url

https://www.theodinproject.com/lessons/nodejs-using-postgresql

(Optional) Discord Name

guudewie

(Optional) Additional Comments

No response

MaoShizhong commented 3 months ago

@01zulfi would appreciate your thoughts on this

01zulfi commented 2 months ago

@guudewie Thanks for creating an issue.

The word "production database" is never mentioned before, so in my opinion it is not clear what this paragraph is about.

The deployment lesson prior to this lesson talks about deploying an application and a database to production. By this lesson, it should be clear what's the difference is between a local environment and a production environment. I'm not sure how we can make the paragraph clearer, do you have any specific suggestions?

Nevertheless, it should be emphasised and explained how to change the script to use these variables

I'm not clear which code snippet you're talking about, but I think it's the terminal commands we show where you can pass in database URLs. Its implementation is intentionally left out as we assume the learner is coding along the lesson and they'll do it themselves. We do mention how to access these command line arguments in the lesson. Putting these pieces together is what we expect the learner to achieve. Though, I'd like to hear your thoughts on this as well.

github-actions[bot] commented 1 month ago

This issue is stale because it has had no activity for the last 30 days.

CouchofTomato commented 1 month ago

@guudewie Are you still open to discussing this?

guudewie commented 1 month ago

Yes, sorry for the late reply. So let me explain again.

The lesson is structured as follows;

  1. it sets up a basic express app,
  2. goes on to set up and populate a (local) psql db,
  3. and then shows how to interact with the db in the express application.
  4. Lastly the lesson outlines the workflow of connecting the local db in development and the production db in production.

So, I think there is a link missing between points 1-3 and 4. This could be a small paragraph explaining the difference between local and production db and why we use either for prod or dev environments. Following a rough idea (made with claude):

"As we develop our application, we typically use a local database for several reasons:

Speed: Interacting with a database on your own machine is faster than communicating with a remote database. Ease of setup and modification: Local databases are easier to set up, reset, and modify during the development process. Working offline: You can work on your project without an internet connection.

However, when we're ready to deploy our application, we need to use a production database. Here's why:

Availability: Your local machine isn't always on or connected to the internet, but a production database is designed for constant availability. Scalability: Production databases can handle more concurrent connections and larger amounts of data. Security: Production databases have better security measures in place to protect your data.

Most hosting providers offer database services that integrate well with your deployed application. This setup ensures your app performs efficiently and securely in a production environment."

I think something like the above gives a bit more context on why suddenly a production database is talked about. I think most people that made it so far in the curriculum will eventually understand how and when to use local and prod dbs, but I think a small explanatory paragraph as above will make the lesson smoother.

CouchofTomato commented 1 month ago

@01zulfi Can you take a look please.

github-actions[bot] commented 2 weeks ago

This issue is stale because it has had no activity for the last 30 days.

CouchofTomato commented 1 week ago

@01zulfi Can you take a look at this please.

01zulfi commented 2 days ago

Sorry for the late reply.

Thanks for the great writeup @guudewie. This sounds good to me. Are you willing to create a pull request to make this addition?

guudewie commented 1 day ago

Yes, I can try!

01zulfi commented 1 day ago

@guudewie assigned!