
Learn to build rest APIs with Hummingbird framework in Swift, covering installation, route parameters, MVC, databases (raw SQL and Fluent), authentication with JWT and refresh tokens, and deployment on Railway.
Install Hummingbird by cloning the starter template, run the configure script to create a project, then execute swift run to start the local server at 127.0.0.1:8080.
Open and inspect the Hummingbird starter template, understand package.swift, config readers, and the app build with a hello route. Learn to auto-restart on code changes with watchexec to streamline development.
Install watchexec as a standalone tool to watch swift files and restart the server. Watch changes and run swift run automatically, keeping localhost 8080 updated during development.
Create custom routes using router.get and route parameters in Swift backends. Extract genre and year from the request context, and ensure decodable responses with proper bad request handling.
Learn to return structured data as JSON from a Swift backend, using a codable movie model, and create routes for all movies and by id while avoiding route collisions.
Create a post endpoint with router.post to receive a json movie (id, name, year), decode it, and return the movie to confirm the post.
Builds a MovieStore actor to safely manage a private movies array, exposing an add movie function with async/await and private set, and demonstrates adding Finding Nemo before future database persistence.
Learn to handle query strings in Hummingbird by defining a route like movie/search, accessing query parameters via request.uri.queryparameters, extracting q and page number, validating them, and returning appropriate responses.
Learn to organize back-end routes with hummingbird by creating route groups and nested groups, prefixing api endpoints, and mapping get and post routes for movies and users.
Explore the mvc design pattern, where the model defines the data shape, the view displays the interface, and the controller mediates requests and responses.
Learn to build a movie controller wired to a movie repository, create a route collection, and register the api path slash movies to expose a get movies endpoint.
Build controllers with get by id and create movie using repository; test with postman on api/movies, plan to migrate from in-memory storage to a database with one-to-many and many-to-many relationships.
Install and run Postgres using the Postgres app to create a movies database for your Hummingbird API project, then prepare to set up tables and repository in the next lecture.
Set up a Postgres client for hummingbird with Postgres Neo, configure localhost and moviesdb, and create a uuid primary key table with title and year before starting services.
Verify the movie repository's createTable by inspecting the PostgreSQL schema and data with terminal commands and Beekeeper Studio, revealing the MoviesTable with id as UUID, title, and year.
Implement the save function to insert a new movie into postgres, generate a uuid, set title and year, and return the saved movie from the repository.
Learn to fetch all movies by implementing a repository getAll using an async stream, decoding database rows, and exposing the /api/movies endpoint.
Fetch a single movie by its id using getByID in movie repository, querying id, title, and year, decoding with AsyncStream, and wiring /api/movie/{id} to return the movie or not found.
Delete a movie in a Swift backend by validating its id with getByID, removing it via the repository, handling not found errors, and returning the deleted movie.
Learn to update a movie by fetching by id, validating existence, throwing not found when missing, updating the movies table, and returning the updated movie with put or patch semantics.
Refactor the app.build setup to consolidate MovieRepository into a single, non-optional instance within the build application function, simplifying routing, services, and table creation.
Refactor the save function to generate UUIDs at the database level with a default in Postgres and return the inserted ID, while reorganizing custom errors and models.
Create a one-to-many relationship by adding a review model with id, comment, rating, movieID, and created_at, and set up an empty reviews controller and routes for /api/movies/{movieID}/reviews.
Create a review repository and the reviews table with uuid id defaulting to get random UUID, movie_id foreign key to movies, rating checks, review text, and created_at; enable cascade delete.
Add a post endpoint to save a movie review by extracting movie ID from URL and decoding a create review request with comment and rating, then persist and return the ID.
Learn to fetch a movie by id and attach all its reviews using a movieDetail DTO, constructing and returning a detailed response with id, title, year, and reviews.
Expose a backend endpoint for admins that returns all reviews with their associated movie data, including title and year, via a review detail data transfer object and the getAll method.
Discover how the Fluent ORM generates and executes SQL, replacing hand-written queries. Start with the starter project, set up Postgres with Fluent, and prepare for CRUD via migrations.
Connect the hummingbird app to a postgres database using the fluent postgres driver, configuring host, port, user, and the MoviesDB database; register fluent as a service to manage the connection.
Define a movies table with id uuid, title string, and year int via an async migration in fluent kit; implement prepare and revert and register migrations for automatic execution.
Create a movie data model that conforms to Fluent's model protocol and maps to the movies table, with id as UUID, title, and year, plus initializers for the ORM.
Create and save a movie using the movies controller and Fluent ORM, wiring routes and dependency injection, decoding a createMovieRequest, and persisting via Fluent to the database.
Learn to implement get all and get by id endpoints for movies using Fluent in Swift, comparing with the Postgres client, and handling uuid-based route parameters.
Learn to delete and update movies using Fluent DB in Swift, including fetching by ID, returning the deleted movie, and updating via an update request DTO with decoding and saving.
Create a reviews table with Fluent ORM by writing an async migration named create reviews table, including id, subject, comment, movie_id (UUID with cascade on delete), and created_at.
Create a review data model with codable and unchecked sendable, link reviews to movies using a movie id via a belongs-to relationship, and expose a movie-to-reviews has-many relationship.
Build a reviews controller with Fluent to create and persist movie reviews, decode create review requests, and save reviews tied to a movie ID via a POST endpoint.
Learn to fetch a movie by id with its reviews. Return a simplified movie response and map data models to review and movie responses using extensions for clean api outputs.
Expose an api endpoint at /api/reviews to return all reviews with their associated movies using fluent, an admin operation.
Create a users table via a FluentKit migration to store usernames and passwords, with a UUID id and a unique username constraint, and prepare a user data model for persistence.
Create a user data model aligned with the database schema, including id, username, and password, conforming to the model protocol, codable, and unchecked sendable, and prepare for user registration.
Create a dedicated users controller with an api/users/register endpoint, use a create user DTO, decode request, check for existing username, save the user, and return a registration message.
Encrypt passwords with bcrypt in the Hummingbird backend by hashing during user creation with the Hummingbird Authentication package, and secure sensitive data like social security and credit card numbers.
Set up the login route, decode the login request, verify the user with Fluent and bcrypt, and return a login response with access and refresh tokens.
Implement access and refresh token authentication in Swift using JWT kit, building payloads (sub, exp, username, token type), configuring JWT key collection, and secure client storage.
Configure the JWT key collection by moving secret keys to an env file, read them via the config reader, and issue access and refresh tokens securely.
Implement a JWT-based middleware to protect routes by extracting and validating access tokens from the authorization header, returning an authenticated user.
Protect api routes with a JWT authenticator middleware for movies and reviews, enforce bearer token in authorization header, and log in to obtain an access token.
Implement a refresh action that exchanges a valid refresh token for a new access token. Verify the JWT payload type is refresh, check user existence, and return a refresh response.
Learn to locally deploy a hummingbird swift web API with docker and postgres, build a docker image, and configure environment variables for database access before railway deployment.
Build an AMD64 docker image for the hummingbird app, push to hub.docker.com, and deploy via railway. Set up a Postgres database and environment keys during deployment.
Configure Postgres and app environment variables via the raw editor, verify deployment, and generate a domain to test the app with Postman, ensuring database connectivity.
Celebrate completing the course and embrace lifelong learning at Azamsharp School. Discover machine learning, concurrency, and CIF UI architecture, plus the CIF UI architecture patterns and practices book on Amazon.
Most Swift developers never explore what it’s like to build backend systems using Swift. This course changes that.
In this course, you’ll learn how to build fast, modern, and production-ready backend applications using Hummingbird, a lightweight and powerful server-side Swift framework built on top of SwiftNIO.
Instead of abstract theory, we focus on building a real backend step by step. You’ll learn how to design APIs, structure your code, and work with databases while taking full advantage of Swift’s async/await and structured concurrency.
We start from the ground up. Even if you’ve never written backend code before, you’ll understand how everything fits together.
In this course, you will:
Build REST APIs using Hummingbird
Understand routing, request handling, and middleware
Learn how Request and Context work and why they matter
Structure your application using controllers and clean patterns
Work with databases using Fluent and PostgreSQL
Perform CRUD operations with real data
Implement authentication using JWT
Handle errors and responses properly
Understand how Swift concurrency improves backend performance
You’ll also learn how Hummingbird compares to frameworks like Vapor, and why its design around structured concurrency makes it a great choice for modern backend development.
By the end of this course, you won’t just know how to write endpoints. You’ll understand how to design and build a complete backend system using Swift.
This course is ideal for:
iOS developers who want to move into backend development
Swift developers curious about server-side Swift
Developers who want a modern alternative to Node.js or Express
Anyone interested in building APIs using Swift
You should have basic knowledge of Swift. No backend experience is required.
If you’ve been writing Swift on the client side and want to expand your skills into backend development, this course will give you a solid, practical foundation.