DEV Community

Cover image for Using AWS App Runner to build & host my website
Muhammed Ashraf
Muhammed Ashraf

Posted on

Using AWS App Runner to build & host my website

Overview

AWS provides a lot of different ways to deploy your application. based on whatever you are looking for, you will find a service for this. For example, if you are looking to deploy a classic application you have EC2 or a fully managed service you have Elastic Beanstalk. If you are looking to host containers, you have Amazon ECS, EKS or you can use for a fast and simple service like AWS App Runner

As per AWS documentation. AWS App Runner is very simple, fast service that helps you to deploy your application from either source code like GitHub or Image repo like ECR into a scalable and cost-effective service

Referring to cost. the service is very cost-effective since you will only pay for the actual traffic since App Runner provision resources based on your traffic (Lower Number of requests = Lower provisioned resources)

I was trying to explore AWS App Runner, So I deployed a website on AWS App Runner with other services such as S3, DynamoDB, ECR and Amazon SES for sending emails.

Architecture

Technology Stack

  • Runtime: Node.js
  • Framework: Express.js
  • Templating: EJS (Embedded JavaScript)
  • Frontend: Tailwind CSS (Styling), Alpine.js (Interactivity/State)
  • Database: AWS DynamoDB (NoSQL)
  • Storage: AWS S3 (Food Images)
  • Email: AWS SES (Order Notifications)
  • Hosting: AWS App Runner (Dockerized)

Directory Structure

Core files:

  • server.js: Entry Point. Configures Express, middleware and static files. Starts the server.

  • lib/aws-client.js: AWS Utility. Centralizes initialization of DynamoDB Client, S3 Client, and SES Client.

Route Handlers:

  • shop.js: Customer Facing. Handles public access to the menu, cart operations, and checkout.

  • admin.js: Admin Management. Protected routes for managing items, authentication, and stats.

Views:

  • index.ejs: Homepage. Renders the Menu (Hot/Frozen sections), Cart Drawer, and Hero section.

  • admin.ejs: Dashboard. Main Admin interface for Adding/Editing/Deleting items.

  • admin-stats.ejs: Analytics. Visual dashboard using Chart.js to show revenue and order trends.

  • login-ejs: Authentication. Admin login form.

Partials:

  • header.ejs: Navigation bar, Mobile Menu, Favicon, Libraries import (Tailwind, Alpine).

  • footer.ejs: Page footer, Closing tags.

  • product-card.ejs: Reusable component for rendering a single regular menu item.

  • cart-drawer.ejs: The sliding cart sidebar content

AWS Components

Compute: AWS App Runner

Role: Fully managed container application service.
Configuration: Autoscaling instances based on request load.
Source: Deploys the Docker image directly from Amazon ECR.

Database: Amazon DynamoDB

Role: Serverless NoSQL key-value database.
Tables:
MenuTable: Stores food items (itemId, name, price, description, category).
OrdersTable: Stores customer orders (orderId, customerDetails, items, total, status).

Storage: Amazon S3

Role: Object storage for uploaded food images.
Access: Images are uploaded via the Admin Panel. The application generates signed URLs or proxies them for secure display.

Container Registry: Amazon ECR

Role: Securely stores the Docker container images.
Workflow: docker push commands upload new versions of the app. App Runner detects these changes to update the live site.

Communications: Amazon SES
Role: Reliable email delivery service.

Snapshots from the website

So, AWS App Runner simplifies the deployments. You don't care about the deployment's steps You only focus on improving your code or monitor your website.

Top comments (0)