Learning through building: SurrealDB University's newest tutorial
Source: Dev.to
Introduction
Today we’re pleased to announce a new addition to SurrealDB University, the best place to learn SurrealDB and its query language. This new tutorial brings the number of ways to learn SurrealDB through the university to four.
Existing Courses
SurrealDB University began with two courses:
- SurrealDB Fundamentals – a video‑based course that can be completed in as little as three hours.
- Aeon’s Surreal Renaissance – a book that teaches SurrealDB through a story, taking several days to work through.
Later we added a third offering:
- Tour of SurrealDB – a concise tour that can be completed in as little as 30 minutes.
These courses served three types of learners, but a fourth type remained unsatisfied: people who learn best by building and want a runnable project at the end of the tutorial.
Why a New Tutorial?
The last four chapters of Aeon’s Surreal Renaissance already guide learners through building a movie‑database project using loosely structured JSON data. However, directing users straight to those chapters posed two problems:
- Pacing – The tutorial starts at the end of the book, assuming prior knowledge. New users would encounter a rapid succession of topics with little new content.
- Spoilers – Those chapters conclude the story, so presenting them first would spoil the narrative experience.
Consequently, we rewrote the material as a standalone tutorial.
Learning Path Overview
In this new tutorial you will:
- Insert loosely typed JSON data.
- Learn SurrealQL types that the original data will be converted to, and understand their benefits.
- Define functions to perform the conversions.
- Define database parameters for movie genres and ratings.
- Insert the transformed movie data.
- Add a schema.
- Define indexes, including two for full‑text search.
- Add actors, writers, and directors, linking them to movies via graph edges.
- Define database system users with different roles.
- Create an access method so non‑system users can interact with the database under strict permissions.
- Test the database from the perspective of each user type, using both Surrealist and
curlrequests in the terminal.
The tutorial is roughly 12 000 words—manageable in a focused afternoon or over two days for a more relaxed pace.
Extending the Project
Once the database is up and running, you can continue building on it. For example:
- Add a UI that leverages the
edgengramfilter in the full‑text index to display movie titles and plots as the user types (e.g., showing results for “Terminator 2” after typing “ter”). - Integrate a Rust frontend that uses the movie database and displays posters, utilizing the
Posterfield that contains image URLs.
If you create an extension or example based on this tutorial, feel free to open a pull request to add it to the examples folder. This is a great way to showcase your completed tutorial and demonstrate how to integrate SurrealDB as a backend for your favorite programming language.