← Back to Home

Code-Along 1: API Design and DynamoDB Table Design

What You'll Learn

What is a Code-Along?

Code-Alongs are live experiences taught by our expert instructors designed to prepare you for concepts found in the sprint challenges. Code-Alongs are your opportunity to work on complex job-ready problems in a live and engaging environment.

Code-Alongs are live classes 50 minutes in length designed to offer deeper insights into learning your core competencies and are offered seven days a week in the morning, afternoon, and evening.

Because Code-Alongs delve deeper into a core competency, you will need to come to class prepared to have the best experience.

Key Concepts for This Code-Along

API Design Fundamentals

An API (Application Programming Interface) defines how a client interacts with a server. In this Code-Along, we'll focus on designing RESTful APIs for your project. Some key concepts to understand include:

Here's an example of a well-designed REST API endpoint:

// GET /users/{userId}
// Response body:
{
  "userId": "123",
  "username": "johndoe",
  "email": "john@example.com",
  "createdAt": "2023-06-15T14:30:00Z"
}

// POST /users
// Request body:
{
  "username": "newuser",
  "email": "new@example.com",
  "password": "securePassword123"
}
// Response:
{
  "userId": "456",
  "username": "newuser",
  "email": "new@example.com",
  "createdAt": "2023-07-01T10:15:00Z"
}

DynamoDB Table Design Principles

DynamoDB is a NoSQL database that requires a different approach to table design compared to traditional relational databases:

Example DynamoDB table design for a blog application:

// Table name: BlogApp
// Primary key: PK (partition key), SK (sort key)

// User item
{
  "PK": "USER#123",
  "SK": "PROFILE",
  "username": "blogger1",
  "email": "blogger1@example.com"
}

// Blog post item
{
  "PK": "USER#123",
  "SK": "POST#2023-07-01",
  "title": "DynamoDB Best Practices",
  "content": "Here are some tips for designing DynamoDB tables..."
}

// Comment on a post
{
  "PK": "POST#456",
  "SK": "COMMENT#789",
  "userId": "USER#123",
  "content": "Great post!"
}

During This Code-Along

In this session, you'll work through a practical example of designing APIs and DynamoDB tables for a real application. You'll learn how to:

The example application will demonstrate various access patterns including:

We'll also cover how to handle common challenges like:

Resources for This Code-Along

Starter Code

Download or clone the starter code repository for this Code-Along session.

Solution Code

The completed solution for reference after the Code-Along session.

Schedule a Code-Along

Book a live Code-Along session with an instructor.

Preparation Checklist

The best Code-Along experiences happen when you are ready before coming to class. Your instructors created a starting point and a solution for each of your Code-Alongs to ensure you have what you need to succeed.

Before attending this Code-Along, please make sure you:

Related Resources

API Design Module

Review the API Design module content before attending this Code-Along.

DynamoDB Table Design Module

Review the DynamoDB Table Design module content before attending this Code-Along.