<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Clarisse X. K.</title>
    <description>The latest articles on DEV Community by Clarisse X. K. (@clarisse_x).</description>
    <link>https://dev.to/clarisse_x</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4235412%2F0926793b-28be-4495-afde-57325ec93b19.png</url>
      <title>DEV Community: Clarisse X. K.</title>
      <link>https://dev.to/clarisse_x</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/clarisse_x"/>
    <language>en</language>
    <item>
      <title>Building the "Little Dino Sanctuary": A Multi-Tier Web Application with Node.js, PostgreSQL, and Docker</title>
      <dc:creator>Clarisse X. K.</dc:creator>
      <pubDate>Tue, 10 Nov 2026 05:35:51 +0000</pubDate>
      <link>https://dev.to/clarisse_x/building-the-little-dino-sanctuary-a-multi-tier-web-application-with-nodejs-postgresql-and-m8h</link>
      <guid>https://dev.to/clarisse_x/building-the-little-dino-sanctuary-a-multi-tier-web-application-with-nodejs-postgresql-and-m8h</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;A cozy multi-tier web sanctuary for dinosaur cataloging, built with containerized architecture and modern DevOps practices.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  1. Introduction &amp;amp; The Problem
&lt;/h2&gt;

&lt;p&gt;When building modern web applications, ensuring consistency across development and production environments is one of the biggest hurdles developers face. For the &lt;strong&gt;Little Dino Sanctuary&lt;/strong&gt; project, the core challenge was to design a reliable, scalable, and secure system for cataloging dinosaur resident records while ensuring seamless deployment. &lt;/p&gt;

&lt;p&gt;We chose this project because it perfectly mirrors real-world enterprise architectures separating concerns between a robust backend API, a persistent database layer, and a clean user interface all while strictly adhering to modern security standards like secret management.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. System Architecture
&lt;/h2&gt;

&lt;p&gt;The application follows a classic multi-tier client-server architecture containerized via Docker:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Presentation Tier:&lt;/strong&gt; Static frontend interface serving resident records (&lt;code&gt;public/index.html&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Application Tier:&lt;/strong&gt; Node.js &amp;amp; Express REST API handling business logic (&lt;code&gt;server.js&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data Tier:&lt;/strong&gt; PostgreSQL database container managing persistent storage with isolated data volumes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Orchestration:&lt;/strong&gt; Docker Compose coordinates the networking and startup sequence between the backend and database services.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  3. Key Docker Configuration &amp;amp; Explanation
&lt;/h2&gt;

&lt;p&gt;Containerization ensures that the application runs identically on any machine. Below are the essential snippets from our configuration files.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Dockerfile
&lt;/h3&gt;

&lt;p&gt;Our multi-stage setup optimizes the Node.js runtime environment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt; node:18-alpine
&lt;span class="k"&gt;WORKDIR&lt;/span&gt; /usr/src/app
&lt;span class="k"&gt;COPY&lt;/span&gt; package*.json ./
&lt;span class="k"&gt;RUN&lt;/span&gt; npm install
&lt;span class="k"&gt;COPY&lt;/span&gt; . .
&lt;span class="k"&gt;EXPOSE&lt;/span&gt; 3000
&lt;span class="k"&gt;CMD&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"node"&lt;/span&gt;, &lt;span class="s2"&gt;"server.js"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Explanation:&lt;/strong&gt; We use a lightweight Alpine Linux base image to keep the container size minimal. It installs production dependencies, copies the source code, and exposes port &lt;code&gt;3000&lt;/code&gt; to handle incoming HTTP requests.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The docker-compose.yml
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'3.8'&lt;/span&gt;
&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;.&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"3000:3000"&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;DB_HOST=db&lt;/span&gt;
    &lt;span class="na"&gt;depends_on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;db&lt;/span&gt;
  &lt;span class="na"&gt;db&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;postgres:15-alpine&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;POSTGRES_DB&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;dino_sanctuary&lt;/span&gt;
      &lt;span class="na"&gt;POSTGRES_USER&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;postgres&lt;/span&gt;
      &lt;span class="na"&gt;POSTGRES_PASSWORD&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;secretpassword&lt;/span&gt;
    &lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;pgdata:/var/lib/postgresql/data&lt;/span&gt;

&lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;pgdata&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Explanation:&lt;/strong&gt; This configuration defines two interconnected services (&lt;code&gt;app&lt;/code&gt; and &lt;code&gt;db&lt;/code&gt;). It establishes internal networking so the Node.js application can communicate securely with the PostgreSQL database container using Docker volumes for persistent data storage.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  4. Security Best Practices: Managing &lt;code&gt;.env&lt;/code&gt; Secrets
&lt;/h2&gt;

&lt;p&gt;A critical learning point of this project was enforcing strict security policies. To prevent credential leaks, sensitive environment variables (such as database passwords) are stored locally in a &lt;code&gt;.env&lt;/code&gt; file which is explicitly excluded from version control via &lt;code&gt;.gitignore&lt;/code&gt;. Teammates and evaluators can use &lt;code&gt;.env.example&lt;/code&gt; as a safe template.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. How to Run Locally
&lt;/h2&gt;

&lt;p&gt;Getting the sanctuary up and running on your local machine takes less than a minute with Docker:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Clone the repository:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   git clone https://github.com/Clarisse-X/little-dino-sanctuary.git
   &lt;span class="nb"&gt;cd&lt;/span&gt; little-dino-sanctuary
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Configure environment variables:&lt;/strong&gt;
Copy the example file and adjust values if needed:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   cp .env.example .env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Build and launch with Docker Compose:&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   docker-compose up --build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Open your browser and navigate to &lt;code&gt;http://localhost:3000&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  6. Lessons Learned
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Containerization Mastery:&lt;/strong&gt; Gained hands-on experience writing robust Dockerfiles and orchestrating multi-container environments using Docker Compose.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Git Workflow Discipline:&lt;/strong&gt; Learned the importance of structured, incremental commits and rigorous secret management (keeping &lt;code&gt;.env&lt;/code&gt; out of public repositories).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CI/CD Readiness:&lt;/strong&gt; Successfully pushed version-tagged images (&lt;code&gt;1.0.0&lt;/code&gt; and &lt;code&gt;latest&lt;/code&gt;) to Docker Hub, bridging the gap between local development and cloud distribution.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Project Links &amp;amp; Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Repository:&lt;/strong&gt; &lt;a href="https://github.com/Clarisse-X/little-dino-sanctuary" rel="noopener noreferrer"&gt;https://github.com/Clarisse-X/little-dino-sanctuary&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Docker Hub Image:&lt;/strong&gt; &lt;a href="https://hub.docker.com/r/clarissex/little-dino-sanctuary" rel="noopener noreferrer"&gt;https://hub.docker.com/r/clarissex/little-dino-sanctuary&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Video Demonstration:&lt;/strong&gt; &lt;a href="https://youtu.be/xaD6QPT06bs" rel="noopener noreferrer"&gt;https://youtu.be/xaD6QPT06bs&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>docker</category>
      <category>webdev</category>
      <category>node</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
